Skip to content

Commit 9273c7d

Browse files
committed
php-cs-fixer
1 parent 54baea4 commit 9273c7d

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

.php-cs-fixer.dist.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
$header = <<<'EOF'
4+
This file is part of WickedOne\PHPCSReporter.
5+
6+
(c) wicliff <[email protected]>
7+
8+
For the full copyright and license information, please view the LICENSE
9+
file that was distributed with this source code.
10+
EOF;
11+
12+
return (new PhpCsFixer\Config())
13+
->setRiskyAllowed(true)
14+
->setRules(array(
15+
'@Symfony' => true,
16+
'@Symfony:risky' => true,
17+
'combine_consecutive_unsets' => true,
18+
'array_syntax' => array('syntax' => 'short'),
19+
'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']],
20+
'header_comment' => array('header' => $header),
21+
'no_useless_else' => true,
22+
'no_useless_return' => true,
23+
'ordered_class_elements' => true,
24+
'ordered_imports' => true,
25+
'php_unit_strict' => true,
26+
'phpdoc_add_missing_param_annotation' => true,
27+
'psr_autoloading' => true,
28+
'strict_comparison' => true,
29+
'strict_param' => true,
30+
'fopen_flags' => array('b_mode' => true),
31+
))
32+
->setFinder(
33+
(new PhpCsFixer\Finder())
34+
->in([__DIR__ . '/src/'])
35+
->name('*.php')
36+
);

src/PhpStormReport.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@
1717
use PHP_CodeSniffer\Reports\Full;
1818

1919
/**
20-
* PhpStorm Report
20+
* PhpStorm Report.
2121
*
2222
* @author wicliff <[email protected]>
2323
*/
2424
class PhpStormReport extends Full
2525
{
2626
/**
27-
* {@inheritdoc
27+
* {@inheritdoc.
2828
*/
2929
public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80): bool
3030
{
31-
if ($report['errors'] === 0 && $report['warnings'] === 0) {
31+
if (0 === $report['errors'] && 0 === $report['warnings']) {
3232
return false;
3333
}
3434

3535
parent::generateFileReport($report, $phpcsFile, $showSources, $width);
3636

37-
if (count($report['messages']) > 1) {
38-
echo sprintf("✏️ phpstorm://open?file=%s", $phpcsFile->path).PHP_EOL;
37+
if (\count($report['messages']) > 1) {
38+
echo sprintf('✏️ phpstorm://open?file=%s', $phpcsFile->path).\PHP_EOL;
3939
} else {
40-
echo sprintf("✏️ phpstorm://open?file=%s&line=%d", $phpcsFile->path, key($report['messages'])).PHP_EOL;
40+
echo sprintf('✏️ phpstorm://open?file=%s&line=%d', $phpcsFile->path, key($report['messages'])).\PHP_EOL;
4141
}
4242

4343
return true;

0 commit comments

Comments
 (0)