diff --git a/composer.lock b/composer.lock index eec04dbda..0f0b0c40c 100644 --- a/composer.lock +++ b/composer.lock @@ -242,16 +242,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.1", + "version": "v4.15.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", "shasum": "" }, "require": { @@ -292,9 +292,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" }, - "time": "2022-09-04T07:30:47+00:00" + "time": "2022-11-12T15:38:23+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -683,16 +683,16 @@ }, { "name": "staabm/phpstan-baseline-analysis", - "version": "0.9", + "version": "0.9.1", "source": { "type": "git", "url": "https://github.com/staabm/phpstan-baseline-analysis.git", - "reference": "8116766e5595d34251a6e4e7c5084c1e0681e9d3" + "reference": "a8d992891f69b9abd1eee89efb642b9b1caf4204" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/staabm/phpstan-baseline-analysis/zipball/8116766e5595d34251a6e4e7c5084c1e0681e9d3", - "reference": "8116766e5595d34251a6e4e7c5084c1e0681e9d3", + "url": "https://api.github.com/repos/staabm/phpstan-baseline-analysis/zipball/a8d992891f69b9abd1eee89efb642b9b1caf4204", + "reference": "a8d992891f69b9abd1eee89efb642b9b1caf4204", "shasum": "" }, "require": { @@ -702,9 +702,10 @@ "thecodingmachine/safe": "^1.3 || ^2.0" }, "require-dev": { - "phpstan/phpstan": "^1.8", + "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^9.5", "symfony/var-dumper": "^5.3", + "symplify/phpstan-rules": "^11.0", "thecodingmachine/phpstan-safe-rule": "^1.2" }, "bin": [ @@ -724,7 +725,7 @@ ], "support": { "issues": "https://github.com/staabm/phpstan-baseline-analysis/issues", - "source": "https://github.com/staabm/phpstan-baseline-analysis/tree/0.9" + "source": "https://github.com/staabm/phpstan-baseline-analysis/tree/0.9.1" }, "funding": [ { @@ -732,7 +733,7 @@ "type": "github" } ], - "time": "2022-10-13T15:17:23+00:00" + "time": "2022-11-12T21:39:56+00:00" }, { "name": "staabm/phpstan-dba", diff --git a/config/native-type-coverage.neon b/config/native-type-coverage.neon new file mode 100644 index 000000000..916b3b7c9 --- /dev/null +++ b/config/native-type-coverage.neon @@ -0,0 +1,34 @@ +services: + - + class: Symplify\PHPStanRules\Rules\Explicit\PropertyTypeDeclarationSeaLevelRule + tags: [phpstan.rules.rule] + arguments: + minimalLevel: 0.99 + printSuggestions: false + + - + class: Symplify\PHPStanRules\Rules\Explicit\ParamTypeDeclarationSeaLevelRule + tags: [phpstan.rules.rule] + arguments: + minimalLevel: 0.99 + printSuggestions: false + + - + class: Symplify\PHPStanRules\Rules\Explicit\ReturnTypeDeclarationSeaLevelRule + tags: [phpstan.rules.rule] + arguments: + minimalLevel: 0.99 + printSuggestions: false + + # for "type declaration sea level" + - + class: Symplify\PHPStanRules\Collector\FunctionLike\ParamTypeSeaLevelCollector + tags: [phpstan.collector] + + - + class: Symplify\PHPStanRules\Collector\FunctionLike\ReturnTypeSeaLevelCollector + tags: [phpstan.collector] + + - + class: Symplify\PHPStanRules\Collector\ClassLike\PropertyTypeSeaLevelCollector + tags: [phpstan.collector] diff --git a/default-config.neon b/default-config.neon index 2ede7bc1f..afd33f703 100644 --- a/default-config.neon +++ b/default-config.neon @@ -2,8 +2,10 @@ includes: - vendor/spaze/phpstan-disallowed-calls/extension.neon - # required for dead-code.neon and code-complexity.neon + # required for dead-code.neon, code-complexity.neon, native-type-coverage.neon - vendor/symplify/phpstan-rules/config/services/services.neon + # enable native type coverage per default. + - config/native-type-coverage.neon parameters: level: 5 diff --git a/lib/RexStanUserConfig.php b/lib/RexStanUserConfig.php index 25ba2e536..280a8a09c 100644 --- a/lib/RexStanUserConfig.php +++ b/lib/RexStanUserConfig.php @@ -11,6 +11,11 @@ final class RexStanUserConfig { + /** + * Cache key to invalidate the summary signature in case of default-config.neon changes. + */ + const DEFAULT_SETTINGS_VERSION = 'v1-native-type-coverage'; + /** * @param list $paths * @param list $includes @@ -66,7 +71,7 @@ public static function getSignature(): string if (!$md5) { throw new \PHPStan\ShouldNotHappenException(); } - return $md5; + return self::DEFAULT_SETTINGS_VERSION.'|'.$md5; } /** diff --git a/pages/analysis.php b/pages/analysis.php index c100d57cf..412e36fbd 100644 --- a/pages/analysis.php +++ b/pages/analysis.php @@ -123,6 +123,11 @@ function randomInRange(min, max) { $section->setVar('sectionAttributes', ['class' => 'rexstan'], false); foreach ($phpstanResult['files'] as $file => $fileResult) { + // skip project wide errors, which don't relate to a single file + if ($file === 'N/A') { + continue; + } + $shortFile = str_replace($basePath, '', $file); $linkFile = preg_replace('/\s\(in context.*?$/', '', $file); $title = ''. diff --git a/pages/summary.php b/pages/summary.php index c8dd8d365..fa42d4d50 100644 --- a/pages/summary.php +++ b/pages/summary.php @@ -17,8 +17,8 @@ - - + + @@ -36,4 +36,22 @@
FehlerklasseErrorsFehlerklasseOverall-Errors Cognitive-Complexity Deprecations Invalide PHPDocs
+ + + + + + + + + + + + + + + + +
Native Type CoverageClass Property TypesParameter TypesReturn Types
Fortschritt in %
+

