Skip to content

Bump PHPStan to ^2.3.0 and fix compatible code - #8528

Merged
TomasVotruba merged 4 commits into
mainfrom
bump-phpstan-23
Oct 6, 2026
Merged

TomasVotruba merged 4 commits into
mainfrom
bump-phpstan-23

Conversation

@samsonasik

@samsonasik samsonasik commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

On composer update to phpstan 2.3.0 that released today: https://github.com/phpstan/phpstan/releases/tag/2.3.0

Now phpunit got error:

There were 2 failures:

1) Rector\Tests\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector\RemoveUselessReturnTagRectorTest::test@/Users/samsonasik/www/rector-src/rules-tests/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector/Fixture/skip_return_static_on_return_self_trait.php.inc with data ('/Users/samsonasik/www/rector-...hp.inc')
Failed on fixture file "skip_return_static_on_return_self_trait.php.inc"
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
 {
     private static self $property;
 
-    /**
-     * @return static
-     */
     public static function resolve(): self
     {
         return self::$property ??= new static();

/Users/samsonasik/www/rector-src/src/Testing/PHPUnit/AbstractRectorTestCase.php:255
/Users/samsonasik/www/rector-src/src/Testing/PHPUnit/AbstractRectorTestCase.php:187
/Users/samsonasik/www/rector-src/rules-tests/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector/RemoveUselessReturnTagRectorTest.php:16

2) Rector\Tests\Renaming\Rector\MethodCall\RenameMethodRector\RenameMethodRectorTest::test@/Users/samsonasik/www/rector-src/rules-tests/Renaming/Rector/MethodCall/RenameMethodRector/Fixture/rename_trait_method_call.php.inc with data ('/Users/samsonasik/www/rector-...hp.inc')
Failed on fixture file "rename_trait_method_call.php.inc"
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
 
 trait RenameTraitMethodCall
 {
-       public function method3()
+       public function method1()
     {
     }

/Users/samsonasik/www/rector-src/src/Testing/PHPUnit/AbstractRectorTestCase.php:255
/Users/samsonasik/www/rector-src/src/Testing/PHPUnit/AbstractRectorTestCase.php:187
/Users/samsonasik/www/rector-src/rules-tests/Renaming/Rector/MethodCall/RenameMethodRector/RenameMethodRectorTest.php:16

FAILURES!
Tests: 5322, Assertions: 6402, Failures: 2, Skipped: 1.

and PHPStan got notice:

➜  rector-src git:(bump-phpstan-23) composer phpstan                                                 
Note: Using configuration file /Users/samsonasik/www/rector-src/phpstan.neon.
 2647/2647 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

The "type_coverage.declare" parameter is deprecated and has no effect. Remove it from your config and use SafeDeclareStrictTypesRector from Rector instead.
 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  rules/DeadCode/Rector/ClassMethod/RemoveUselessAssignFromPropertyPromotionRector.php:125
 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  - '#Strict comparison using \=\=\= between non\-empty\-list and array\{\} will always evaluate to false#'
  🪪 identical.alwaysFalse
 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


                                                                                                                        
 [ERROR] Found 1 errors                                                                                                 
                                                                                                                        

Script vendor/bin/phpstan analyse --ansi --memory-limit=512M handling the phpstan event returned with error code 1

This PR bump to PHPStan 2.3.0 and try to fix it.

@samsonasik samsonasik mentioned this pull request Oct 6, 2026
@samsonasik

samsonasik commented Oct 6, 2026 •

Copy link
Copy Markdown
Member Author

@TomasVotruba fixed 👍 rector-laravel notice needs this PR merged and has immediate release first 👍

Could you remove the Required flag on rector-laravel CI so I can merge?

@TomasVotruba
TomasVotruba merged commit 33926fa into main Oct 6, 2026
49 of 50 checks passed
@TomasVotruba
TomasVotruba deleted the bump-phpstan-23 branch October 6, 2026 08:31
@TomasVotruba

Copy link
Copy Markdown
Member

Thank you, lets ship it 👍

@samsonasik

Copy link
Copy Markdown
Member Author

@TomasVotruba I think we need new immediate release, will you create release or I need to create release?

@TomasVotruba

Copy link
Copy Markdown
Member

I'll look into it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants