$ php -v):=> 7.2.2
$ php-cs-fixer -V):=> 2.11.1
=> using vscode extension: junstyle/vscode-php-cs-fixer
<?php
return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
// There should not be an empty return statement at the end of a function.
'no_useless_return' => true,
// Pre- or post-increment and decrement operators should be used if possible.
'increment_style' => ['style' => 'post'],
// PHP arrays should be declared using the configured syntax.
'array_syntax' => ['syntax' => 'short'],
// A return statement wishing to return void should not return null.
'simplified_null_return' => true,
// Forbid multi-line whitespace before the closing semicolon or move the semicolon to the new line for chained calls.
'multiline_whitespace_before_semicolons' => true,
// Convert double quotes to single quotes for simple strings.
'single_quote' => ['strings_containing_single_quote_chars' => true],
// Ordering use statements.
'ordered_imports' => true,
// There should not be any empty comments.
'no_empty_comment' => false,
// There should not be empty PHPDoc blocks.
'binary_operator_spaces' => ['operators' => ['=>' => 'align_single_space_minimal', '=' => 'align_single_space_minimal']],
// A single space or none should be between cast and variable.
'cast_spaces' => ['space' => 'none'],
// @return void and @return null annotations should be omitted from PHPDocs.
'phpdoc_no_empty_return' => false,
// Remove extra spaces in a nullable typehint.
'compact_nullable_typehint' => true,
])
->setLineEnding("\n");
public static function Foo(string $arg1, bool $arg2)
{
return true;
}
public static function Foo(string $arg1, bool $arg2)
{
return true;
}
public static function Foo(string $arg1, bool $arg2)
{
return true;
}
spaces between string and $arg1, spaces between bool and $arg2, spaces between return and true.
Is there such rule that I'm unaware of?
:+1: for
-function Foo(string $arg1, bool $arg2)
+function Foo(string $arg1, bool $arg2)
for removing spaces spaces after return statement - why only after return? why not after throw as well? or anything else? IMO not well defined and definitely that would be different rule, let us focus on space between param type and param name first
Most helpful comment
:+1: for
for removing spaces spaces after
returnstatement - why only after return? why not afterthrowas well? or anything else? IMO not well defined and definitely that would be different rule, let us focus on space between param type and param name first