Die Zusammenfassung ist abhängig von den in den Einstellungen definierten PHPStan-Extensions

diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index aaf5f00c9..29d48cdd0 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -245,17 +245,17 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.1", - "version_normalized": "4.15.1.0", + "version": "v4.15.2", + "version_normalized": "4.15.2.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", "shasum": "" }, "require": { @@ -266,7 +266,7 @@ "ircmaxell/php-yacc": "^0.0.7", "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, - "time": "2022-09-04T07:30:47+00:00", + "time": "2022-11-12T15:38:23+00:00", "bin": [ "bin/php-parse" ], @@ -298,7 +298,7 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" }, "install-path": "../nikic/php-parser" }, @@ -710,17 +710,17 @@ }, { "name": "staabm/phpstan-baseline-analysis", - "version": "0.9", - "version_normalized": "0.9.0.0", + "version": "0.9.1", + "version_normalized": "0.9.1.0", "source": { "type": "git", "url": "https://github.com/staabm/phpstan-baseline-analysis.git", - "reference": "8116766e5595d34251a6e4e7c5084c1e0681e9d3" + "reference": "a8d992891f69b9abd1eee89efb642b9b1caf4204" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/staabm/phpstan-baseline-analysis/zipball/8116766e5595d34251a6e4e7c5084c1e0681e9d3", - "reference": "8116766e5595d34251a6e4e7c5084c1e0681e9d3", + "url": "https://api.github.com/repos/staabm/phpstan-baseline-analysis/zipball/a8d992891f69b9abd1eee89efb642b9b1caf4204", + "reference": "a8d992891f69b9abd1eee89efb642b9b1caf4204", "shasum": "" }, "require": { @@ -730,12 +730,13 @@ "thecodingmachine/safe": "^1.3 || ^2.0" }, "require-dev": { - "phpstan/phpstan": "^1.8", + "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^9.5", "symfony/var-dumper": "^5.3", + "symplify/phpstan-rules": "^11.0", "thecodingmachine/phpstan-safe-rule": "^1.2" }, - "time": "2022-10-13T15:17:23+00:00", + "time": "2022-11-12T21:39:56+00:00", "bin": [ "bin/phpstan-baseline-analyze", "bin/phpstan-baseline-trend", @@ -754,7 +755,7 @@ ], "support": { "issues": "https://github.com/staabm/phpstan-baseline-analysis/issues", - "source": "https://github.com/staabm/phpstan-baseline-analysis/tree/0.9" + "source": "https://github.com/staabm/phpstan-baseline-analysis/tree/0.9.1" }, "funding": [ { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index db787756e..bc233fccf 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '8f2496604468100163a9aadd129f5a72ddc7f7d4', + 'reference' => 'dbc33b35c458e338531bdf284f9ac157d9ee02ee', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '8f2496604468100163a9aadd129f5a72ddc7f7d4', + 'reference' => 'dbc33b35c458e338531bdf284f9ac157d9ee02ee', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -47,9 +47,9 @@ 'dev_requirement' => false, ), 'nikic/php-parser' => array( - 'pretty_version' => 'v4.15.1', - 'version' => '4.15.1.0', - 'reference' => '0ef6c55a3f47f89d7a374e6f835197a0b5fcf900', + 'pretty_version' => 'v4.15.2', + 'version' => '4.15.2.0', + 'reference' => 'f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), @@ -119,9 +119,9 @@ 'dev_requirement' => false, ), 'staabm/phpstan-baseline-analysis' => array( - 'pretty_version' => '0.9', - 'version' => '0.9.0.0', - 'reference' => '8116766e5595d34251a6e4e7c5084c1e0681e9d3', + 'pretty_version' => '0.9.1', + 'version' => '0.9.1.0', + 'reference' => 'a8d992891f69b9abd1eee89efb642b9b1caf4204', 'type' => 'library', 'install_path' => __DIR__ . '/../staabm/phpstan-baseline-analysis', 'aliases' => array(), diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php index 84c0175ec..7e0a5de0f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php @@ -206,6 +206,11 @@ public function haveBracesInRange(int $startPos, int $endPos) { || $this->haveTokenInRange($startPos, $endPos, '}'); } + public function haveTagInRange(int $startPos, int $endPos): bool { + return $this->haveTokenInRange($startPos, $endPos, \T_OPEN_TAG) + || $this->haveTokenInRange($startPos, $endPos, \T_CLOSE_TAG); + } + /** * Get indentation before token position. * diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php index d4796d65b..8a15c6f1f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php @@ -47,13 +47,7 @@ public static function fromString(string $str, array $attributes = []): DNumber public static function parse(string $str) : float { $str = str_replace('_', '', $str); - // if string contains any of .eE just cast it to float - if (false !== strpbrk($str, '.eE')) { - return (float) $str; - } - - // otherwise it's an integer notation that overflowed into a float - // if it starts with 0 it's one of the special integer notations + // Check whether this is one of the special integer notations. if ('0' === $str[0]) { // hex if ('x' === $str[1] || 'X' === $str[1]) { @@ -65,10 +59,12 @@ public static function parse(string $str) : float { return bindec($str); } - // oct - // substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit (8 or 9) - // so that only the digits before that are used - return octdec(substr($str, 0, strcspn($str, '89'))); + // oct, but only if the string does not contain any of '.eE'. + if (false === strpbrk($str, '.eE')) { + // substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit + // (8 or 9) so that only the digits before that are used. + return octdec(substr($str, 0, strcspn($str, '89'))); + } } // dec diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php b/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php index 51ecec2a3..93cecd238 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php @@ -4,7 +4,7 @@ class UnionType extends ComplexType { - /** @var (Identifier|Name)[] Types */ + /** @var (Identifier|Name|IntersectionType)[] Types */ public $types; /** diff --git a/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php index 82b1e3558..6ed936fed 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php +++ b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php @@ -774,7 +774,8 @@ protected function pArray( } if ($skipRemovedNode) { - if ($isStmtList && $this->origTokens->haveBracesInRange($pos, $itemStartPos)) { + if ($isStmtList && ($this->origTokens->haveBracesInRange($pos, $itemStartPos) || + $this->origTokens->haveTagInRange($pos, $itemStartPos))) { // We'd remove the brace of a code block. // TODO: Preserve formatting. $this->setIndentLevel($origIndentLevel); @@ -877,7 +878,8 @@ protected function pArray( $pos, $itemStartPos, $indentAdjustment); $skipRemovedNode = true; } else { - if ($isStmtList && $this->origTokens->haveBracesInRange($pos, $itemStartPos)) { + if ($isStmtList && ($this->origTokens->haveBracesInRange($pos, $itemStartPos) || + $this->origTokens->haveTagInRange($pos, $itemStartPos))) { // We'd remove the brace of a code block. // TODO: Preserve formatting. return null; diff --git a/vendor/staabm/phpstan-baseline-analysis/.github/workflows/unit-tests.yml b/vendor/staabm/phpstan-baseline-analysis/.github/workflows/unit-tests.yml index 6ba4b3de0..3a4efe226 100644 --- a/vendor/staabm/phpstan-baseline-analysis/.github/workflows/unit-tests.yml +++ b/vendor/staabm/phpstan-baseline-analysis/.github/workflows/unit-tests.yml @@ -42,5 +42,5 @@ jobs: - name: Setup Problem Matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: Run phpunit + - name: Run unit tests run: vendor/bin/phpunit --colors=always diff --git a/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-analyze.php b/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-analyze.php index b8f9bffd8..771018257 100644 --- a/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-analyze.php +++ b/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-analyze.php @@ -16,6 +16,12 @@ $app = new \staabm\PHPStanBaselineAnalysis\AnalyzeApplication(); +if (in_array('--version', $argv)) { + echo "PHPStan baseline analysis, version ". \Composer\InstalledVersions::getPrettyVersion('staabm/phpstan-baseline-analysis') ."\n"; + echo "https://github.com/staabm/phpstan-baseline-analysis\n"; + exit(0); +} + if ($argc <= 1) { $app->help(); exit(254); diff --git a/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-graph.php b/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-graph.php index 09b1480ca..e16f2cd82 100644 --- a/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-graph.php +++ b/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-graph.php @@ -16,6 +16,12 @@ $app = new \staabm\PHPStanBaselineAnalysis\GraphApplication(); +if (in_array('--version', $argv)) { + echo "PHPStan baseline analysis, version ". \Composer\InstalledVersions::getPrettyVersion('staabm/phpstan-baseline-analysis') ."\n"; + echo "https://github.com/staabm/phpstan-baseline-analysis\n"; + exit(0); +} + if ($argc <= 1) { $app->help(); exit(254); diff --git a/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-trend.php b/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-trend.php index 9cd07c17b..c2af528eb 100644 --- a/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-trend.php +++ b/vendor/staabm/phpstan-baseline-analysis/bin/phpstan-baseline-trend.php @@ -16,6 +16,12 @@ $app = new \staabm\PHPStanBaselineAnalysis\TrendApplication(); +if (in_array('--version', $argv)) { + echo "PHPStan baseline analysis, version ". \Composer\InstalledVersions::getPrettyVersion('staabm/phpstan-baseline-analysis') ."\n"; + echo "https://github.com/staabm/phpstan-baseline-analysis\n"; + exit(0); +} + if ($argc <= 2) { $app->help(); exit(254); diff --git a/vendor/staabm/phpstan-baseline-analysis/composer.json b/vendor/staabm/phpstan-baseline-analysis/composer.json index 12da5dad5..fc56b94c0 100644 --- a/vendor/staabm/phpstan-baseline-analysis/composer.json +++ b/vendor/staabm/phpstan-baseline-analysis/composer.json @@ -16,18 +16,22 @@ "thecodingmachine/safe": "^1.3 || ^2.0" }, "require-dev": { - "phpstan/phpstan": "^1.8", + "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^9.5", "symfony/var-dumper": "^5.3", + "symplify/phpstan-rules": "^11.0", "thecodingmachine/phpstan-safe-rule": "^1.2" }, "config": { "optimize-autoloader": true, - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "cweagans/composer-patches": false + } }, "scripts": { "phpstan": "phpstan analyze", - "phpunit": "phpunit" + "test": "phpunit" }, "bin": [ "bin/phpstan-baseline-analyze", diff --git a/vendor/staabm/phpstan-baseline-analysis/lib/AnalyzerResult.php b/vendor/staabm/phpstan-baseline-analysis/lib/AnalyzerResult.php index b0cd27b2b..4c31dc000 100644 --- a/vendor/staabm/phpstan-baseline-analysis/lib/AnalyzerResult.php +++ b/vendor/staabm/phpstan-baseline-analysis/lib/AnalyzerResult.php @@ -35,4 +35,19 @@ final class AnalyzerResult { * @var int */ public $anonymousVariables = 0; -} \ No newline at end of file + + /** + * @var int<0, 100> + */ + public $propertyTypeCoverage = 0; + + /** + * @var int<0, 100> + */ + public $paramTypeCoverage = 0; + + /** + * @var int<0, 100> + */ + public $returnTypeCoverage = 0; +} diff --git a/vendor/staabm/phpstan-baseline-analysis/lib/AnalyzerResultReader.php b/vendor/staabm/phpstan-baseline-analysis/lib/AnalyzerResultReader.php index 57c759d51..1236df7cf 100644 --- a/vendor/staabm/phpstan-baseline-analysis/lib/AnalyzerResultReader.php +++ b/vendor/staabm/phpstan-baseline-analysis/lib/AnalyzerResultReader.php @@ -2,10 +2,8 @@ namespace staabm\PHPStanBaselineAnalysis; -use Safe\DateTimeImmutable; use function Safe\file_get_contents; use function Safe\json_decode; -use function Safe\strtotime; final class AnalyzerResultReader { /** @@ -15,12 +13,13 @@ final class AnalyzerResultReader { */ public function readFile(string $filePath): array { + \Safe\fwrite(STDERR, 'Reading file '.$filePath.PHP_EOL); + $content = file_get_contents($filePath); if ($content === '') { throw new \RuntimeException('File '. $filePath .' is empty'); } $json = json_decode($content, true); - if (!is_array($json)) { throw new \RuntimeException('Expecting array, got ' . gettype($json)); } @@ -38,7 +37,7 @@ public function readFile(string $filePath): array throw new \RuntimeException('Expecting string, got ' . gettype($baselinePath)); } if (!is_array($resultArray)) { - throw new \RuntimeException('Expecting string, got ' . gettype($resultArray)); + throw new \RuntimeException('Expecting array, got ' . gettype($resultArray)); } $result = new AnalyzerResult(); @@ -70,6 +69,15 @@ public function readFile(string $filePath): array if (array_key_exists(ResultPrinter::KEY_ANONYMOUS_VARIABLES, $resultArray)) { $result->anonymousVariables = $resultArray[ResultPrinter::KEY_ANONYMOUS_VARIABLES]; } + if (array_key_exists(ResultPrinter::KEY_PROPERTY_TYPE_COVERAGE, $resultArray)) { + $result->propertyTypeCoverage = $resultArray[ResultPrinter::KEY_PROPERTY_TYPE_COVERAGE]; + } + if (array_key_exists(ResultPrinter::KEY_PARAM_TYPE_COVERAGE, $resultArray)) { + $result->paramTypeCoverage = $resultArray[ResultPrinter::KEY_PARAM_TYPE_COVERAGE]; + } + if (array_key_exists(ResultPrinter::KEY_RETURN_TYPE_COVERAGE, $resultArray)) { + $result->returnTypeCoverage = $resultArray[ResultPrinter::KEY_RETURN_TYPE_COVERAGE]; + } $decoded[$baselinePath] = $result; } @@ -77,4 +85,4 @@ public function readFile(string $filePath): array return $decoded; } -} \ No newline at end of file +} diff --git a/vendor/staabm/phpstan-baseline-analysis/lib/BaselineAnalyzer.php b/vendor/staabm/phpstan-baseline-analysis/lib/BaselineAnalyzer.php index 97f394748..71e4998c8 100644 --- a/vendor/staabm/phpstan-baseline-analysis/lib/BaselineAnalyzer.php +++ b/vendor/staabm/phpstan-baseline-analysis/lib/BaselineAnalyzer.php @@ -7,6 +7,23 @@ final class BaselineAnalyzer { + /** + * @var string + */ + public const CLASS_COMPLEXITY_ERROR_MESSAGE = 'Class cognitive complexity is %d, keep it under %d'; + /** + * @var string + */ + public const PROPERTY_TYPE_DEClARATION_SEA_LEVEL_MESSAGE = 'Out of %d possible property types, only %d %% actually have it. Add more property types to get over %d %%'; + /** + * @var string + */ + public const PARAM_TYPE_DEClARATION_SEA_LEVEL_MESSAGE = 'Out of %d possible param types, only %d %% actually have it. Add more param types to get over %d %%'; + /** + * @var string + */ + public const RETURN_TYPE_DEClARATION_SEA_LEVEL_MESSAGE = 'Out of %d possible return types, only %d %% actually have it. Add more return types to get over %d %%'; + /** * @var Baseline */ @@ -26,12 +43,16 @@ public function analyze(): AnalyzerResult * @var BaselineError $baselineError */ foreach ($this->baseline->getIgnoreErrors() as $baselineError) { + // accumulating errors $result->overallErrors += $baselineError->count; $result->deprecations += $this->countDeprecations($baselineError); $result->classesComplexity += $this->countClassesComplexity($baselineError); $result->invalidPhpdocs += $this->countInvalidPhpdocs($baselineError); $result->unknownTypes += $this->countUnknownTypes($baselineError); $result->anonymousVariables += $this->countAnonymousVariables($baselineError); + + // project wide errors, only reported once per baseline + $this->checkSeaLevels($result, $baselineError); } return $result; @@ -46,9 +67,10 @@ private function countDeprecations(BaselineError $baselineError): int private function countClassesComplexity(BaselineError $baselineError): int { - return preg_match('/Class cognitive complexity is (?P\d+), keep it under (?P\d+)/', $baselineError->message, $matches) === 1 - ? (int)$matches['value'] * $baselineError->count - : 0; + if (sscanf($baselineError->unwrapMessage(), self::CLASS_COMPLEXITY_ERROR_MESSAGE, $value, $limit) > 0) { + return (int)$value * $baselineError->count; + } + return 0; } private function countInvalidPhpdocs(BaselineError $baselineError): int @@ -77,4 +99,26 @@ private function countAnonymousVariables(BaselineError $baselineError): int ? $baselineError->count : 0; } + + private function checkSeaLevels(AnalyzerResult $result, BaselineError $baselineError): void + { + if (sscanf($baselineError->unwrapMessage(), self::PROPERTY_TYPE_DEClARATION_SEA_LEVEL_MESSAGE, $absoluteCount, $coveragePercent, $goalPercent) >= 2) { + if (!is_int($coveragePercent) || $coveragePercent < 0 || $coveragePercent > 100) { + throw new \LogicException('Invalid property coveragePercent: '. $coveragePercent); + } + $result->propertyTypeCoverage = $coveragePercent; + } + if (sscanf($baselineError->unwrapMessage(), self::PARAM_TYPE_DEClARATION_SEA_LEVEL_MESSAGE, $absoluteCount, $coveragePercent, $goalPercent) >= 2) { + if (!is_int($coveragePercent) || $coveragePercent < 0 || $coveragePercent > 100) { + throw new \LogicException('Invalid parameter coveragePercent: '. $coveragePercent); + } + $result->paramTypeCoverage = $coveragePercent; + } + if (sscanf($baselineError->unwrapMessage(), self::RETURN_TYPE_DEClARATION_SEA_LEVEL_MESSAGE, $absoluteCount, $coveragePercent, $goalPercent) >= 2) { + if (!is_int($coveragePercent) || $coveragePercent < 0 || $coveragePercent > 100) { + throw new \LogicException('Invalid return coveragePercent: '. $coveragePercent); + } + $result->returnTypeCoverage = $coveragePercent; + } + } } diff --git a/vendor/staabm/phpstan-baseline-analysis/lib/BaselineError.php b/vendor/staabm/phpstan-baseline-analysis/lib/BaselineError.php index c907968c0..a3d158e40 100644 --- a/vendor/staabm/phpstan-baseline-analysis/lib/BaselineError.php +++ b/vendor/staabm/phpstan-baseline-analysis/lib/BaselineError.php @@ -13,4 +13,17 @@ final class BaselineError * @var string */ public $message; + + /** + * Returns the baseline error message, without regex delimiters. + * Note: the message may still contain escaped regex meta characters. + * + * @return string + */ + public function unwrapMessage(): string { + $msg = $this->message; + $msg = str_replace(['\\.', '%%'], ['.', '%'], $msg); + $msg = trim($msg, '#^$'); + return $msg; + } } diff --git a/vendor/staabm/phpstan-baseline-analysis/lib/GraphTemplate.php b/vendor/staabm/phpstan-baseline-analysis/lib/GraphTemplate.php index 3ca782b4d..6991dbe81 100644 --- a/vendor/staabm/phpstan-baseline-analysis/lib/GraphTemplate.php +++ b/vendor/staabm/phpstan-baseline-analysis/lib/GraphTemplate.php @@ -27,12 +27,60 @@ public function render(Iterator $it):string { if (!array_key_exists($baselinePath, $splines)) { $splines[$baselinePath] = []; - $splines[$baselinePath][0] = ['label' => ResultPrinter::KEY_OVERALL_ERRORS, 'borderColor' => 'blue', 'data' => []]; - $splines[$baselinePath][1] = ['label' => ResultPrinter::KEY_CLASSES_COMPLEXITY, 'borderColor' => self::COMPLEXITY_COLOR, 'data' => []]; - $splines[$baselinePath][2] = ['label' => ResultPrinter::KEY_DEPRECATIONS, 'borderColor' => 'lightgreen', 'data' => []]; - $splines[$baselinePath][3] = ['label' => ResultPrinter::KEY_INVALID_PHPDOCS, 'borderColor' => 'lightblue', 'data' => []]; - $splines[$baselinePath][4] = ['label' => ResultPrinter::KEY_UNKNOWN_TYPES, 'borderColor' => 'purple', 'data' => []]; - $splines[$baselinePath][5] = ['label' => ResultPrinter::KEY_ANONYMOUS_VARIABLES, 'borderColor' => 'pink', 'data' => []]; + $splines[$baselinePath][0] = [ + 'label' => ResultPrinter::KEY_OVERALL_ERRORS, + 'borderColor' => 'blue', + 'data' => [] + ]; + $splines[$baselinePath][1] = [ + 'label' => ResultPrinter::KEY_CLASSES_COMPLEXITY, + 'borderColor' => self::COMPLEXITY_COLOR, + 'data' => [] + ]; + $splines[$baselinePath][2] = [ + 'label' => ResultPrinter::KEY_DEPRECATIONS, + 'borderColor' => 'lightgreen', + 'data' => [] + ]; + $splines[$baselinePath][3] = [ + 'label' => ResultPrinter::KEY_INVALID_PHPDOCS, + 'borderColor' => 'lightblue', + 'data' => [] + ]; + $splines[$baselinePath][4] = [ + 'label' => ResultPrinter::KEY_UNKNOWN_TYPES, + 'borderColor' => 'purple', + 'data' => [] + ]; + $splines[$baselinePath][5] = [ + 'label' => ResultPrinter::KEY_ANONYMOUS_VARIABLES, + 'borderColor' => 'pink', + 'data' => [] + ]; + $splines[$baselinePath][6] = [ + 'label' => ResultPrinter::KEY_PROPERTY_TYPE_COVERAGE, + 'yAxisID' => 'yPercent', + 'borderColor' => 'lightcoral', + 'borderWidth' => 2, + 'type' => 'bar', + 'data' => [] + ]; + $splines[$baselinePath][7] = [ + 'label' => ResultPrinter::KEY_PARAM_TYPE_COVERAGE, + 'yAxisID' => 'yPercent', + 'borderColor' => 'lightseagreen', + 'borderWidth' => 2, + 'type' => 'bar', + 'data' => [] + ]; + $splines[$baselinePath][8] = [ + 'label' => ResultPrinter::KEY_RETURN_TYPE_COVERAGE, + 'yAxisID' => 'yPercent', + 'borderColor' => 'lightsteelblue', + 'borderWidth' => 2, + 'type' => 'bar', + 'data' => [] + ]; } $dataByDates[$baselinePath][$analyzerResult->referenceDate->getTimestamp()] = [ @@ -42,6 +90,9 @@ public function render(Iterator $it):string { $analyzerResult->invalidPhpdocs, $analyzerResult->unknownTypes, $analyzerResult->anonymousVariables, + $analyzerResult->propertyTypeCoverage, + $analyzerResult->paramTypeCoverage, + $analyzerResult->returnTypeCoverage, ]; } @@ -54,6 +105,9 @@ public function render(Iterator $it):string { $splines[$baselinePath][3]['data'][] = $data[3]; $splines[$baselinePath][4]['data'][] = $data[4]; $splines[$baselinePath][5]['data'][] = $data[5]; + $splines[$baselinePath][6]['data'][] = $data[6]; + $splines[$baselinePath][7]['data'][] = $data[7]; + $splines[$baselinePath][8]['data'][] = $data[8]; } } @@ -70,12 +124,29 @@ public function render(Iterator $it):string { const ctx = document.getElementById(\'chartContainer' . md5($baselinePath) . '\'); const chart = new Chart(ctx, { type: \'line\', - options: { + options: { plugins: { title: { display: true, text: \'PHPStan Baseline Analysis '. $baselinePath .'\', } + }, + scales: { + x: { + beginAtZero: true, + }, + y: { + beginAtZero: true, + }, + yPercent: { + min: 0, + max: 100, + beginAtZero: true, + position: \'right\', + grid: { + display: false, + }, + }, } }, data: { diff --git a/vendor/staabm/phpstan-baseline-analysis/lib/ResultPrinter.php b/vendor/staabm/phpstan-baseline-analysis/lib/ResultPrinter.php index 5ade16732..a0053cfe2 100644 --- a/vendor/staabm/phpstan-baseline-analysis/lib/ResultPrinter.php +++ b/vendor/staabm/phpstan-baseline-analysis/lib/ResultPrinter.php @@ -21,6 +21,9 @@ final class ResultPrinter { const KEY_INVALID_PHPDOCS = 'Invalid-Phpdocs'; const KEY_UNKNOWN_TYPES = 'Unknown-Types'; const KEY_ANONYMOUS_VARIABLES = 'Anonymous-Variables'; + const KEY_PROPERTY_TYPE_COVERAGE = 'Native-Property-Type-Coverage'; + const KEY_PARAM_TYPE_COVERAGE = 'Native-Param-Type-Coverage'; + const KEY_RETURN_TYPE_COVERAGE = 'Native-Return-Type-Coverage'; /** * @var int @@ -44,8 +47,12 @@ public function streamText(Baseline $baseline, AnalyzerResult $result): Iterator yield sprintf(" %s: %s\n", self::KEY_INVALID_PHPDOCS, $result->invalidPhpdocs); yield sprintf(" %s: %s\n", self::KEY_UNKNOWN_TYPES, $result->unknownTypes); yield sprintf(" %s: %s\n", self::KEY_ANONYMOUS_VARIABLES, $result->anonymousVariables); + yield sprintf(" %s: %s\n", self::KEY_PROPERTY_TYPE_COVERAGE, $result->propertyTypeCoverage); + yield sprintf(" %s: %s\n", self::KEY_PARAM_TYPE_COVERAGE, $result->paramTypeCoverage); + yield sprintf(" %s: %s\n", self::KEY_RETURN_TYPE_COVERAGE, $result->returnTypeCoverage); } + /** * @return Iterator */ @@ -65,6 +72,9 @@ public function streamJson(Baseline $baseline, AnalyzerResult $result): Iterator self::KEY_INVALID_PHPDOCS => $result->invalidPhpdocs, self::KEY_UNKNOWN_TYPES => $result->unknownTypes, self::KEY_ANONYMOUS_VARIABLES => $result->anonymousVariables, + self::KEY_PROPERTY_TYPE_COVERAGE => $result->propertyTypeCoverage, + self::KEY_PARAM_TYPE_COVERAGE => $result->paramTypeCoverage, + self::KEY_RETURN_TYPE_COVERAGE => $result->returnTypeCoverage, ] ]); } diff --git a/vendor/staabm/phpstan-baseline-analysis/tests/AnalyzeApplicationTest.php b/vendor/staabm/phpstan-baseline-analysis/tests/AnalyzeApplicationTest.php index dde45be3c..8006c457e 100644 --- a/vendor/staabm/phpstan-baseline-analysis/tests/AnalyzeApplicationTest.php +++ b/vendor/staabm/phpstan-baseline-analysis/tests/AnalyzeApplicationTest.php @@ -22,12 +22,15 @@ function testTextPrinting():void $expected = <<assertSame($expected, $rendered); diff --git a/vendor/staabm/phpstan-baseline-analysis/tests/BaselineAnalyzerTest.php b/vendor/staabm/phpstan-baseline-analysis/tests/BaselineAnalyzerTest.php index 40b007485..1ad93e6df 100644 --- a/vendor/staabm/phpstan-baseline-analysis/tests/BaselineAnalyzerTest.php +++ b/vendor/staabm/phpstan-baseline-analysis/tests/BaselineAnalyzerTest.php @@ -5,6 +5,10 @@ use PHPUnit\Framework\TestCase; use staabm\PHPStanBaselineAnalysis\Baseline; use staabm\PHPStanBaselineAnalysis\BaselineAnalyzer; +use Symplify\PHPStanRules\CognitiveComplexity\Rules\ClassLikeCognitiveComplexityRule; +use Symplify\PHPStanRules\Rules\Explicit\ParamTypeDeclarationSeaLevelRule; +use Symplify\PHPStanRules\Rules\Explicit\PropertyTypeDeclarationSeaLevelRule; +use Symplify\PHPStanRules\Rules\Explicit\ReturnTypeDeclarationSeaLevelRule; class BaselineAnalyzerTest extends TestCase { @@ -13,12 +17,15 @@ function testAllInComplexity():void $analyzer = new BaselineAnalyzer(Baseline::forFile(__DIR__ . '/fixtures/all-in.neon')); $result = $analyzer->analyze(); - $this->assertSame(35, $result->overallErrors); + $this->assertSame(38, $result->overallErrors); $this->assertSame(70, $result->classesComplexity); $this->assertSame(2, $result->deprecations); $this->assertSame(5, $result->invalidPhpdocs); $this->assertSame(1, $result->unknownTypes); $this->assertSame(4, $result->anonymousVariables); + $this->assertSame(1, $result->propertyTypeCoverage); + $this->assertSame(27, $result->paramTypeCoverage); + $this->assertSame(4, $result->returnTypeCoverage); } function testClassComplexity():void @@ -32,6 +39,9 @@ function testClassComplexity():void $this->assertSame(0, $result->invalidPhpdocs); $this->assertSame(0, $result->unknownTypes); $this->assertSame(0, $result->anonymousVariables); + $this->assertSame(0, $result->propertyTypeCoverage); + $this->assertSame(0, $result->paramTypeCoverage); + $this->assertSame(0, $result->returnTypeCoverage); } function testMethodComplexityIgnored():void @@ -45,6 +55,9 @@ function testMethodComplexityIgnored():void $this->assertSame(0, $result->invalidPhpdocs); $this->assertSame(0, $result->unknownTypes); $this->assertSame(0, $result->anonymousVariables); + $this->assertSame(0, $result->propertyTypeCoverage); + $this->assertSame(0, $result->paramTypeCoverage); + $this->assertSame(0, $result->returnTypeCoverage); } function testDeprecations():void @@ -58,6 +71,9 @@ function testDeprecations():void $this->assertSame(0, $result->invalidPhpdocs); $this->assertSame(0, $result->unknownTypes); $this->assertSame(0, $result->anonymousVariables); + $this->assertSame(0, $result->propertyTypeCoverage); + $this->assertSame(0, $result->paramTypeCoverage); + $this->assertSame(0, $result->returnTypeCoverage); } function testInvalidPhpdocs():void @@ -71,6 +87,9 @@ function testInvalidPhpdocs():void $this->assertSame(8, $result->invalidPhpdocs); $this->assertSame(0, $result->unknownTypes); $this->assertSame(0, $result->anonymousVariables); + $this->assertSame(0, $result->propertyTypeCoverage); + $this->assertSame(0, $result->paramTypeCoverage); + $this->assertSame(0, $result->returnTypeCoverage); } function testUnknownTypes():void @@ -84,6 +103,9 @@ function testUnknownTypes():void $this->assertSame(0, $result->invalidPhpdocs); $this->assertSame(7, $result->unknownTypes); $this->assertSame(0, $result->anonymousVariables); + $this->assertSame(0, $result->propertyTypeCoverage); + $this->assertSame(0, $result->paramTypeCoverage); + $this->assertSame(0, $result->returnTypeCoverage); } function testAnonymousVariables():void @@ -97,6 +119,44 @@ function testAnonymousVariables():void $this->assertSame(0, $result->invalidPhpdocs); $this->assertSame(0, $result->unknownTypes); $this->assertSame(4, $result->anonymousVariables); + $this->assertSame(0, $result->propertyTypeCoverage); + $this->assertSame(0, $result->paramTypeCoverage); + $this->assertSame(0, $result->returnTypeCoverage); + } + + function testSeaLevels():void + { + $analyzer = new BaselineAnalyzer(Baseline::forFile(__DIR__ . '/fixtures/sea-level.neon')); + $result = $analyzer->analyze(); + + $this->assertSame(3, $result->overallErrors); + $this->assertSame(0, $result->classesComplexity); + $this->assertSame(0, $result->deprecations); + $this->assertSame(0, $result->invalidPhpdocs); + $this->assertSame(0, $result->unknownTypes); + $this->assertSame(0, $result->anonymousVariables); + $this->assertSame(1, $result->propertyTypeCoverage); + $this->assertSame(27, $result->paramTypeCoverage); + $this->assertSame(4, $result->returnTypeCoverage); + } + + public function testSymplifyCompat() { + $this->assertSame( + BaselineAnalyzer::CLASS_COMPLEXITY_ERROR_MESSAGE, + ClassLikeCognitiveComplexityRule::ERROR_MESSAGE + ); + $this->assertSame( + BaselineAnalyzer::PROPERTY_TYPE_DEClARATION_SEA_LEVEL_MESSAGE, + PropertyTypeDeclarationSeaLevelRule::ERROR_MESSAGE + ); + $this->assertSame( + BaselineAnalyzer::PARAM_TYPE_DEClARATION_SEA_LEVEL_MESSAGE, + ParamTypeDeclarationSeaLevelRule::ERROR_MESSAGE + ); + $this->assertSame( + BaselineAnalyzer::RETURN_TYPE_DEClARATION_SEA_LEVEL_MESSAGE, + ReturnTypeDeclarationSeaLevelRule::ERROR_MESSAGE + ); } } diff --git a/vendor/staabm/phpstan-baseline-analysis/tests/GraphApplicationTest.php b/vendor/staabm/phpstan-baseline-analysis/tests/GraphApplicationTest.php index 1671f3d1c..462aed223 100644 --- a/vendor/staabm/phpstan-baseline-analysis/tests/GraphApplicationTest.php +++ b/vendor/staabm/phpstan-baseline-analysis/tests/GraphApplicationTest.php @@ -18,6 +18,8 @@ function testTextPrinting():void $exitCode = $app->start(__DIR__ . '/fixtures/graph*.json'); $rendered = ob_get_clean(); + // file_put_contents(__DIR__ . '/fixtures/graph.html.expected', $rendered); + // file_put_contents(__DIR__ . '/fixtures/graph.html', $rendered); $this->assertSame(file_get_contents(__DIR__ . '/fixtures/graph.html.expected'), $rendered); $this->assertSame(0, $exitCode); } diff --git a/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/all-in.neon b/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/all-in.neon index 95d4f2dc5..bb7c629a5 100644 --- a/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/all-in.neon +++ b/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/all-in.neon @@ -88,4 +88,19 @@ parameters: - message: "#^Anonymous variables in a \"\\$element\\-\\>value\\[0\\]\\-\\>\\.\\.\\.\" property fetch can lead to false dead property\\. Make sure the variable type is known$#" count: 3 - path: application/Rocket/lib/bulkConsumerCheckout/integration/VatValidationClient.php \ No newline at end of file + path: application/Rocket/lib/bulkConsumerCheckout/integration/VatValidationClient.php + + - + message: "#^Out of 1 possible property types, only 1 %% actually have it\\. Add more property types to get over 99 %%$#" + count: 1 + path: N/A + + - + message: "#^Out of 22 possible return types, only 4 %% actually have it\\. Add more return types to get over 99 %%$#" + count: 1 + path: N/A + + - + message: "#^Out of 33 possible param types, only 27 %% actually have it\\. Add more param types to get over 99 %%$#" + count: 1 + path: N/A diff --git a/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph-all-in.json b/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph-all-in.json index ea2d17c43..14b152693 100644 --- a/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph-all-in.json +++ b/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph-all-in.json @@ -1 +1 @@ -[{"all-in.neon":{"Date":"Sat, 01 Oct 2022 10:44:28 +0000","Overall-Errors":35,"Classes-Cognitive-Complexity":70,"Deprecations":2,"Invalid-Phpdocs":5,"Unknown-Types":1,"Anonymous-Variables":4}}] \ No newline at end of file +[{"all-in.neon":{"Date":"Sat, 01 Oct 2022 10:44:28 +0000","Overall-Errors":35,"Classes-Cognitive-Complexity":70,"Deprecations":2,"Invalid-Phpdocs":5,"Unknown-Types":1,"Anonymous-Variables":4,"Native-Property-Type-Coverage":1,"Native-Param-Type-Coverage":27,"Native-Return-Type-Coverage":4}}] \ No newline at end of file diff --git a/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph.html b/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph.html new file mode 100644 index 000000000..6bc8af1d8 --- /dev/null +++ b/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph.html @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph.html.expected b/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph.html.expected index 9f8d3f606..6bc8af1d8 100644 --- a/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph.html.expected +++ b/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/graph.html.expected @@ -11,17 +11,34 @@ const ctx = document.getElementById('chartContainerb56ee3eb73cd65912b11edba59cc68c2'); const chart = new Chart(ctx, { type: 'line', - options: { + options: { plugins: { title: { display: true, text: 'PHPStan Baseline Analysis all-in.neon', } + }, + scales: { + x: { + beginAtZero: true, + }, + y: { + beginAtZero: true, + }, + yPercent: { + min: 0, + max: 100, + beginAtZero: true, + position: 'right', + grid: { + display: false, + }, + }, } }, data: { labels: [new Date(1664621068 * 1000).toLocaleDateString("de-DE")], - datasets: [{"label":"Overall-Errors","borderColor":"blue","data":[35]},{"label":"Classes-Cognitive-Complexity","borderColor":"#C24642","data":[70]},{"label":"Deprecations","borderColor":"lightgreen","data":[2]},{"label":"Invalid-Phpdocs","borderColor":"lightblue","data":[5]},{"label":"Unknown-Types","borderColor":"purple","data":[1]},{"label":"Anonymous-Variables","borderColor":"pink","data":[4]}] + datasets: [{"label":"Overall-Errors","borderColor":"blue","data":[35]},{"label":"Classes-Cognitive-Complexity","borderColor":"#C24642","data":[70]},{"label":"Deprecations","borderColor":"lightgreen","data":[2]},{"label":"Invalid-Phpdocs","borderColor":"lightblue","data":[5]},{"label":"Unknown-Types","borderColor":"purple","data":[1]},{"label":"Anonymous-Variables","borderColor":"pink","data":[4]},{"label":"Native-Property-Type-Coverage","yAxisID":"yPercent","borderColor":"lightcoral","borderWidth":2,"type":"bar","data":[1]},{"label":"Native-Param-Type-Coverage","yAxisID":"yPercent","borderColor":"lightseagreen","borderWidth":2,"type":"bar","data":[27]},{"label":"Native-Return-Type-Coverage","yAxisID":"yPercent","borderColor":"lightsteelblue","borderWidth":2,"type":"bar","data":[4]}] } }); })(); @@ -33,17 +50,34 @@ const ctx = document.getElementById('chartContainer7b39166f92c8f32388d25c18147b8f5d'); const chart = new Chart(ctx, { type: 'line', - options: { + options: { plugins: { title: { display: true, text: 'PHPStan Baseline Analysis anonymous-variables.neon', } + }, + scales: { + x: { + beginAtZero: true, + }, + y: { + beginAtZero: true, + }, + yPercent: { + min: 0, + max: 100, + beginAtZero: true, + position: 'right', + grid: { + display: false, + }, + }, } }, data: { labels: [new Date(1664620967 * 1000).toLocaleDateString("de-DE")], - datasets: [{"label":"Overall-Errors","borderColor":"blue","data":[4]},{"label":"Classes-Cognitive-Complexity","borderColor":"#C24642","data":[0]},{"label":"Deprecations","borderColor":"lightgreen","data":[0]},{"label":"Invalid-Phpdocs","borderColor":"lightblue","data":[0]},{"label":"Unknown-Types","borderColor":"purple","data":[0]},{"label":"Anonymous-Variables","borderColor":"pink","data":[4]}] + datasets: [{"label":"Overall-Errors","borderColor":"blue","data":[4]},{"label":"Classes-Cognitive-Complexity","borderColor":"#C24642","data":[0]},{"label":"Deprecations","borderColor":"lightgreen","data":[0]},{"label":"Invalid-Phpdocs","borderColor":"lightblue","data":[0]},{"label":"Unknown-Types","borderColor":"purple","data":[0]},{"label":"Anonymous-Variables","borderColor":"pink","data":[4]},{"label":"Native-Property-Type-Coverage","yAxisID":"yPercent","borderColor":"lightcoral","borderWidth":2,"type":"bar","data":[0]},{"label":"Native-Param-Type-Coverage","yAxisID":"yPercent","borderColor":"lightseagreen","borderWidth":2,"type":"bar","data":[0]},{"label":"Native-Return-Type-Coverage","yAxisID":"yPercent","borderColor":"lightsteelblue","borderWidth":2,"type":"bar","data":[0]}] } }); })(); diff --git a/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/sea-level.neon b/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/sea-level.neon new file mode 100644 index 000000000..1df98176e --- /dev/null +++ b/vendor/staabm/phpstan-baseline-analysis/tests/fixtures/sea-level.neon @@ -0,0 +1,16 @@ +parameters: + ignoreErrors: + - + message: "#^Out of 1 possible property types, only 1 %% actually have it\\. Add more property types to get over 99 %%$#" + count: 1 + path: N/A + + - + message: "#^Out of 22 possible return types, only 4 %% actually have it\\. Add more return types to get over 99 %%$#" + count: 1 + path: N/A + + - + message: "#^Out of 33 possible param types, only 27 %% actually have it\\. Add more param types to get over 99 %%$#" + count: 1 + path: N/A