feed-io icon indicating copy to clipboard operation
feed-io copied to clipboard

Silence PHP 8.4 deprecations regarding implicitly nullable parameters

Open mbabker opened this issue 9 months ago • 3 comments

This PR updates the library to silence deprecation notices on PHP 8.4 with implicitly nullable parameters. To try and keep the code diff as small as possible, here's what I did:

  • Bumped PHPUnit dev dependency to latest 9.6 release to ensure all dev dependencies will install with PHP 8.4 (it was previously locked to a transient set of dependencies that couldn't install on PHP 8.2 or later)
  • Bumped PHP-CS-Fixer to latest minor version (as this is a CS tool it doesn't really need to have a wide version range)
  • Ran composer update with the PHP platform config set to 8.1.33 to keep the lockfile compatible with PHP 8.1
  • Ran PHP-CS-Fixer with the config below
    • Note all the random whitespace additions/removals are from the fixer as well)
  • Ran PHPUnit to ensure there weren't any deprecations printed out (and fixed the one dynamic property deprecation that was shown)
  • Committed
<?php declare(strict_types=1);

return (new PhpCsFixer\Config())
    ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
    ->setRules([
        '@PSR12' => true,
        'nullable_type_declaration_for_default_null_value' => [
            'use_nullable_type_declaration' => true,
        ],
    ])
    ->setFinder(
        (new PhpCsFixer\Finder())
            ->in(__DIR__)
            ->ignoreDotFiles(true)
            ->ignoreVCS(true)
    );

mbabker avatar Feb 03 '25 21:02 mbabker

Thanks for this work! I was having the same issues since I upgraded my system to php8.4 and was trying to solve them myself. Quickly found that you did the work already.

I had a look at your changes and it would have my approval.

boelew avatar Feb 14 '25 12:02 boelew

@alexdebril please merge this and create a release.

stevleibelt avatar Apr 08 '25 14:04 stevleibelt

Any chance to merge this and cut a new version?

thedotedge avatar Apr 22 '25 14:04 thedotedge