Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Oct 6, 2025

fix reproducer for #59


for some reason I don't understand the test-suite only errors for this case on first-class callables, while in real world projects we see the same error on non-first-class-callables.

I verfied that this fix also fixes my real world project bug which is is reported on a non-first-class callable (as the test-case showcased before this PR)

@staabm staabm changed the title Fix reproducer Fix "types as the only types passed to this method" false positive on generic objects Oct 6, 2025
@staabm staabm changed the title Fix "types as the only types passed to this method" false positive on generic objects Fix "types as the only types passed to this method" false positive on generic parameter types Oct 6, 2025
@staabm staabm marked this pull request as ready for review October 6, 2025 08:16
@staabm
Copy link
Contributor Author

staabm commented Oct 6, 2025

@TomasVotruba do you think this one is ready to merge and release? :)

@TomasVotruba
Copy link
Member

Thanks for the ping. It's been a long time since understood this logic 😅

I'll trust your fix, let's give it a go 👍 Thanks

@TomasVotruba TomasVotruba merged commit d97a47c into rectorphp:main Oct 6, 2025
6 checks passed
@staabm staabm deleted the repro branch October 6, 2025 15:53
@staabm
Copy link
Contributor Author

staabm commented Oct 6, 2025

thank you. would be great to get this into a release

@TomasVotruba
Copy link
Member

@samsonasik
Copy link
Member

@staabm this seems cause issue on rector-phpunit repo

➜  rector-phpunit git:(main) composer phpstan
Note: Using configuration file /Users/samsonasik/www/rector-phpunit/phpstan.neon.
 304/304 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  rules/PHPUnit100/Rector/StmtsAwareInterface/ExpectsMethodCallDecorator.php:34
 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  - '#Parameters should have "PhpParser\\Node\\Stmt\\Expression" types as the only types passed to this method#'
  🪪 typePerfect.narrowPublicClassMethodParamType
 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I am going to ignore for now.

@samsonasik
Copy link
Member

@staabm
Copy link
Contributor Author

staabm commented Oct 9, 2025

Will have a look tomorrow

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants