Skip to content

Commit

Permalink
Docblock psudo methods can be inherited via @mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
robchett committed Nov 8, 2023
1 parent b775d29 commit 21845aa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,12 @@ private static function findPseudoMethodAndClassStorages(
}

$ancestors = $static_class_storage->class_implements;
foreach ($static_class_storage->namedMixins as $namedObject) {
$type = $namedObject->value;
if ($type) {
$ancestors[$type] = true;
}
}

foreach ($ancestors as $fq_class_name => $_) {
$class_storage = $codebase->classlikes->getStorageFor($fq_class_name);
Expand Down
22 changes: 22 additions & 0 deletions tests/MixinAnnotationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,28 @@ class FooModel extends Model {}
'$g' => 'list<FooModel>',
],
],
'mixinInheritMagicMethods' => [
'code' => '<?php
/**
* @method $this active()
*/
class A {
public function __call(string $name, array $arguments) {}
}
/**
* @mixin A
*/
class B {
public function __call(string $name, array $arguments) {}
}
$b = new B;
$c = $b->active();',
'assertions' => [
'$c' => 'B&static',
],
],
];
}

Expand Down

0 comments on commit 21845aa

Please sign in to comment.