diff --git a/packages/CodingStandard/README.md b/packages/CodingStandard/README.md index ed0dc7f0f9..5ab0159e1e 100644 --- a/packages/CodingStandard/README.md +++ b/packages/CodingStandard/README.md @@ -20,8 +20,6 @@ To use, check [EasyCodingStandard](/packages/EasyCodingStandard/README.md). Rules Overview... -## Architecture - ### [Traits are forbidden. Prefer service and constructor injection](/src/Sniffs/Architecture/ForbiddenTraitSniff.php) :x: @@ -32,23 +30,6 @@ trait SomeTrait } ``` -:+1: - -```php -class SomeClass -{ - public function __construct(SomeService $someService) - { - // ... - } -} -``` - -### [Implementation of interface should only contain its methods](/src/Sniffs/Classes/EqualInterfaceImplementationSniff.php) - - -## Class - ### [Implementation of interface should only contain its methods](/src/Sniffs/Classes/EqualInterfaceImplementationSniff.php) :x: @@ -87,12 +68,57 @@ final class SomeClass implements SomeInterface } ``` +### [Controller should have max.1 render method.](/src/Sniffs/Classes/ControllerRenderMethodLimitSniff.php) + +:x: + +```php +final class Controller +{ + public function defaultAction() + { + } + + public function listAction() + { + } +} +``` -## Controller +:+1: +```php +final class Controller +{ + public function defaultAction() + { + } +} +``` -@todo +### [Controller has to contain __invoke() method](/src/Sniffs/Classes/InvokableControllerSniff.php) +:x: + +```php +final class Controller +{ + public function defaultAction() + { + } +} +``` + +:+1: + +```php +final class Controller +{ + public function __invoke() + { + } +} +``` ### [Non-abstract class that implements interface should be final](/src/Sniffs/Classes/FinalInterfaceSniff.php) @@ -114,8 +140,6 @@ final class SomeClass implements SomeInterface - Except for Doctrine entities, they cannot be final. -## Commenting - ### [Block comment should be used instead of one liner](/src/Sniffs/Commenting/BlockPropertyCommentSniff.php) :x: @@ -187,35 +211,53 @@ class SomeClass } ``` -## Debug + +### [New class statement should not have empty parentheses.](/src/Sniffs/ControlStructures/NewClassSniff.php) + +:x: + +```php +$file = new File(); +``` + +:+1: + +```php +$file = new File; +$directory = new Directory([$file]); +``` ### [This comment is valid code. Uncomment it or remove it.](/src/Sniffs/Debug/CommentedOutCodeSniff.php) -@todo +:x: + +```php +// $file = new File; +// $directory = new Diretory([$file]); +``` ### [Debug functions should not be left in the code](/src/Sniffs/Debug/DebugFunctionCallSniff.php) -@todo +:x: -## Namespaces +```php +dump($value); +``` ### [Class name after new/instanceof should not start with slash.](/src/Sniffs/Namespaces/ClassNamesWithoutPreSlashSniff.php) :x: ```php -$file = new File(); +$file = new \File; ``` :+1: ```php $file = new File; -$directory = new Directory([$file]); ``` -## Naming - ### [Abstract class should have prefix "Abstract"](/src/Sniffs/Naming/AbstractClassNameSniff.php) :x: