-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
92 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# RuleTypes | ||
|
||
RuleType are the type of assertion that can be done on the selected classes. | ||
|
||
There are four groups of RuleTypes: Dependency, Inheritance, Composition and Mixin. | ||
|
||
## Dependency | ||
|
||
### `mustDependOn()` | ||
It asserts that the selected classes **depend** on the other selected classes. | ||
|
||
### `mustNotDependOn()` | ||
It asserts that the selected classes **does not depend** on the other selected classes. | ||
|
||
### `mustOnlyDependOn()` | ||
It asserts that the selected classes **depend only** on the other selected classes **and no others**. | ||
|
||
### `canOnlyDependOn()` | ||
It asserts that the selected classes **does not have other depencies** more the selected classes. | ||
|
||
## Composition | ||
|
||
### `mustImplement()` | ||
It asserts that the selected classes **implement** the selected interfaces. | ||
|
||
### `mustNotImplement()` | ||
It asserts that the selected classes **does not implement** the selected interfaces. | ||
|
||
### `mustOnlyImplement()` | ||
It asserts that the selected classes **implement only** the selected interfaces **and no others**. | ||
|
||
### `canOnlyImplement()` | ||
It asserts that the selected classes **does not implement other interfaces** more than the selected ones. | ||
|
||
## Inheritance | ||
|
||
### `mustExtend()` | ||
It asserts that the selected classes **extend** the selected class. | ||
|
||
### `mustNotExtend()` | ||
It asserts that the selected classes **does not extend** the selected classes. | ||
|
||
### `canOnlyExtend()` | ||
It asserts that the selected classes **does not extend other classes** more than the selected ones. | ||
|
||
## Mixin | ||
|
||
### `mustInclude()` | ||
It asserts that the selected classes **include** the selected traits. | ||
|
||
### `mustNotInclude()` | ||
It asserts that the selected classes **does not include** the selected traits. | ||
|
||
### `mustOnlyInclude()` | ||
It asserts that the selected classes **include only** the selected traits **and no others**. | ||
|
||
### `canOnlyInclude()` | ||
It asserts that the selected classes **does not include other traits** more than the selected ones. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Selectors | ||
|
||
Selectors are the way to tell PHPAT which classes are going to intervene in a rule. | ||
|
||
You can always use any amount of `*` in the middle of any selector parameter to select everything that match that expression. | ||
|
||
### `ClassNameSelector` | ||
With `Selector::haveClassName()` you can select classes using their Fully Qualified Class Name. | ||
|
||
### `PathSelector` | ||
With `Selector::havePath()` you can select classes in those PHP files. | ||
|
||
### `ImplementSelector` | ||
With `Selector::implementInterface()` you can select classes that implement a certain interface. | ||
|
||
### `ExtendSelector` | ||
With `Selector::extendClass()` you can select classes that extend a certain class. | ||
|
||
### `IncludeSelector` | ||
With `Selector::includeTrait()` you can select classes that include a certain trait. |