Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it required to keep space after type cast by Symfony coding standards?

I just couldn't find an answer in the official documentation. So PHP Code Sniffer says it's required (coding standards package escapestudios/symfony2-coding-standard).

Example as it should be:

$result = (bool) foo();

and vise versa:

$result = (bool)foo();
like image 704
Kirby Avatar asked Aug 15 '16 10:08

Kirby


1 Answers

Yes, it is:

enter image description here

How to Apply It?

  • In CodeSniffer, you're looking for PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterCastSniff

  • In PHP-CS-Fixer, it would be PhpCsFixer\Fixer\CastNotation\CastSpacesFixer

enter image description here

Tool used in here is EasyCodingStandard - you can read intro post about it.

like image 92
Tomas Votruba Avatar answered Oct 02 '22 02:10

Tomas Votruba