Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Aug 29, 2025

@@ -81,13 +81,11 @@ private function findClassReflectionWithProperty(
}

$parentClass = $classReflection->getParentClass();
while ($parentClass !== null) {
if ($parentClass !== null) {
$methodWithDeclaringClass = $this->findClassReflectionWithProperty($parentClass, $parentClass, $propertyName);
Copy link
Contributor Author

@staabm staabm Aug 29, 2025

Choose a reason for hiding this comment

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

this recursive call will already work its way to the top parent class. we don't need another loop thru all parents.

see how the number of calls increased on each parent class before this PR:

grafik

@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes
Copy link
Member

The reproduction repo https://github.com/verfriemelt-dot-org/coverage-fail looks useful. Please copy the directory structure to e2e/ and try to run the analysis in E2E tests.

@staabm
Copy link
Contributor Author

staabm commented Aug 29, 2025

added the e2e test with a timeout. I don't think it makes much sense to put expectations on the output of found errors.

@@ -392,6 +392,9 @@ jobs:
cd e2e/composer-version-config
composer install
../../bin/phpstan analyze test.php --level=0
- script: |
cd e2e/bug13425
timeout 15 ../bashunit -a exit_code "1" "../../bin/phpstan analyze src/ plugins/"
Copy link
Member

Choose a reason for hiding this comment

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

I couldn't find where is this timeout command coming from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its a linux command line tool, usually contained in stock installations.

brew install coreutils installs it on macos

@ondrejmirtes ondrejmirtes merged commit c8598f4 into phpstan:2.1.x Aug 30, 2025
445 of 451 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

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.

sharp performance dropoff with long inheritance chains
3 participants