diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..a0479a7 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,36 @@ + + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +return (new PhpCsFixer\Config()) + ->setRiskyAllowed(true) + ->setRules(array( + '@Symfony' => true, + '@Symfony:risky' => true, + 'combine_consecutive_unsets' => true, + 'array_syntax' => array('syntax' => 'short'), + 'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']], + 'header_comment' => array('header' => $header), + 'no_useless_else' => true, + 'no_useless_return' => true, + 'ordered_class_elements' => true, + 'ordered_imports' => true, + 'php_unit_strict' => true, + 'phpdoc_add_missing_param_annotation' => true, + 'psr_autoloading' => true, + 'strict_comparison' => true, + 'strict_param' => true, + 'fopen_flags' => array('b_mode' => true), + )) + ->setFinder( + (new PhpCsFixer\Finder()) + ->in([__DIR__ . '/src/']) + ->name('*.php') + ); diff --git a/src/PhpStormReport.php b/src/PhpStormReport.php index 9bf9533..de6f6bb 100644 --- a/src/PhpStormReport.php +++ b/src/PhpStormReport.php @@ -17,27 +17,27 @@ use PHP_CodeSniffer\Reports\Full; /** - * PhpStorm Report + * PhpStorm Report. * * @author wicliff */ class PhpStormReport extends Full { /** - * {@inheritdoc + * {@inheritdoc. */ public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80): bool { - if ($report['errors'] === 0 && $report['warnings'] === 0) { + if (0 === $report['errors'] && 0 === $report['warnings']) { return false; } parent::generateFileReport($report, $phpcsFile, $showSources, $width); - if (count($report['messages']) > 1) { - echo sprintf("✏️ phpstorm://open?file=%s", $phpcsFile->path).PHP_EOL; + if (\count($report['messages']) > 1) { + echo sprintf('✏️ phpstorm://open?file=%s', $phpcsFile->path).\PHP_EOL; } else { - echo sprintf("✏️ phpstorm://open?file=%s&line=%d", $phpcsFile->path, key($report['messages'])).PHP_EOL; + echo sprintf('✏️ phpstorm://open?file=%s&line=%d', $phpcsFile->path, key($report['messages'])).\PHP_EOL; } return true;