Skip to content

Commit

Permalink
Fix handling renamed trait method
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jan 4, 2022
1 parent 13047ff commit 8498b01
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2285,4 +2285,12 @@ public function testBug6239(): void
$this->analyse([__DIR__ . '/../../Analyser/data/bug-6293.php'], []);
}

public function testBug6306(): void
{
$this->checkThisOnly = false;
$this->checkNullables = true;
$this->checkUnionTypes = true;
$this->analyse([__DIR__ . '/data/bug-6306.php'], []);
}

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

namespace Bug6306;

trait someTrait {
public function someNumber():int {
return 10;
}
}

class ParentClass {
use someTrait {
someNumber as myNumber;
}
}

class SubClass extends ParentClass {
public function number():int {
return $this->myNumber();
}
}

0 comments on commit 8498b01

Please sign in to comment.