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

Add dynamicFunctionThrowTypeExtension for Reflection #552

Merged
merged 1 commit into from
Jun 8, 2021

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Jun 7, 2021

This is the last throwTypeExtension I listed in #520 @ondrejmirtes

@VincentLanglet VincentLanglet marked this pull request as ready for review June 7, 2021 21:32
@VincentLanglet VincentLanglet force-pushed the reflection branch 3 times, most recently from 314eaea to e722322 Compare June 7, 2021 22:07
class ReflectionClassConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension
{

private Broker $broker;
Copy link
Member

Choose a reason for hiding this comment

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

Broker is a deprecated class, please use ReflectionProvider instead.


$valueType = $scope->getType($methodCall->args[0]->value);
foreach (TypeUtils::getConstantStrings($valueType) as $constantString) {
if (!extension_loaded($constantString->getValue())) {
Copy link
Member

Choose a reason for hiding this comment

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

extension_loaded isn't a useful concept because PHPStan does not require extensions to be loaded during analysis. It's best to skip this extension altogether.

@VincentLanglet VincentLanglet force-pushed the reflection branch 3 times, most recently from 68089c1 to 601d4bd Compare June 8, 2021 08:43
@VincentLanglet
Copy link
Contributor Author

Done, and I rebased master.

I don't think the failure are related to this PR.

@ondrejmirtes ondrejmirtes merged commit 443f980 into phpstan:master Jun 8, 2021
@ondrejmirtes
Copy link
Member

Thank you!

@VincentLanglet VincentLanglet deleted the reflection branch June 8, 2021 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants