Skip to content

Latest commit

 

History

History
45 lines (23 loc) · 1.56 KB

README.md

File metadata and controls

45 lines (23 loc) · 1.56 KB

coding-guide

Coding standard

Use the latest coding standard, at the moment of writing this is PSR-12. Congirure your IDE to check this standard while developing. You can use PHP_CodeSniffer.

Tests

Make sure your application can be tested automatically.

Strict typing

Use declare(strict_types = 1); at the top of every PHP file. Strict typing

Return types

Use return types for methods

public function foo(): string

Strong typed parameters

Use strong typed parameters in methods

public function bar(string $foo, int $baz)

Type declarations

Smells

Using CRUD controllers

Try to use only CRUD methods in controllers. When using only CRUD methods the controller can't be bloated by to many methods. Bloaters

Small methods

Try to build as small as possible methods. Long method

Small classes

Try to build as small as possible classes. Big classes can 'wear to many hats'. Large class

Short parameter list

Try to use as little as possible parameters in methods. Long parameter list