1
0
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:
Matthew Brown 2019-01-13 10:19:27 -05:00
parent 7e0928d775
commit 6d462fcb64
2 changed files with 29 additions and 0 deletions

View File

@ -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;
}
}
}

View File

@ -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'
],
];
}
}