# Coding Standard
The coding standard exists as good practice for keeping the source cohesive as possible. That way, Chevere removes lots of "ifs" by sticking to its own set of rules.
In Chevere, we keep it simple:
PascalCasefor classes and interfaces
camelCasefor everything else
# Code Style
.php_cs.distfile allows you to configure your own
# Implementing our Code Style
git remote add code-style firstname.lastname@example.org:chevere/code-style.git
- Fetch the
git fetch code-style
code-styleinto your working branch (for example,
git merge code-style/master --allow-unrelated-histories
# Use Imports
use keyword at the top of the document must be used to import all the dependencies. Fully-qualified imports should be avoided in favor of imports and aliases.
use Chevere\Components\Message\Message; new Message('Prefer to import');
new Chevere\Components\Message\Message('...Instead of fully-qualified');
# Strict Types
To declare strict types is a must.
# Type Hinting
- All parameters, properties and return expressions should be type hinted
- Objects should be typed against its interface
DocBlock content should be short as possible, relevant and omit the obvious.
- Use markdown
@throwsmust be provided for all known exceptions
@returnshould be avoided
Comments in logic are very discouraged and it should be used only in the following cases:
- Type hinting (for example, in loops)