Skip to content

Commit

Permalink
Added phpstan/phpstan-deprecation-rules (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored Oct 9, 2024
1 parent 1870979 commit 7ec3a3f
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"require-dev": {
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpunit/phpunit": "^9.6",
"symfony/var-dumper": "^5.3",
"thecodingmachine/phpstan-safe-rule": "^1.2",
Expand All @@ -39,6 +40,7 @@
},
"scripts": {
"phpstan": "phpstan analyze",
"phpstan-baseline": "phpstan analyse -c phpstan.neon.dist --generate-baseline || true",
"test": "phpunit"
},
"bin": [
Expand Down
2 changes: 1 addition & 1 deletion lib/FilterApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private function printResult(array $errors): void
'parameters' => [
'ignoreErrors' => $ignoreErrors,
],
], Neon::BLOCK);
], true);

if (substr($neon, -2) !== "\n\n") {
throw new ShouldNotHappenException();
Expand Down
49 changes: 49 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
parameters:
ignoreErrors:
-
message: """
#^Call to deprecated function Safe\\\\sprintf\\(\\)\\:
The Safe version of this function is no longer needed in PHP 8\\.0\\+$#
"""
count: 1
path: bin/phpstan-baseline-trend.php

-
message: """
#^Call to deprecated function Safe\\\\substr\\(\\)\\:
The Safe version of this function is no longer needed in PHP 8\\.0\\+$#
"""
count: 1
path: bin/phpstan-baseline-trend.php

-
message: """
#^Call to deprecated function Safe\\\\sprintf\\(\\)\\:
The Safe version of this function is no longer needed in PHP 8\\.0\\+$#
"""
count: 3
path: lib/Baseline.php

-
message: """
#^Call to deprecated function Safe\\\\substr\\(\\)\\:
The Safe version of this function is no longer needed in PHP 8\\.0\\+$#
"""
count: 2
path: lib/FilterApplication.php

-
message: """
#^Call to deprecated function Safe\\\\substr\\(\\)\\:
The Safe version of this function is no longer needed in PHP 8\\.0\\+$#
"""
count: 2
path: lib/FilterConfig.php

-
message: """
#^Call to deprecated function Safe\\\\sprintf\\(\\)\\:
The Safe version of this function is no longer needed in PHP 8\\.0\\+$#
"""
count: 12
path: lib/ResultPrinter.php
4 changes: 4 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
includes:
- phpstan-baseline.neon

parameters:
level: max
reportUnmatchedIgnoredErrors: false

paths:
- bin/
Expand Down

0 comments on commit 7ec3a3f

Please sign in to comment.