Skip to content

Commit 63114fe

Browse files
committed
Fix Param::isPublic() for param with asymmetric visibility
Fixes #1096.
1 parent 221b0d0 commit 63114fe

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/PhpParser/Node/Param.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function isPublic(): bool {
7777
return true;
7878
}
7979

80-
if ($this->hooks === []) {
80+
if (!$this->isPromoted()) {
8181
return false;
8282
}
8383

test/PhpParser/Node/ParamTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ public function testSetVisibility() {
4242
$node = new Param(new Variable('foo'));
4343
$node->flags = Modifiers::PRIVATE_SET;
4444
$this->assertTrue($node->isPrivateSet());
45+
$this->assertTrue($node->isPublic());
4546
$node->flags = Modifiers::PROTECTED_SET;
4647
$this->assertTrue($node->isProtectedSet());
48+
$this->assertTrue($node->isPublic());
4749
$node->flags = Modifiers::PUBLIC_SET;
4850
$this->assertTrue($node->isPublicSet());
51+
$this->assertTrue($node->isPublic());
4952
}
5053

5154
public function testPromotedPropertyWithoutVisibilityModifier(): void {

0 commit comments

Comments
 (0)