Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 9, 2025
1 parent 39bfb8c commit e664bed
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3500,4 +3500,18 @@ public function testBug4801(): void
$this->analyse([__DIR__ . '/data/bug-4801.php'], []);
}

public function testBug12544(): void
{
$this->checkThisOnly = false;
$this->checkNullables = true;
$this->checkUnionTypes = true;
$this->checkExplicitMixed = true;
$this->analyse([__DIR__ . '/data/bug-12544.php'], [
[
'Call to private method somethingElse() of class Bug12544\Bar.',
20,
],
]);
}

}
21 changes: 21 additions & 0 deletions tests/PHPStan/Rules/Methods/data/bug-12544.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Bug12544;

trait Foo {
public function hello(): string
{
return "Hello from Foo!";
}
}

class Bar {
use Foo {
hello as private somethingElse;
}
}

function (Bar $bar): void {
$bar->hello();
$bar->somethingElse();
};

0 comments on commit e664bed

Please sign in to comment.