-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpstan.php
More file actions
58 lines (57 loc) · 2.68 KB
/
Copy pathphpstan.php
File metadata and controls
58 lines (57 loc) · 2.68 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
<?php
return [
'parameters' => [
'level' => 5,
'paths' => [__DIR__.'/src', __DIR__.'/tests'],
'excludePaths' => [
'analyseAndScan' => [
__DIR__.'/vendor/*',
],
],
'ignoreErrors' => [
// Deliberate defensive validation. These methods accept `mixed` at
// runtime (untyped params) and throw InvalidArgumentException for
// wrong types — the PSR-7 v2 interface / PHPDoc types the argument
// as string, so PHPStan considers the runtime guard redundant. The
// guards are intentional and asserted by the test suite (e.g.
// getHeader(123) must throw), so they stay.
[
'message' => '#Call to function is_(string|scalar|int)\(\) with .+ will always evaluate to true\.#',
'paths' => [
__DIR__.'/src/Http/MessageTrait.php',
__DIR__.'/src/Http/UploadedFile.php',
__DIR__.'/src/Http/Uri.php',
],
'reportUnmatched' => false,
],
// UploadedFile constructor validates its untyped args against the
// "@param int" contract; the is_int guard reads as always-true.
[
'message' => '#Strict comparison using === between false and true will always evaluate to false\.#',
'path' => __DIR__.'/src/Http/UploadedFile.php',
'reportUnmatched' => false,
],
[
'message' => '#Result of && is always false\.#',
'path' => __DIR__.'/src/Http/UploadedFile.php',
'reportUnmatched' => false,
],
// withParsedBody validates beyond the PSR "@param null|array|object"
// contract (rejects strings/ints at runtime); the extra guard reads
// as always-false to PHPStan.
[
'message' => '#(Result of && is always false|Strict comparison using !== between null and null will always evaluate to false)\.#',
'path' => __DIR__.'/src/Http/ServerRequest.php',
'reportUnmatched' => false,
],
// Stream::getContents() uses the upstream nyholm error-handler trick;
// $exception is assigned inside the handler, so the catch comparison
// is correct even though PHPStan cannot follow the by-ref capture.
[
'message' => '#Strict comparison using === between Throwable and null will always evaluate to false\.#',
'path' => __DIR__.'/src/Http/Stream.php',
'reportUnmatched' => false,
],
],
],
];