File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -309,7 +309,8 @@ public function isFinal(): bool
309309
310310 public function isAbstract (): bool
311311 {
312- return (bool ) ($ this ->modifiers & ReflectionPropertyAdapter::IS_ABSTRACT_COMPATIBILITY );
312+ return (bool ) ($ this ->modifiers & ReflectionPropertyAdapter::IS_ABSTRACT_COMPATIBILITY )
313+ || $ this ->declaringClass ->isInterface ();
313314 }
314315
315316 public function isPromoted (): bool
Original file line number Diff line number Diff line change @@ -164,3 +164,8 @@ class FinalPropertyHooks
164164 final set => strtolower ($ value );
165165 }
166166}
167+
168+ interface InterfaceWithProperty
169+ {
170+ public int $ abstractPropertyFromInterface { get; set; }
171+ }
Original file line number Diff line number Diff line change @@ -1021,6 +1021,15 @@ public function testIsAbstract(): void
10211021 self ::assertTrue ($ hookProperty ->isAbstract ());
10221022 }
10231023
1024+ public function testIsAbstractInInterface (): void
1025+ {
1026+ $ reflector = new DefaultReflector (new SingleFileSourceLocator (__DIR__ . '/../Fixture/PropertyHooks.php ' , $ this ->astLocator ));
1027+ $ classInfo = $ reflector ->reflectClass ('Roave\BetterReflectionTest\Fixture\InterfaceWithProperty ' );
1028+
1029+ $ abstractProperty = $ classInfo ->getProperty ('abstractPropertyFromInterface ' );
1030+ self ::assertTrue ($ abstractProperty ->isAbstract ());
1031+ }
1032+
10241033 public function testNoHooks (): void
10251034 {
10261035 $ classInfo = $ this ->reflector ->reflectClass (ExampleClass::class);
You can’t perform that action at this time.
0 commit comments