From 8abfb07dc1263fa936c16bafa90e3dc91bca1397 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 14 Oct 2024 09:36:15 +0200 Subject: Use recommended phpstan.dist.neon (#6892) * Rename to phpstan.dist.neon * gitignore phpstan.neon * Update phpstan-next accordingly * Fixes for PHPStan bleedingEdge --- .gitignore | 1 + composer.lock | 34 ++++++++++++++--------------- phpstan-next.neon | 2 +- phpstan.dist.neon | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ phpstan.neon | 65 ------------------------------------------------------- 5 files changed, 84 insertions(+), 83 deletions(-) create mode 100644 phpstan.dist.neon delete mode 100644 phpstan.neon diff --git a/.gitignore b/.gitignore index ef4138383..bc1b350dd 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /extensions/node_modules/ /extensions/vendor/ /node_modules/ +/phpstan.neon /vendor/ .vscode/ diff --git a/composer.lock b/composer.lock index 37357856f..ffba9fd8d 100644 --- a/composer.lock +++ b/composer.lock @@ -69,16 +69,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.1.0", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { @@ -121,9 +121,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" }, - "time": "2024-07-01T20:03:41+00:00" + "time": "2024-10-08T18:51:32+00:00" }, { "name": "phar-io/manifest", @@ -245,16 +245,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.5", + "version": "1.12.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17" + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", - "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc4d2f145a88ea7141ae698effd64d9df46527ae", + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae", "shasum": "" }, "require": { @@ -299,7 +299,7 @@ "type": "github" } ], - "time": "2024-09-26T12:45:22+00:00" + "time": "2024-10-06T15:03:59+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -725,16 +725,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.34", + "version": "10.5.36", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3c69d315bdf79080c8e115b69d1961c6905b0e18" + "reference": "aa0a8ce701ea7ee314b0dfaa8970dc94f3f8c870" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3c69d315bdf79080c8e115b69d1961c6905b0e18", - "reference": "3c69d315bdf79080c8e115b69d1961c6905b0e18", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/aa0a8ce701ea7ee314b0dfaa8970dc94f3f8c870", + "reference": "aa0a8ce701ea7ee314b0dfaa8970dc94f3f8c870", "shasum": "" }, "require": { @@ -806,7 +806,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.34" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.36" }, "funding": [ { @@ -822,7 +822,7 @@ "type": "tidelift" } ], - "time": "2024-09-13T05:19:38+00:00" + "time": "2024-10-08T15:36:51+00:00" }, { "name": "sebastian/cli-parser", diff --git a/phpstan-next.neon b/phpstan-next.neon index 5593c6049..4899712fb 100644 --- a/phpstan-next.neon +++ b/phpstan-next.neon @@ -1,5 +1,5 @@ includes: - - phpstan.neon + - phpstan.dist.neon - vendor/phpstan/phpstan/conf/bleedingEdge.neon parameters: diff --git a/phpstan.dist.neon b/phpstan.dist.neon new file mode 100644 index 000000000..994ee6aec --- /dev/null +++ b/phpstan.dist.neon @@ -0,0 +1,65 @@ +parameters: + level: 9 # https://phpstan.org/user-guide/rule-levels + fileExtensions: + - php + - phtml + paths: + - . + excludePaths: + analyse: + - lib/marienfressinaud/* + - lib/phpgt/* + - lib/phpmailer/* + - lib/simplepie/* + - vendor/* + analyseAndScan: + - .git/*? + - extensions/node_modules? + - extensions/symbolic? + - extensions/vendor? + - node_modules/*? + bootstrapFiles: + - cli/_cli.php + - lib/favicons.php + dynamicConstantNames: + - CACHE_PATH + - COPY_LOG_TO_SYSLOG + - COPY_SYSLOG_TO_STDERR + - DATA_PATH + - MAX_LOG_SIZE + - PUBLIC_RELATIVE + - SIMPLEPIE_SYSLOG_ENABLED + - STDERR + - STDOUT + - TMP_PATH + - USERS_PATH + checkMissingOverrideMethodAttribute: true + reportMaybesInPropertyPhpDocTypes: false + treatPhpDocTypesAsCertain: false + strictRules: + allRules: false + booleansInConditions: true + closureUsesThis: true + disallowedConstructs: false + disallowedLooseComparison: false + matchingInheritedMethodNames: true + noVariableVariables: true + numericOperandsInArithmeticOperators: true + overwriteVariablesWithLoop: true + requireParentConstructorCall: true + strictCalls: true + switchConditionsMatchingType: true + uselessCast: true + exceptions: + check: + missingCheckedExceptionInThrows: false # TODO pass + tooWideThrowType: true + implicitThrows: false + checkedExceptionClasses: + - 'Minz_Exception' + ignoreErrors: + - '#Only booleans are allowed in (a negated boolean|a ternary operator condition|an elseif condition|an if condition|&&|\|\|), (bool|false|int(<[0-9, max]+>)?|true|null|\|)+ given.*#' +includes: + - vendor/phpstan/phpstan-phpunit/extension.neon + - vendor/phpstan/phpstan-phpunit/rules.neon + - vendor/phpstan/phpstan-strict-rules/rules.neon diff --git a/phpstan.neon b/phpstan.neon deleted file mode 100644 index 793403c42..000000000 --- a/phpstan.neon +++ /dev/null @@ -1,65 +0,0 @@ -parameters: - level: 9 # https://phpstan.org/user-guide/rule-levels - fileExtensions: - - php - - phtml - paths: - - . - excludePaths: - analyse: - - lib/marienfressinaud/* - - lib/phpgt/* - - lib/phpmailer/* - - lib/simplepie/* - - vendor/* - analyseAndScan: - - .git/* - - extensions/node_modules - - extensions/symbolic - - extensions/vendor - - node_modules/* - bootstrapFiles: - - cli/_cli.php - - lib/favicons.php - dynamicConstantNames: - - CACHE_PATH - - COPY_LOG_TO_SYSLOG - - COPY_SYSLOG_TO_STDERR - - DATA_PATH - - MAX_LOG_SIZE - - PUBLIC_RELATIVE - - SIMPLEPIE_SYSLOG_ENABLED - - STDERR - - STDOUT - - TMP_PATH - - USERS_PATH - checkMissingOverrideMethodAttribute: true - reportMaybesInPropertyPhpDocTypes: false - treatPhpDocTypesAsCertain: false - strictRules: - allRules: false - booleansInConditions: true - closureUsesThis: true - disallowedConstructs: false - disallowedLooseComparison: false - matchingInheritedMethodNames: true - noVariableVariables: true - numericOperandsInArithmeticOperators: true - overwriteVariablesWithLoop: true - requireParentConstructorCall: true - strictCalls: true - switchConditionsMatchingType: true - uselessCast: true - exceptions: - check: - missingCheckedExceptionInThrows: false # TODO pass - tooWideThrowType: true - implicitThrows: false - checkedExceptionClasses: - - 'Minz_Exception' - ignoreErrors: - - '#Only booleans are allowed in (a negated boolean|a ternary operator condition|an elseif condition|an if condition|&&|\|\|), (bool|false|int(<[0-9, max]+>)?|true|null|\|)+ given.*#' -includes: - - vendor/phpstan/phpstan-phpunit/extension.neon - - vendor/phpstan/phpstan-phpunit/rules.neon - - vendor/phpstan/phpstan-strict-rules/rules.neon -- cgit v1.2.3