mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #909 - support private trait aliasing
This commit is contained in:
parent
7e0928d775
commit
6d462fcb64
@ -425,6 +425,10 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
case 2:
|
||||
$visibility_map[$new_name] = ClassLikeAnalyzer::VISIBILITY_PROTECTED;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$visibility_map[$new_name] = ClassLikeAnalyzer::VISIBILITY_PRIVATE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -889,6 +889,31 @@ class TraitTest extends TestCase
|
||||
}',
|
||||
'error_message' => 'TooFewArguments',
|
||||
],
|
||||
'traitMethodMadePrivate' => [
|
||||
'<?php
|
||||
trait T {
|
||||
public function foo() : void {
|
||||
echo "here";
|
||||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
use T {
|
||||
foo as private traitFoo;
|
||||
}
|
||||
|
||||
public function bar() : void {
|
||||
$this->traitFoo();
|
||||
}
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
public function bar() : void {
|
||||
$this->traitFoo(); // should fail
|
||||
}
|
||||
}',
|
||||
'error_message' => 'InaccessibleMethod'
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user