Skip to content

Commit

Permalink
Merge pull request #5 from preprocess/develop
Browse files Browse the repository at this point in the history
Allow extends and implements
  • Loading branch information
assertchris authored May 20, 2017
2 parents 3e22dbd + bc9264f commit 1822d09
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/macros.yay
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions tests/specs/accessors.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

0 comments on commit 1822d09

Please sign in to comment.