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

fix: pass static class name to ReturnTypeAnalyzer #7366

Merged
merged 1 commit into from Jan 10, 2022
Merged

fix: pass static class name to ReturnTypeAnalyzer #7366

merged 1 commit into from Jan 10, 2022

Conversation

Patrick-Remy
Copy link
Contributor

As already stated out in PR #7359 and found there:

In these lines the $fq_classlike_name is overriden if the return type is declared in a parent class:

$return_type = $codebase->methods->getMethodReturnType(
$analyzed_method_id,
$fq_classlike_name,
$method_analyzer
);

And then downpassed via ReturnTypeAnalyzer::verifyReturnType to as both $self_class- and $static_class_type-param.

$declared_return_type = TypeExpander::expandUnion(
$codebase,
$return_type,
$self_fq_class_name,
$self_fq_class_name,

The bug is currently not really visible, as e.g. for @return class-string<static> correctly only static::class is allowed and therefor not expected.

@orklah orklah added the release:fix The PR will be included in 'Fixes' section of the release notes label Jan 10, 2022
@Patrick-Remy
Copy link
Contributor Author

Patrick-Remy commented Jan 10, 2022

I fixed (after second try ;-)) that I unintentionally commented-out here the invalid examples
https://github.com/vimeo/psalm/pull/7366/files#diff-ec7956a405a9a30d502695776e76d48768f3bb19238e94eee0897b16856dc3acR12

@orklah
Copy link
Collaborator

orklah commented Jan 10, 2022

Thanks! That's great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants