Skip to content

Commit 08d91ae

Browse files
committed
Apply wdes/coding-standard
1 parent 94f2ffe commit 08d91ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+345
-181
lines changed

src/AnalysisResult.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* (c) Copyright (c) 2016-2020 Ondřej Mirtes <[email protected]>
57
*
@@ -23,12 +25,9 @@
2325
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2426
* SOFTWARE.
2527
*/
26-
declare(strict_types=1);
2728

2829
namespace CodeLts\CliTools;
2930

30-
use CodeLts\CliTools\Error;
31-
3231
class AnalysisResult
3332
{
3433

@@ -71,10 +70,10 @@ static function (Error $a, Error $b): int {
7170
}
7271
);
7372

74-
$this->fileSpecificErrors = $fileSpecificErrors;
73+
$this->fileSpecificErrors = $fileSpecificErrors;
7574
$this->notFileSpecificErrors = $notFileSpecificErrors;
76-
$this->internalErrors = $internalErrors;
77-
$this->warnings = $warnings;
75+
$this->internalErrors = $internalErrors;
76+
$this->warnings = $warnings;
7877
}
7978

8079
public function hasErrors(): bool
@@ -128,4 +127,5 @@ public function hasInternalErrors(): bool
128127
{
129128
return count($this->internalErrors) > 0;
130129
}
130+
131131
}

src/AnsiEscapeSequences.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types=1);
3+
declare(strict_types = 1);
44

55
namespace CodeLts\CliTools;
66

src/Error.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types=1);
3+
declare(strict_types = 1);
44

55
namespace CodeLts\CliTools;
66

@@ -18,14 +18,13 @@ class Error
1818
protected $tip = null;
1919

2020
public const LEVEL_EMERGENCY = 0;
21-
public const LEVEL_ALERT = 1;
22-
public const LEVEL_CRITICAL = 2;
23-
public const LEVEL_ERROR = 3;
24-
public const LEVEL_WARNING = 4;
25-
public const LEVEL_NOTICE = 5;
26-
public const LEVEL_INFO = 6;
27-
public const LEVEL_DEBUG = 7;
28-
21+
public const LEVEL_ALERT = 1;
22+
public const LEVEL_CRITICAL = 2;
23+
public const LEVEL_ERROR = 3;
24+
public const LEVEL_WARNING = 4;
25+
public const LEVEL_NOTICE = 5;
26+
public const LEVEL_INFO = 6;
27+
public const LEVEL_DEBUG = 7;
2928

3029
public function __construct(
3130
string $message,
@@ -34,11 +33,11 @@ public function __construct(
3433
int $severity = Error::LEVEL_ERROR,
3534
?string $tip = null
3635
) {
37-
$this->message = $message;
38-
$this->file = $file;
39-
$this->line = $line;
36+
$this->message = $message;
37+
$this->file = $file;
38+
$this->line = $line;
4039
$this->severity = $severity;
41-
$this->tip = $tip;
40+
$this->tip = $tip;
4241
}
4342

4443
public function getMessage(): string
@@ -65,4 +64,5 @@ public function getTip(): ?string
6564
{
6665
return $this->tip;
6766
}
67+
6868
}

src/ErrorFormatter/CheckstyleErrorFormatter.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* (c) Copyright (c) 2016-2020 Ondřej Mirtes <[email protected]>
57
*
@@ -23,7 +25,6 @@
2325
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2426
* SOFTWARE.
2527
*/
26-
declare(strict_types=1);
2728

2829
namespace CodeLts\CliTools\ErrorFormatter;
2930

@@ -54,18 +55,22 @@ public function formatErrors(
5455
$output->writeLineFormatted('');
5556

5657
foreach ($this->groupByFile($analysisResult) as $relativeFilePath => $errors) {
57-
$output->writeRaw(sprintf(
58-
'<file name="%s">',
59-
$this->escape($relativeFilePath)
60-
));
58+
$output->writeRaw(
59+
sprintf(
60+
'<file name="%s">',
61+
$this->escape($relativeFilePath)
62+
)
63+
);
6164
$output->writeLineFormatted('');
6265

6366
foreach ($errors as $error) {
64-
$output->writeRaw(sprintf(
65-
' <error line="%d" column="1" severity="error" message="%s" />',
66-
$this->escape((string) $error->getLine()),
67-
$this->escape((string) $error->getMessage())
68-
));
67+
$output->writeRaw(
68+
sprintf(
69+
' <error line="%d" column="1" severity="error" message="%s" />',
70+
$this->escape((string) $error->getLine()),
71+
$this->escape((string) $error->getMessage())
72+
)
73+
);
6974
$output->writeLineFormatted('');
7075
}
7176
$output->writeRaw('</file>');
@@ -143,4 +148,5 @@ private function groupByFile(AnalysisResult $analysisResult): array
143148

144149
return $files;
145150
}
151+
146152
}

src/ErrorFormatter/ErrorFormatter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* (c) Copyright (c) 2016-2020 Ondřej Mirtes <[email protected]>
57
*
@@ -23,7 +25,6 @@
2325
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2426
* SOFTWARE.
2527
*/
26-
declare(strict_types=1);
2728

2829
namespace CodeLts\CliTools\ErrorFormatter;
2930

@@ -44,4 +45,5 @@ public function formatErrors(
4445
AnalysisResult $analysisResult,
4546
Output $output
4647
): int;
48+
4749
}

