Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
[CodingStandard] complete few sniff to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed May 5, 2017
1 parent 3d843b3 commit b3af954
Showing 1 changed file with 73 additions and 28 deletions.
101 changes: 73 additions & 28 deletions packages/CodingStandard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -32,23 +30,9 @@ 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:
Expand Down Expand Up @@ -87,12 +71,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()
{
}
}
```

:+1:

```php
final class Controller
{
public function defaultAction()
{
}
}
```

### [Controller has to contain __invoke() method](/src/Sniffs/Classes/InvokableControllerSniff.php)

## Controller
:x:

```php
final class Controller
{
public function defaultAction()
{
}
}
```

@todo
:+1:

```php
final class Controller
{
public function __invoke()
{
}
}
```

### [Non-abstract class that implements interface should be final](/src/Sniffs/Classes/FinalInterfaceSniff.php)

Expand All @@ -114,8 +143,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:
Expand Down Expand Up @@ -187,35 +214,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:
Expand Down

0 comments on commit b3af954

Please sign in to comment.