Skip to content

Commit e664bed

Browse files
committed
Regression test
Closes phpstan/phpstan#12544
1 parent 39bfb8c commit e664bed

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -3500,4 +3500,18 @@ public function testBug4801(): void
35003500
$this->analyse([__DIR__ . '/data/bug-4801.php'], []);
35013501
}
35023502

3503+
public function testBug12544(): void
3504+
{
3505+
$this->checkThisOnly = false;
3506+
$this->checkNullables = true;
3507+
$this->checkUnionTypes = true;
3508+
$this->checkExplicitMixed = true;
3509+
$this->analyse([__DIR__ . '/data/bug-12544.php'], [
3510+
[
3511+
'Call to private method somethingElse() of class Bug12544\Bar.',
3512+
20,
3513+
],
3514+
]);
3515+
}
3516+
35033517
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Bug12544;
4+
5+
trait Foo {
6+
public function hello(): string
7+
{
8+
return "Hello from Foo!";
9+
}
10+
}
11+
12+
class Bar {
13+
use Foo {
14+
hello as private somethingElse;
15+
}
16+
}
17+
18+
function (Bar $bar): void {
19+
$bar->hello();
20+
$bar->somethingElse();
21+
};

0 commit comments

Comments
 (0)