mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-16 21:16:57 +00:00
Scrutinizer
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->exclude('vendor', 'docs', '.git', '.github')
|
||||
->exclude(['vendor', 'docs', '.git', '.github'])
|
||||
->notPath('src/PhpSpreadsheet/Writer/ZipStream3.php')
|
||||
->in(__DIR__);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* This will help us slowly migrate away from PHPDoc typing to PHP native typing.
|
||||
*/
|
||||
function checkPhpDocTypes(): void
|
||||
function checkPhpDocTypes(): int
|
||||
{
|
||||
$content = shell_exec('git diff --cached') ?? shell_exec('git diff') ?? shell_exec('git show HEAD');
|
||||
preg_match_all('~^\+ +\* @(param|var) (mixed|string|int|float|bool|null|array|\?|\|)+( \$\w+)?$~m', "$content", $parameters);
|
||||
@@ -19,11 +19,16 @@ function checkPhpDocTypes(): void
|
||||
...$returns[0],
|
||||
];
|
||||
|
||||
if ($errors) {
|
||||
if (!empty($errors)) {
|
||||
echo 'PHP native types must be used instead of PHPDoc types (without comments), for the following lines:' . PHP_EOL . PHP_EOL;
|
||||
echo implode(PHP_EOL, $errors) . PHP_EOL;
|
||||
exit(1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
checkPhpDocTypes();
|
||||
if (checkPhpDocTypes()) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"check": [
|
||||
"php ./bin/check-phpdoc-types",
|
||||
"php bin/check-phpdoc-types.php",
|
||||
"phpcs samples/ src/ tests/ --report=checkstyle",
|
||||
"phpcs samples/ src/ tests/ --standard=PHPCompatibility --runtime-set testVersion 8.0- --exclude=PHPCompatibility.Variables.ForbiddenThisUseContexts -n",
|
||||
"php-cs-fixer fix --ansi --dry-run --diff",
|
||||
|
||||
Reference in New Issue
Block a user