Skip to content

Commit 6cec624

Browse files
committed
Scrutinizer
1 parent 1da177e commit 6cec624

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

.php-cs-fixer.dist.php

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

33
$finder = PhpCsFixer\Finder::create()
4-
->exclude('vendor', 'docs', '.git', '.github')
4+
->exclude(['vendor', 'docs', '.git', '.github'])
55
->notPath('src/PhpSpreadsheet/Writer/ZipStream3.php')
66
->in(__DIR__);
77

bin/check-phpdoc-types.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* This will help us slowly migrate away from PHPDoc typing to PHP native typing.
1010
*/
11-
function checkPhpDocTypes(): void
11+
function checkPhpDocTypes(): int
1212
{
1313
$content = shell_exec('git diff --cached') ?? shell_exec('git diff') ?? shell_exec('git show HEAD');
1414
preg_match_all('~^\+ +\* @(param|var) (mixed|string|int|float|bool|null|array|\?|\|)+( \$\w+)?$~m', "$content", $parameters);
@@ -19,11 +19,16 @@ function checkPhpDocTypes(): void
1919
...$returns[0],
2020
];
2121

22-
if ($errors) {
22+
if (!empty($errors)) {
2323
echo 'PHP native types must be used instead of PHPDoc types (without comments), for the following lines:' . PHP_EOL . PHP_EOL;
2424
echo implode(PHP_EOL, $errors) . PHP_EOL;
25-
exit(1);
25+
26+
return 1;
2627
}
28+
29+
return 0;
2730
}
2831

29-
checkPhpDocTypes();
32+
if (checkPhpDocTypes()) {
33+
exit(1);
34+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
],
4747
"scripts": {
4848
"check": [
49-
"php ./bin/check-phpdoc-types",
49+
"php bin/check-phpdoc-types.php",
5050
"phpcs samples/ src/ tests/ --report=checkstyle",
5151
"phpcs samples/ src/ tests/ --standard=PHPCompatibility --runtime-set testVersion 8.0- --exclude=PHPCompatibility.Variables.ForbiddenThisUseContexts -n",
5252
"php-cs-fixer fix --ansi --dry-run --diff",

0 commit comments

Comments
 (0)