Skip to content

Conversation

@calebdw
Copy link
Contributor

@calebdw calebdw commented Dec 6, 2025

Hello!

This rule is removing the parent::__construct() calls when it shouldn't. After some digging I found that the following returns true when the class reflection can't be found, instead of assuming that it has no parents we should just skip:

 return $this->classMethodManipulator->hasParentMethodOrInterfaceMethod($class, $calledMethodName);

Thanks!

@samsonasik
Copy link
Member

Could you add fixture file for it? Thank you.

@calebdw
Copy link
Contributor Author

calebdw commented Dec 6, 2025

I tried, but I couldn't replicate in the fixture. It has to do with the reflection provider not being able to find the class

@samsonasik
Copy link
Member

That's strange as class is a node the rule visited, that the ClassReflection exists. I assume you have duplicated class name so phpstan can't locate which one which.

@calebdw
Copy link
Contributor Author

calebdw commented Dec 6, 2025

I think it's because I run rector on our tests, but I exclude the tests from phpstan because I don't care about all the warnings. This is the first time I've had any issues

@samsonasik
Copy link
Member

in that case, I guess you can add autoloadPaths it via withAutoloadPaths

https://getrector.com/documentation/static-reflection-and-autoload

@calebdw
Copy link
Contributor Author

calebdw commented Dec 6, 2025

Hmm, doesn't look like that worked

@samsonasik
Copy link
Member

@calebdw
Copy link
Contributor Author

calebdw commented Dec 8, 2025

Hmm, looks like I needed to split excludePaths into a combination of analyse and analyseAndScan:

https://phpstan.org/config-reference#analysed-files

@calebdw calebdw closed this Dec 8, 2025
@calebdw calebdw deleted the calebdw/push-swmpxlxzuplk branch December 8, 2025 13:48
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.

2 participants