Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify types on get_parent_class() #1383

Merged
merged 9 commits into from Oct 5, 2022
Merged

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Jun 1, 2022

src/Analyser/TypeSpecifier.php Outdated Show resolved Hide resolved
@staabm staabm mentioned this pull request Sep 23, 2022
@staabm staabm changed the base branch from 1.7.x to 1.8.x September 23, 2022 12:37
Comment on lines 337 to 338
// the is_string() check should not be necessary, since ConstantStringType->getValue() returns 'string'
&& is_string($constantType->getValue())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this works arround the type error:

grafik

which is a separate bug, see #1396

Copy link
Contributor Author

@staabm staabm Sep 27, 2022

Choose a reason for hiding this comment

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

in fb01d17 I factored out the existing logic into 2 new private methods.

that way we don't run into the #1396 bug and don't need the is_string based workaround

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fyi @rvanvelzen, the refactoring might conflict with your existing #1761 PR.

@staabm staabm marked this pull request as ready for review September 26, 2022 15:47
}
}

if (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this if block is the only new logic of this PR.

everything else is pre-existing logic which was just factored out into new private methods

@staabm staabm force-pushed the bug5552 branch 2 times, most recently from fb01d17 to eae128c Compare October 1, 2022 16:14
@staabm
Copy link
Contributor Author

staabm commented Oct 4, 2022

@ondrejmirtes if we could land this one it would unblock some of the already opened PRs for more TypeSpecifier goodness.

@ondrejmirtes ondrejmirtes changed the title specify types on get_parent_class() Specify types on get_parent_class() Oct 5, 2022
@ondrejmirtes ondrejmirtes merged commit 0b8b337 into phpstan:1.8.x Oct 5, 2022
@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
3 participants