Skip to content

Commit 8498b01

Browse files
committed
Fix handling renamed trait method
1 parent 13047ff commit 8498b01

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,4 +2285,12 @@ public function testBug6239(): void
22852285
$this->analyse([__DIR__ . '/../../Analyser/data/bug-6293.php'], []);
22862286
}
22872287

2288+
public function testBug6306(): void
2289+
{
2290+
$this->checkThisOnly = false;
2291+
$this->checkNullables = true;
2292+
$this->checkUnionTypes = true;
2293+
$this->analyse([__DIR__ . '/data/bug-6306.php'], []);
2294+
}
2295+
22882296
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Bug6306;
4+
5+
trait someTrait {
6+
public function someNumber():int {
7+
return 10;
8+
}
9+
}
10+
11+
class ParentClass {
12+
use someTrait {
13+
someNumber as myNumber;
14+
}
15+
}
16+
17+
class SubClass extends ParentClass {
18+
public function number():int {
19+
return $this->myNumber();
20+
}
21+
}

0 commit comments

Comments
 (0)