diff --git a/src/macros.yay b/src/macros.yay index 9622cda..7367f10 100644 --- a/src/macros.yay +++ b/src/macros.yay @@ -217,12 +217,27 @@ macro { ·chain( class, ·ns()·name, + ·optional ( + ·chain( + extends, + ·ns()·extendsName + ) + )·extends, + ·optional ( + ·chain( + implements, + ·lst( + ·ns()·implementsName, + ·token(",") + )·implementsItems + ) + )·implements, ·token("{"), ·layer()·body, ·token("}") ) } >> { - class ·name { + class ·name ·extends ?·{ extends ·extendsName } ·implements ?·{ implements ·implementsItems ···( , ){ ·implementsName } } { use \Pre\ClassAccessors\ClassAccessorsTrait; ·body diff --git a/tests/specs/accessors.spec b/tests/specs/accessors.spec index 2fa06d1..76e459a 100644 --- a/tests/specs/accessors.spec +++ b/tests/specs/accessors.spec @@ -74,6 +74,18 @@ class Fixture } } +class Child extends Parent { + +} + +class Child implements Parent { + +} + +class VeryChild extends Parent implements Parent, Parent, Parent { + +} + --EXPECT-- namespace Pre\ClassAccessors\Fixture; @@ -200,3 +212,18 @@ class Fixture return $clone; } } + +class Child extends Parent +{ + use \Pre\ClassAccessors\ClassAccessorsTrait; +} + +class Child implements Parent +{ + use \Pre\ClassAccessors\ClassAccessorsTrait; +} + +class VeryChild extends Parent implements Parent, Parent, Parent +{ + use \Pre\ClassAccessors\ClassAccessorsTrait; +}