Skip to content

Commit

Permalink
Test that property without visibility modifier is implicitly public
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Dec 30, 2024
1 parent a924999 commit edf93e1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/unit/Reflection/ReflectionPropertyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,24 @@ public function testVisibilityMethods(): void
self::assertFalse($onlyPublicProp->isReadOnly());
}

public function isImplicitPublic(): void
{
$php = <<<'PHP'
<?php
class Foo
{
$boo = 'boo';
}
PHP;

$classReflection = (new DefaultReflector(new StringSourceLocator($php, $this->astLocator)))->reflectClass('Foo');
$propertyReflection = $classReflection->getProperty('boo');

self::assertTrue($propertyReflection->isPublic());
self::assertSame(CoreReflectionProperty::IS_PUBLIC, $propertyReflection->getModifiers());
}

public function testIsStatic(): void
{
$classInfo = $this->reflector->reflectClass(ExampleClass::class);
Expand Down

0 comments on commit edf93e1

Please sign in to comment.