forked from nuwave/lighthouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpstan.neon
89 lines (73 loc) · 4.1 KB
/
phpstan.neon
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
includes:
- vendor/bensampo/laravel-enum/extension.neon
- vendor/nesbot/carbon/extension.neon
- vendor/nunomaduro/larastan/extension.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
- vendor/phpstan/phpstan-mockery/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
parameters:
# TODO level up to max
level: 8
stubFiles:
- _ide_helper.php
paths:
- benchmarks
- src
- tests
checkOctaneCompatibility: true
# TODO reenable once we require Laravel 9+
checkGenericClassInNonGenericObjectType: false
excludePaths:
# Indirectly refers to \App\User (maybe through larastan?)
- tests/Utils/Models/User.php
# Intentionally wrong
- tests/Utils/Models/WithoutRelationClassImport.php
# Breaking changes in bensampo/laravel-enum
- tests/Integration/Schema/Types/LaravelEnumTypeDBTest.php
- tests/Integration/Schema/Types/PreLaravel9LaravelEnumTypeDBTest.php
- tests/Utils/Models/WithEnum.php
- tests/Utils/Models/PreLaravel9WithEnum.php
# As long as we support multiple Laravel versions at once, there will be some dead spots
reportUnmatchedIgnoredErrors: false
ignoreErrors:
# PHPStan does not get it
- '#Parameter \#1 \$callback of static method Closure::fromCallable\(\) expects callable\(\): mixed, array{object, .*} given\.#'
# Some parts of Laravel are just really magical
- '#Parameter \#1 \$response of static method Nuwave\\Lighthouse\\Testing\\TestResponseUtils::extractValidationErrors\(\) expects Illuminate\\Testing\\TestResponse, \$this\(Nuwave\\Lighthouse\\Testing\\TestResponseMixin\) given\.#'
- path: tests/database/factories/*
message: '#Variable \$factory might not be defined#'
- '#Function factory invoked with 2 parameters, 0 required\.#'
- '#Function factory invoked with 1 parameter, 0 required\.#'
# Mixins are magical
- path: src/Testing/TestResponseMixin.php
message: '#Method Nuwave\\Lighthouse\\Testing\\TestResponseMixin::assertGraphQLErrorMessage\(\) invoked with 1 parameter, 0 required\.#'
- path: src/Testing/TestResponseMixin.php
message: '#Method Nuwave\\Lighthouse\\Testing\\TestResponseMixin::assertGraphQLDebugMessage\(\) invoked with 1 parameter, 0 required\.#'
- path: src/Testing/TestResponseMixin.php
message: '#Anonymous function should return Illuminate\\Testing\\TestResponse but returns .*#'
- path: tests/*
message: '#Call to an undefined method Illuminate\\Testing\\TestResponse::.*#'
# This test cheats and uses reflection to make assertions
- path: tests/Unit/Schema/Directives/BaseDirectiveTest.php
message: '#Call to protected method getModelClass\(\) of class Nuwave\\Lighthouse\\Schema\\Directives\\BaseDirective\.#'
# This class or an equivalent of it will be present in a Laravel install
- '#.* unknown class App\\User\.#'
# This is a library, so it should be extendable
- '#Unsafe usage of new static.*#'
# This really has no type in root resolvers
- '#Method .* has parameter \$root with no type specified\.#'
- '#Method .* has parameter \$root with no typehint specified\.#'
# PHPStan and PHPUnit disagree with themselves
- '#Unable to resolve the template type ExpectedType in call to method PHPUnit\\Framework\\Assert::assertSame\(\)#'
# Ease transition for non-nullable properties towards native types https://github.com/phpstan/phpstan/issues/5150
- '#Property .* in isset\(\) is not nullable\.#'
# Unavailable in thecodingmachine/safe:1
- '#Function (hrtime) is unsafe to use\. It can return FALSE instead of throwing an exception\.#'
# Unavailable in thecodingmachine/safe:2
- '#Function (sort|substr|ksort) is unsafe to use\. It can return FALSE instead of throwing an exception\.#'
# Lumen type hints are just wrong
- '#Parameter \#1 \$content of function response expects string, .* given\.#'
# Seems like a bug in PHPStan
- '#Parameter \#2 \$type of method Nuwave\\Lighthouse\\Schema\\TypeRegistry::.+Lazy\(\) expects callable\(\): GraphQL\\Type\\Definition\\Type&GraphQL\\Type\\Definition\\NamedType, Closure\(\): GraphQL\\Type\\Definition\\ObjectType given\.#'