diff --git a/src/main/php/lang/ast/emit/AsymmetricVisibility.class.php b/src/main/php/lang/ast/emit/AsymmetricVisibility.class.php index 721c4c3c..f277e228 100755 --- a/src/main/php/lang/ast/emit/AsymmetricVisibility.class.php +++ b/src/main/php/lang/ast/emit/AsymmetricVisibility.class.php @@ -49,8 +49,7 @@ protected function emitProperty($result, $property) { $modifiers & MODIFIER_PROTECTED && $modifiers&= ~0x0000800; } else if ($modifiers & 0x0001000) { $checks= [$this->private($property->name, 'modify private(set)')]; - $modifiers & MODIFIER_PRIVATE && $modifiers&= ~0x0001000; - $modifiers|= MODIFIER_FINAL; + $modifiers & MODIFIER_PRIVATE ? $modifiers&= ~0x0001000 : $modifiers|= MODIFIER_FINAL; } // Emit XP meta information for the reflection API diff --git a/src/test/php/lang/ast/unittest/emit/AsymmetricVisibilityTest.class.php b/src/test/php/lang/ast/unittest/emit/AsymmetricVisibilityTest.class.php index 9de9d07c..b72b9ae5 100755 --- a/src/test/php/lang/ast/unittest/emit/AsymmetricVisibilityTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/AsymmetricVisibilityTest.class.php @@ -112,19 +112,19 @@ public function protected_set_reflection() { ); } - #[Test] - public function private_set_implicitely_final_in_reflection() { + #[Test, Values(['protected', 'public'])] + public function private_set_implicitely_final_in_reflection($modifier) { $t= $this->declare('class %T { - public private(set) string $fixture= "Test"; + '.$modifier.' private(set) string $fixture= "Test"; }'); Assert::equals( - 'public final private(set) string $fixture', + $modifier.' final private(set) string $fixture', $t->property('fixture')->toString() ); } - #[Test, Values(['protected', 'public'])] + #[Test, Values(['private', 'protected', 'public'])] public function same_modifier_for_get_and_set($modifier) { $t= $this->declare('class %T { '.$modifier.' '.$modifier.'(set) string $fixture= "Test"; @@ -136,18 +136,6 @@ public function same_modifier_for_get_and_set($modifier) { ); } - #[Test] - public function private_modifier_for_get_and_set() { - $t= $this->declare('class %T { - private private(set) string $fixture= "Test"; - }'); - - Assert::equals( - 'private final string $fixture', - $t->property('fixture')->toString() - ); - } - #[Test] public function interaction_with_hooks() { $t= $this->declare('class %T {