Skip to content

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

Merged
ondrejmirtes merged 3 commits intophpstan:1.10.xfrom
schlndh:fix-checkTemplateMixedInsideUnionAndIntersection
Feb 24, 2024
Merged

check T of mixed&Foo and T of mixed|Foo#2940
ondrejmirtes merged 3 commits intophpstan:1.10.xfrom
schlndh:fix-checkTemplateMixedInsideUnionAndIntersection

Conversation

@schlndh
Copy link
Copy Markdown
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).

$type = $type->getStaticObjectType();
if (!$this->newRuleLevelHelper) {
if ($isTopLevel && $type instanceof StaticType) {
$type = $type->getStaticObjectType();
Copy link
Copy Markdown
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
Copy Markdown
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!

@schlndh
Copy link
Copy Markdown
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
@ondrejmirtes
Copy link
Copy Markdown
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.

2 participants