-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphpstan.neon.dist
104 lines (103 loc) · 4.87 KB
/
phpstan.neon.dist
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
includes:
- phpstan-baseline.neon
parameters:
paths:
- api
- Civi
- CRM
- managed
- services
- tests
# funding.php currently fails with 'Internal error: Class "CRM_Core_Page" not found while analysing file'
#- funding.php
excludePaths:
analyse:
- CRM/Funding/DAO/*
- tests/phpunit/bootstrap.php
scanFiles:
- funding.civix.php
- tools/phpunit/vendor/bin/.phpunit/phpunit/src/Framework/TestCase.php
scanDirectories:
- tools/phpunit/vendor/bin/.phpunit/phpunit/src/Framework
- ../activity-entity/Civi/
- ../de.systopia.civioffice/Civi/
- ../de.systopia.civioffice/CRM/
- ../de.systopia.remotetools/Civi/
- ../external-file/Civi/
bootstrapFiles:
- tools/phpunit/vendor/bin/.phpunit/phpunit/vendor/autoload.php
- phpstanBootstrap.php
level: 9
universalObjectCratesClasses:
- Civi\Core\Event\GenericHookEvent
- CRM_Core_Config
- CRM_Core_DAO
checkTooWideReturnTypesInProtectedAndPublicMethods: true
checkUninitializedProperties: true
checkMissingCallableSignature: true
treatPhpDocTypesAsCertain: false
exceptions:
check:
missingCheckedExceptionInThrows: true
tooWideThrowType: true
checkedExceptionClasses:
- \Webmozart\Assert\InvalidArgumentException
implicitThrows: false
ignoreErrors:
# Note paths are prefixed with "*/" to work with inspections in PHPStorm because of:
# https://youtrack.jetbrains.com/issue/WI-63891/PHPStan-ignoreErrors-configuration-isnt-working-with-inspections
- '#^Method CRM_Funding_Page_[^\s]+::getController\(\) should return Civi\\Funding\\Controller\\PageControllerInterface but returns mixed.$#'
- '#^Method Civi\\Funding\\FundingCaseTypeServiceLocator::[^\s]+ should return [^\s]+ but returns mixed.$#'
-
message: '#has an uninitialized property#'
paths:
- */Civi/Funding/Event/*.php
- */Civi/RemoteTools/Event/*.php
-
message: '#^Access to an undefined property Civi\\Api4\\Generic\\AbstractAction::\$_eventDispatcher.$#'
path: */Civi/RemoteTools/Api4/Action/Traits/EventActionTrait.php
- '#^Class Civi\\Funding\\Api4\\Action\\[^\s]+Action(Legacy)? has an uninitialized property \$[^\s]+\. Give it default value or assign it in the constructor.$#'
- '/^Parameter #1 \$items \(array<int, array<string, mixed>>\) of method Civi\\Funding\\Api4\\Action\\[^\s]+::writeObjects\(\) should be contravariant with parameter \$items \(array\) of method Civi\\Api4\\Generic\\[^\s]+::writeObjects\(\)$/'
# For actions that are fetched from container
-
message: '#^Cannot call method setCheckPermissions\(\) on mixed.$#'
path: */Civi/Api4/*.php
- '#^Method Civi\\Api4\\[^\\]+::[^(]+\(\) should return Civi\\[^\s]+\\[^\s]+Action but returns mixed.$#'
- '#^Access to an uninitialized property Civi\\Funding\\Event\\[^\s]+Event::\$[^\s]+.$#'
-
message: '#^PHPDoc tag @var for constant [^\s]+::[^\s]+ with type string is incompatible with value null.$#'
path: */Civi/RemoteTools/EventSubscriber/Abstract*.php
-
message: '#^Variable property access on \$this\(Civi\\RemoteTools\\Event\\AbstractRequestEvent\).$#'
path: */Civi/RemoteTools/Event/AbstractRequestEvent.php
# Wrong type hint
- '#^Property Civi\\Api4\\Generic\\Result::\$rowCount \(int\) on left side of \?\? is not nullable.$#'
- '#^Method Civi\\RemoteTools\\Event\\GetEvent::addClause\(\) has parameter \$conditions with no value type specified in iterable type array.$#'
- '#^Property Civi\\RemoteTools\\Event\\DAOGetEvent::\$join type has no value type specified in iterable type array.$#'
- '#^Method Civi\\RemoteTools\\Event\\DAOGetEvent::addJoin\(\) has parameter \$conditions with no value type specified in iterable type array.$#'
- '#^Method Civi\\RemoteTools\\Event\\DAOGetEvent::getJoin\(\) return type has no value type specified in iterable type array.$#'
- '#^Property Civi\\Api4\\Generic\\Result::\$debug \(array\) on left side of \?\? is not nullable.$#'
-
message: '#^Call to function method_exists\(\) with .+ will always evaluate to true.$#'
path: */tests/phpunit/**/EventSubscriber/*SubscriberTest.php
- # Accessing results of API requests
message: "#^Offset '[^']+' does not exist on array\\|null.$#"
path: */tests/phpunit/Civi/**/*Test.php
-
message: '#^Class [^\s]+ has an uninitialized property#'
path : */tests/phpunit/Civi/Funding/Mock/**/*.php
- '#^Method Civi\\Funding\\Fixtures\\[^\s]+Fixture::[^\s]+\(\) should return array{[^}]+} but returns array\|null.$#'
-
identifier: return.type
path: */tests/phpunit/Civi/Funding/Fixtures/*.php
- '#^In method "Civi\\[^\s]+Test::[^\s]+", caught "Exception" must be rethrown.#'
-
message: "#^Cannot access offset '.+' on mixed.$#"
path: */tests/phpunit/Civi/**/*Test.php
-
message: '#has an uninitialized property \$[^\s]+. Give it default value or assign it in the constructor.$#'
path: */tests/phpunit/Civi/*
-
message: '#^Access to an uninitialized property #'
path: */tests/phpunit/Civi/**/*Test.php
tmpDir: .phpstan