Skip to content

jva91/coding-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

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

About

coding guide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published