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

check T of mixed&Foo and T of mixed|Foo #2940

Conversation

schlndh
Copy link
Contributor

@schlndh schlndh commented Feb 24, 2024

Fixes https://phpstan.org/r/a3548a66-d83b-46d4-b418-7dbc038cbeb1 (all var_dumps should be reported).
Fixes https://phpstan.org/r/7ec28c62-5411-412a-a4c8-c7f9253b918d (there should be actual type instead of stdClass).

Verified

This commit was signed with the committer’s verified signature.
toitzi Tobias Oitzinger
$type = $type->getStaticObjectType();
if (!$this->newRuleLevelHelper) {
if ($isTopLevel && $type instanceof StaticType) {
$type = $type->getStaticObjectType();
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 line hid the following issue (CallMethodsRuleTest):

Parameter #1 $other of method Test\CollectionWithStaticParam::add() expects static(Test\AppleCollection), Test\AppleCollection given.

@ondrejmirtes
Copy link
Member

  1. Looks like this fixed Closure($this) does not accept Closure($this) phpstan#9009, please add a regression test :)
  2. There's a levels test failure https://github.com/phpstan/phpstan-src/actions/runs/8030898804/job/21938683114, you can just re-run that locally and commit the updated JSON file :)

Thank you very much!

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@schlndh
Copy link
Contributor Author

schlndh commented Feb 24, 2024

I thought that I caused a false positive here: https://github.com/drupal/drupal/blob/5c30729a8365dc7e7d649d597a11f170eecff26c/core/modules/migrate/tests/src/Kernel/MigrateTestBase.php#L173
https://github.com/phpstan/phpstan-src/actions/runs/8031005259/job/21938938357?pr=2940

  ------ ------------------------------------------------------------------ 
  Line   core/modules/migrate/tests/src/Kernel/MigrateTestBase.php         
 ------ ------------------------------------------------------------------ 
  173    Call to an undefined static method                                
         Drupal\Tests\migrate\Kernel\MigrateTestBase::migrateDumpAlter().  
 ------ ------------------------------------------------------------------ 

But it looks like the issue is already present in phpstan, I just changed the error message: https://phpstan.org/r/1475efe6-5aaf-4922-bab9-c4ebacc8d24c

@ondrejmirtes ondrejmirtes merged commit ea95907 into phpstan:1.10.x Feb 24, 2024
439 of 440 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@schlndh schlndh deleted the fix-checkTemplateMixedInsideUnionAndIntersection branch February 24, 2024 14:58
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.

None yet

2 participants