src/ErrorFormatter/GithubErrorFormatter.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* (c) Copyright (c) 2016-2020 Ondřej Mirtes <[email protected]>
57
*
@@ -23,7 +25,6 @@
2325
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2426
* SOFTWARE.
2527
*/
26-
declare(strict_types=1);
2728

2829
namespace CodeLts\CliTools\ErrorFormatter;
2930

@@ -52,7 +53,7 @@ public function __construct(
5253
RelativePathHelper $relativePathHelper,
5354
TableErrorFormatter $tableErrorformatter
5455
) {
55-
$this->relativePathHelper = $relativePathHelper;
56+
$this->relativePathHelper = $relativePathHelper;
5657
$this->tableErrorformatter = $tableErrorformatter;
5758
}
5859

@@ -66,9 +67,12 @@ public function formatErrors(AnalysisResult $analysisResult, Output $output): in
6667
'line' => $fileSpecificError->getLine(),
6768
'col' => 0,
6869
];
69-
array_walk($metas, static function (&$value, string $key): void {
70-
$value = sprintf('%s=%s', $key, (string) $value);
71-
});
70+
array_walk(
71+
$metas,
72+
static function (&$value, string $key): void {
73+
$value = sprintf('%s=%s', $key, (string) $value);
74+
}
75+
);
7276

7377
$message = $fileSpecificError->getMessage();
7478
// newlines need to be encoded
@@ -105,4 +109,5 @@ public function formatErrors(AnalysisResult $analysisResult, Output $output): in
105109

106110
return $analysisResult->hasErrors() ? 1 : 0;
107111
}
112+
108113
}

src/ErrorFormatter/GitlabErrorFormatter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* (c) Copyright (c) 2016-2020 Ondřej Mirtes <[email protected]>
57
*
@@ -23,7 +25,6 @@
2325
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2426
* SOFTWARE.
2527
*/
26-
declare(strict_types=1);
2728

2829
namespace CodeLts\CliTools\ErrorFormatter;
2930

@@ -102,4 +103,5 @@ public function formatErrors(AnalysisResult $analysisResult, Output $output): in
102103

103104
return $analysisResult->hasErrors() ? 1 : 0;
104105
}
106+
105107
}

src/ErrorFormatter/JsonErrorFormatter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* (c) Copyright (c) 2016-2020 Ondřej Mirtes <[email protected]>
57
*
@@ -23,7 +25,6 @@
2325
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2426
* SOFTWARE.
2527
*/
26-
declare(strict_types=1);
2728

2829
namespace CodeLts\CliTools\ErrorFormatter;
2930

@@ -84,4 +85,5 @@ public function formatErrors(AnalysisResult $analysisResult, Output $output): in
8485

8586
return $analysisResult->hasErrors() ? 1 : 0;
8687
}
88+
8789
}

src/ErrorFormatter/JunitErrorFormatter.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* (c) Copyright (c) 2016-2020 Ondřej Mirtes <[email protected]>
57
*
@@ -23,7 +25,6 @@
2325
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2426
* SOFTWARE.
2527
*/
26-
declare(strict_types=1);
2728

2829
namespace CodeLts\CliTools\ErrorFormatter;
2930

@@ -50,7 +51,7 @@ public function formatErrors(
5051
AnalysisResult $analysisResult,
5152
Output $output
5253
): int {
53-
$result = '<?xml version="1.0" encoding="UTF-8"?>';
54+
$result = '<?xml version="1.0" encoding="UTF-8"?>';
5455
$result .= sprintf(
5556
'<testsuite failures="%d" name="cli-tools" tests="%d" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/junit-team/junit5/r5.5.1/platform-tests/src/test/resources/jenkins-junit.xsd">',
5657
$analysisResult->getTotalErrorsCount(),
@@ -64,7 +65,7 @@ public function formatErrors(
6465
}
6566

6667
$fileName = $this->relativePathHelper->getRelativePath($file);
67-
$result .= $this->createTestCase(
68+
$result .= $this->createTestCase(
6869
sprintf('%s:%s', $fileName, (string) $fileSpecificError->getLine()),
6970
'ERROR',
7071
$this->escape($fileSpecificError->getMessage())
@@ -121,4 +122,5 @@ protected function escape(string $string): string
121122
{
122123
return htmlspecialchars($string, ENT_XML1 | ENT_COMPAT, 'UTF-8');
123124
}
125+
124126
}

src/ErrorFormatter/RawErrorFormatter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* (c) Copyright (c) 2016-2020 Ondřej Mirtes <[email protected]>
57
*
@@ -23,7 +25,6 @@
2325
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2426
* SOFTWARE.
2527
*/
26-
declare(strict_types=1);
2728

2829
namespace CodeLts\CliTools\ErrorFormatter;
2930

@@ -61,4 +62,5 @@ public function formatErrors(
6162

6263
return $analysisResult->hasErrors() ? 1 : 0;
6364
}
65+
6466
}

src/ErrorFormatter/RawTextErrorFormatter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types=1);
3+
declare(strict_types = 1);
44

55
namespace CodeLts\CliTools\ErrorFormatter;
66

@@ -34,4 +34,5 @@ public function formatErrors(
3434

3535
return $analysisResult->hasErrors() ? 1 : 0;
3636
}
37+
3738
}

0 commit comments

Comments
 (0)