Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.6] feat: workaround for implicit nullable deprecations in PHP 8.4 #9140

Merged

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Aug 22, 2024

Needs #9139

Description
See #9116

  • add workaround for the error like the following.

ErrorException: Kint\Parser\Parser::__construct(): Implicitly marking parameter $caller as nullable is deprecated, the explicit nullable type must be used instead

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the 4.6 label Aug 22, 2024
@kenjis kenjis mentioned this pull request Aug 22, 2024
15 tasks
@kenjis kenjis marked this pull request as draft August 22, 2024 02:00
@kenjis kenjis changed the title [4.6] feat: Workaround for implicit nullable deprecations in PHP 8.4 [4.6] feat: workaround for implicit nullable deprecations in PHP 8.4 Aug 22, 2024
@kenjis kenjis force-pushed the workaround-for-implicit-nullable-deprecations branch from b483b9e to ba1702f Compare September 5, 2024 01:31
@kenjis kenjis marked this pull request as ready for review September 5, 2024 01:32
@kenjis kenjis added the enhancement PRs that improve existing functionalities label Sep 5, 2024
@kenjis
Copy link
Member Author

kenjis commented Sep 5, 2024

This PR would fix the following errors:

There were 6 errors:

1) CodeIgniter\Commands\Utilities\ConfigCheckTest::testCommandConfigCheckApp
ErrorException: Kint\Parser\Parser::__construct(): Implicitly marking parameter $caller as nullable is deprecated, the explicit nullable type must be used instead

/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/kint-php/kint/src/Parser/Parser.php:75
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/kint-php/kint/src/Kint.php:345
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/kint-php/kint/src/Kint.php:560
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/kint-php/kint/init_helpers.php:41
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Commands/Utilities/ConfigCheck.php:129
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Commands/Utilities/ConfigCheck.php:109
/home/runner/work/CodeIgniter4/CodeIgniter4/system/CLI/Commands.php:70
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Common.php:190
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Commands/Utilities/ConfigCheckTest.php:59

2) CodeIgniter\Commands\Utilities\ConfigCheckTest::testGetKintD
ErrorException: Kint\Zval\Value::addRepresentation(): Implicitly marking parameter $pos as nullable is deprecated, the explicit nullable type must be used instead

/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/kint-php/kint/src/Zval/Value.php:65
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/kint-php/kint/src/Kint.php:398
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/kint-php/kint/src/Kint.php:574
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/kint-php/kint/init_helpers.php:41
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Commands/Utilities/ConfigCheck.php:129
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/ReflectionHelper.php:44
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Commands/Utilities/ConfigCheckTest.php:80

3) CodeIgniter\Database\DatabaseSeederTest::testFakerGet
ErrorException: Faker\Generator::__construct(): Implicitly marking parameter $container as nullable is deprecated, the explicit nullable type must be used instead

/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Generator.php:568
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Factory.php:20
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/Seeder.php:109
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Database/DatabaseSeederTest.php:50

4) CodeIgniter\Test\FabricatorTest::testConstructorWithString
ErrorException: Faker\Provider\DateTime::timezone(): Implicitly marking parameter $countryCode as nullable is deprecated, the explicit nullable type must be used instead

/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Provider/DateTime.php:337
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Factory.php:65
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Factory.php:48
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Factory.php:23
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/Fabricator.php:142
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Test/FabricatorTest.php:50

5) CodeIgniter\Test\FabricatorTest::testGetFakerReturnsUsableGenerator
ErrorException: Faker\Core\Number::randomNumber(): Implicitly marking parameter $nbDigits as nullable is deprecated, the explicit nullable type must be used instead

/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Core/Number.php:66
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Container/Container.php:101
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Container/Container.php:66
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Generator.php:591
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Generator.php:879
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Test/FabricatorTest.php:132

6) CodeIgniter\Test\FabricatorTest::testValidSetsOutValidValuesUsingCallback
ErrorException: Faker\Core\Number::randomNumber(): Implicitly marking parameter $nbDigits as nullable is deprecated, the explicit nullable type must be used instead

/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Core/Number.php:66
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Container/Container.php:101
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Container/Container.php:66
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Generator.php:591
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Generator.php:871
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/Generator.php:708
/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/fakerphp/faker/src/Faker/ValidGenerator.php:68
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/Fabricator.php:459
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/Fabricator.php:416
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Test/FabricatorTest.php:540

--

https://github.com/codeigniter4/CodeIgniter4/actions/runs/10712255682/job/29702517072

Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is a workaround only for the current implementation of Kint and Faker? If so, why do we mask all instances, not just those coming from these libraries?

This is a workaround for the dependent packages that are not compatible with PHP 8.4.
So we should not skip all implicit nullable deprecations.
@kenjis
Copy link
Member Author

kenjis commented Sep 6, 2024

Thanks. I added code to check if it is caused by Faker or Kint.

Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Hopefully these libraries will be updated before the release of PHP 8.4.

@kenjis kenjis merged commit e570f46 into codeigniter4:4.6 Sep 6, 2024
45 checks passed
@kenjis kenjis deleted the workaround-for-implicit-nullable-deprecations branch September 6, 2024 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.6 enhancement PRs that improve existing functionalities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants