Skip to content

Commit b83a1eb

Browse files
committed
Regression test
Closes phpstan/phpstan#10159
1 parent c889baa commit b83a1eb

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -3354,4 +3354,13 @@ public function testTraitMixin(): void
33543354
$this->analyse([__DIR__ . '/data/trait-mixin.php'], []);
33553355
}
33563356

3357+
public function testBug10159(): void
3358+
{
3359+
$this->checkThisOnly = false;
3360+
$this->checkNullables = true;
3361+
$this->checkUnionTypes = true;
3362+
$this->checkExplicitMixed = true;
3363+
$this->analyse([__DIR__ . '/data/bug-10159.php'], []);
3364+
}
3365+
33573366
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace Bug10159;
4+
5+
class Mixin {
6+
public function someMethod(): object
7+
{
8+
return (object) [];
9+
}
10+
}
11+
12+
/**
13+
* @mixin Mixin
14+
*/
15+
class ParentClass
16+
{}
17+
18+
/**
19+
* @method ChildClass someMethod()
20+
*/
21+
class ChildClass extends ParentClass
22+
{
23+
public function methodFromChild(): void
24+
{}
25+
}
26+
27+
function (): void {
28+
$childClass = new ChildClass();
29+
$childClass->someMethod()->methodFromChild();
30+
};

0 commit comments

Comments
 (0)