forked from phpseclib/bcmath_compat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpstan.neon.dist
More file actions
70 lines (70 loc) · 3.24 KB
/
Copy pathphpstan.neon.dist
File metadata and controls
70 lines (70 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
parameters:
level: max
reportUnmatchedIgnoredErrors: false
paths:
- src
- tests
- lib
excludePaths:
- tests/php-src
ignoreErrors:
-
identifier: expr.resultUnused
path: tests/BCMathWithoutExtensionTest.php
# Rector 2.4+ ships a scoped polyfill at
# vendor/rector/rector/vendor/symfony/polyfill-php84/Resources/RoundingMode.php
# that registers a global `class RoundingMode` with string constants
# (e.g. HalfAwayFromZero = 'halfawayfromzero') via class_alias. PHPStan's
# Better Reflection walks vendor recursively and binds `\RoundingMode` to
# that class instead of our enum polyfill in lib/RoundingMode.php, so
# references to `\RoundingMode::HalfAwayFromZero` are typed as string
# rather than as an enum case. At runtime the enum in lib/RoundingMode.php
# wins because it is loaded via composer files autoload before Rector's
# autoload has any chance to run for the global name (and our tests
# confirm the enum is the one in use). These errors are purely a
# static-analysis artifact. See https://github.com/nanasess/bcmath-polyfill/issues/56
-
identifier: match.alwaysFalse
path: src/BCMath.php
message: "#Match arm comparison between RoundingMode and '(halfawayfromzero|halftowardszero|halfeven|halfodd|towardszero|awayfromzero|negativeinfinity|positiveinfinity)' is always false\\.#"
-
identifier: argument.type
message: "#Parameter \\#3 \\$mode of (static method bcmath_compat\\\\BCMath::round\\(\\)|function bcround) expects (int\\|RoundingMode|RoundingMode), (string|int) given\\.#"
paths:
- src/BCMath.php
- tests/BCMathTest.php
- tests/BCMathWithoutExtensionTest.php
-
identifier: return.type
path: tests/BCMathTest.php
message: "#Method BCMathTest::provideRoundingModeEnumSupportCases\\(\\).*RoundingMode.*#"
-
identifier: function.impossibleType
path: tests/BCMathTest.php
message: "#Call to function in_array\\(\\) with arguments RoundingMode, array\\{.*\\} and true will always evaluate to false\\.#"
# PHPStan binds `\RoundingMode` to Rector's scoped polyfill class (not an
# enum), so `enum_exists('RoundingMode')` is statically inferred as always
# false. At runtime our enum polyfill in lib/RoundingMode.php is the one in
# use, so these guards are legitimate. Same static-analysis artifact as above.
-
identifier: function.impossibleType
message: "#Call to function enum_exists\\(\\) with 'RoundingMode' will always evaluate to false\\.#"
paths:
- src/BCMath.php
- tests/BCMathTest.php
- tests/fixtures/clean-load.php
-
identifier: encapsedStringPart.nonString
path: tests/BCMathTest.php
message: "#Part \\$\\w+->name \\(mixed\\) of encapsed string cannot be cast to string\\.#"
-
identifier: property.nonObject
path: tests/BCMathTest.php
message: "#Cannot access property \\$name on string\\.#"
# On PHP 8.1 PHPStan narrows $function to the six non-pow operations and
# reports this in_array() guard as always-true, while PHP 8.5 does not.
# The guard deliberately excludes bcpow() from the second-argument check,
# so it must stay. Pre-existing on main; ignored to keep the 8.1 matrix green.
-
path: tests/BCMathTest.php
message: "#Call to function in_array\\(\\) with arguments .* and true will always evaluate to true\\.#"