forked from syntro-opensource/silverstripe-phpstan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpstan.neon
110 lines (105 loc) · 4.78 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
parameters:
bootstrapFiles:
- bootstrap.php
earlyTerminatingMethodCalls:
SilverStripe\Control\Controller:
- redirect
universalObjectCratesClasses:
- SilverStripe\View\ArrayData
- SilverStripe\Core\Config\Config_ForClass
- SilverStripe\Forms\GridField\GridState_Data
- SilverStripe\ORM\DataObject
- SilverStripe\ORM\DataObjectInterface
- Symbiote\QueuedJobs\Services\AbstractQueuedJob # symbiote/silverstripe-queuedjobs module support
excludePaths:
- silverstripe-cache
services:
# This adds additional methods from SilverStripe extensions, as well as determining proper
# types when has_one() magic methods.
-
class: Syntro\SilverstripePHPStan\Reflection\MethodClassReflectionExtension
tags:
- phpstan.broker.methodsClassReflectionExtension
# This adds additional properties from 'db', 'has_one' and other config fields to
# determine what types are returned for magic __get's
-
class: Syntro\SilverstripePHPStan\Reflection\PropertyClassReflectionExtension
tags:
- phpstan.broker.propertiesClassReflectionExtension
# This adds additional type info to `DataObject::get()` so that it knows what class
# while be returned when iterating.
-
class: Syntro\SilverstripePHPStan\Type\DataObjectGetStaticReturnTypeExtension
tags:
- phpstan.broker.dynamicStaticMethodReturnTypeExtension
# This allows `singleton("File")` calls to understand the exact classes being returned
# by using your configuration. (ie. uses Injector information if it's set)
-
class: Syntro\SilverstripePHPStan\Type\SingletonReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
# This allows `Injector::inst()->get("File")` calls to understand the exact classes being returned
# by using your configuration. (ie. uses Injector information if it's set)
-
class: Syntro\SilverstripePHPStan\Type\InjectorReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension
# This allows `$this->getOwner()` to understand the possible types that it could
# return by seeing what classes are using that extension currently.
-
class: Syntro\SilverstripePHPStan\Type\ExtensionReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension
# This makes a DataList keep it's current type information as-is when calling
# certain functions. (So it still knows its a DataList of SiteTree objects for example)
#
# This will also allow "first"/"last" calls and similar to return the correct type.
#
-
class: Syntro\SilverstripePHPStan\Type\DataListReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension
# This makes calls to `dbObject` and `newClassInstance` return the correct type info
-
class: Syntro\SilverstripePHPStan\Type\DataObjectReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension
-
class: Syntro\SilverstripePHPStan\Type\FormFieldReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension
# This makes calls to `DBField::create_field('HTMLText', $value)` return the correct type info
# ie. The injectored type of the first parameter
-
class: Syntro\SilverstripePHPStan\Type\DBFieldStaticReturnTypeExtension
tags:
- phpstan.broker.dynamicStaticMethodReturnTypeExtension
# Special handling for ->hasMethod() checks
-
class: Syntro\SilverstripePHPStan\Type\HasMethodTypeSpecifyingExtension
tags:
- phpstan.typeSpecifier.methodTypeSpecifyingExtension
# Rule informing the user to add the @config docblock
-
class: Syntro\SilverstripePHPStan\Rule\ReadWriteConfigPropertiesRule
arguments:
alwaysWrittenTags: %propertyAlwaysWrittenTags%
alwaysReadTags: %propertyAlwaysReadTags%
checkUninitializedProperties: %checkUninitializedProperties%
tags:
- phpstan.rules.rule
# Special handling for configuration properties
-
class: Syntro\SilverstripePHPStan\Reflection\ReadWritePropertiesExtension
tags:
- phpstan.properties.readWriteExtension
# hasExtension() check adds Extension Methods
-
class: Syntro\SilverstripePHPStan\Type\HasExtensionMethodTypeSpecifier
tags:
- phpstan.typeSpecifier.methodTypeSpecifyingExtension
# has_extension() check adds Extension Methods
-
class: Syntro\SilverstripePHPStan\Type\HasExtensionFunctionTypeSpecifier
tags:
- phpstan.typeSpecifier.functionTypeSpecifyingExtension