06.10.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Contribution Guide 56<br />

Coding Style<br />

Laravel follows the PSR-2³⁶ coding standard and the PSR-4³⁷ autoloading standard.<br />

PHPDoc<br />

Below is an example of a valid Laravel documentation block. Note that the @param attribute is<br />

followed by two spaces, the argument type, two more spaces, and finally the variable name:<br />

1 /**<br />

2 * Register a binding with the container.<br />

3 *<br />

4 * @param string|array $abstract<br />

5 * @param \Closure|string|null $concrete<br />

6 * @param bool $shared<br />

7 * @return void<br />

8 */<br />

9 public function bind($abstract, $concrete = null, $shared = false)<br />

10 {<br />

11 //<br />

12 }<br />

StyleCI<br />

If your code style isn’t perfect, don’t worry! StyleCI³⁸ will automatically merge any style fixes into<br />

the Laravel repository after any pull requests are merged. This allows us to focus on the content of<br />

the contribution and not the code style.<br />

³⁶https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md<br />

³⁷https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md<br />

³⁸https://styleci.io/

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!