|
39 | 39 | // are treated as if they can cast to each other. |
40 | 40 | 'scalar_implicit_cast' => false, |
41 | 41 |
|
| 42 | + // If this has entries, scalars (int, float, bool, string, null) |
| 43 | + // are allowed to perform the casts listed. |
| 44 | + // E.g. ['int' => ['float', 'string'], 'float' => ['int'], 'string' => ['int'], 'null' => ['string']] |
| 45 | + // allows casting null to a string, but not vice versa. |
| 46 | + // (subset of scalar_implicit_cast) |
| 47 | + 'scalar_implicit_partial' => [], |
| 48 | + |
42 | 49 | // If true, seemingly undeclared variables in the global |
43 | 50 | // scope will be ignored. This is useful for projects |
44 | 51 | // with complicated cross-file globals that you have no |
|
48 | 55 | // Backwards Compatibility Checking |
49 | 56 | 'backward_compatibility_checks' => false, |
50 | 57 |
|
| 58 | + // If true, check to make sure the return type declared |
| 59 | + // in the doc-block (if any) matches the return type |
| 60 | + // declared in the method signature. This process is |
| 61 | + // slow. |
| 62 | + 'check_docblock_signature_return_type_match' => true, |
| 63 | + |
| 64 | + // If true, check to make sure the return type declared |
| 65 | + // in the doc-block (if any) matches the return type |
| 66 | + // declared in the method signature. This process is |
| 67 | + // slow. |
| 68 | + 'check_docblock_signature_param_type_match' => true, |
| 69 | + |
| 70 | + // (*Requires check_docblock_signature_param_type_match to be true*) |
| 71 | + // If true, make narrowed types from phpdoc params override |
| 72 | + // the real types from the signature, when real types exist. |
| 73 | + // (E.g. allows specifying desired lists of subclasses, |
| 74 | + // or to indicate a preference for non-nullable types over nullable types) |
| 75 | + // Affects analysis of the body of the method and the param types passed in by callers. |
| 76 | + 'prefer_narrowed_phpdoc_param_type' => true, |
| 77 | + |
| 78 | + // (*Requires check_docblock_signature_return_type_match to be true*) |
| 79 | + // If true, make narrowed types from phpdoc returns override |
| 80 | + // the real types from the signature, when real types exist. |
| 81 | + // (E.g. allows specifying desired lists of subclasses, |
| 82 | + // or to indicate a preference for non-nullable types over nullable types) |
| 83 | + // Affects analysis of return statements in the body of the method and the return types passed in by callers. |
| 84 | + 'prefer_narrowed_phpdoc_return_type' => true, |
| 85 | + |
51 | 86 | // If enabled, check all methods that override a |
52 | 87 | // parent method to make sure its signature is |
53 | 88 | // compatible with the parent's. This check |
54 | 89 | // can add quite a bit of time to the analysis. |
| 90 | + // This will also check if final methods are overridden, etc. |
55 | 91 | 'analyze_signature_compatibility' => true, |
56 | 92 |
|
| 93 | + // This setting maps case insensitive strings to union types. |
| 94 | + // This is useful if a project uses phpdoc that differs from the phpdoc2 standard. |
| 95 | + // If the corresponding value is the empty string, Phan will ignore that union type (E.g. can ignore 'the' in `@return the value`) |
| 96 | + // If the corresponding value is not empty, Phan will act as though it saw the corresponding unionTypes(s) when the keys show up in a UnionType of @param, @return, @var, @property, etc. |
| 97 | + // |
| 98 | + // This matches the **entire string**, not parts of the string. |
| 99 | + // (E.g. `@return the|null` will still look for a class with the name `the`, but `@return the` will be ignored with the below setting) |
| 100 | + // |
| 101 | + // (These are not aliases, this setting is ignored outside of doc comments). |
| 102 | + // (Phan does not check if classes with these names exist) |
| 103 | + // |
| 104 | + // Example setting: ['unknown' => '', 'number' => 'int|float', 'char' => 'string', 'long' => 'int', 'the' => ''] |
| 105 | + 'phpdoc_type_mapping' => [ ], |
| 106 | + |
57 | 107 | // Set to true in order to attempt to detect dead |
58 | 108 | // (unreferenced) code. Keep in mind that the |
59 | 109 | // results will only be a guess given that classes, |
|
71 | 121 | // class types. |
72 | 122 | 'generic_types_enabled' => true, |
73 | 123 |
|
74 | | - // By default, Phan will not analyze all node types |
75 | | - // in order to save time. If this config is set to true, |
76 | | - // Phan will dig deeper into the AST tree and do an |
77 | | - // analysis on all nodes, possibly finding more issues. |
78 | | - // |
79 | | - // See \Phan\Analysis::shouldVisit for the set of skipped |
80 | | - // nodes. |
81 | | - 'should_visit_all_nodes' => true, |
82 | | - |
83 | | - 'runkit_superglobals' => ['_DATE', '_RK'], |
84 | | - |
85 | | - 'globals_type_map' => [ |
86 | | - '_DATE' => '\\DateTime', |
87 | | - '_RK' => '\\RunkitGlobal', |
88 | | - ], |
89 | | - |
90 | 124 | // The minimum severity level to report on. This can be |
91 | 125 | // set to Issue::SEVERITY_LOW, Issue::SEVERITY_NORMAL or |
92 | 126 | // Issue::SEVERITY_CRITICAL. |
|
102 | 136 | // If non-empty, only issues within the list will be emitted |
103 | 137 | // by Phan. |
104 | 138 | 'whitelist_issue_types' => [ |
105 | | - // 'PhanAccessMethodPrivate', |
106 | | - // 'PhanAccessMethodProtected', |
107 | | - // 'PhanAccessNonStaticToStatic', |
108 | | - // 'PhanAccessPropertyPrivate', |
109 | | - // 'PhanAccessPropertyProtected', |
110 | | - // 'PhanAccessSignatureMismatch', |
111 | | - // 'PhanAccessSignatureMismatchInternal', |
112 | | - // 'PhanAccessStaticToNonStatic', |
113 | | - // 'PhanCompatibleExpressionPHP7', |
114 | | - // 'PhanCompatiblePHP7', |
115 | | - // 'PhanContextNotObject', |
116 | | - // 'PhanDeprecatedClass', |
117 | | - // 'PhanDeprecatedFunction', |
118 | | - // 'PhanDeprecatedProperty', |
119 | | - // 'PhanEmptyFile', |
120 | | - // 'PhanNonClassMethodCall', |
121 | | - // 'PhanNoopArray', |
122 | | - // 'PhanNoopClosure', |
123 | | - // 'PhanNoopConstant', |
124 | | - // 'PhanNoopProperty', |
125 | | - // 'PhanNoopVariable', |
126 | | - // 'PhanParamRedefined', |
127 | | - // 'PhanParamReqAfterOpt', |
128 | | - // 'PhanParamSignatureMismatch', |
129 | | - // 'PhanParamSignatureMismatchInternal', |
130 | | - // 'PhanParamSpecial1', |
131 | | - // 'PhanParamSpecial2', |
132 | | - // 'PhanParamSpecial3', |
133 | | - // 'PhanParamSpecial4', |
134 | | - // 'PhanParamTooFew', |
135 | | - // 'PhanParamTooFewInternal', |
136 | | - // 'PhanParamTooMany', |
137 | | - // 'PhanParamTooManyInternal', |
138 | | - // 'PhanParamTypeMismatch', |
139 | | - // 'PhanParentlessClass', |
140 | | - // 'PhanRedefineClass', |
141 | | - // 'PhanRedefineClassInternal', |
142 | | - // 'PhanRedefineFunction', |
143 | | - // 'PhanRedefineFunctionInternal', |
144 | | - // 'PhanStaticCallToNonStatic', |
145 | | - // 'PhanSyntaxError', |
146 | | - // 'PhanTraitParentReference', |
147 | | - // 'PhanTypeArrayOperator', |
148 | | - // 'PhanTypeArraySuspicious', |
149 | | - // 'PhanTypeComparisonFromArray', |
150 | | - // 'PhanTypeComparisonToArray', |
151 | | - // 'PhanTypeConversionFromArray', |
152 | | - // 'PhanTypeInstantiateAbstract', |
153 | | - // 'PhanTypeInstantiateInterface', |
154 | | - // 'PhanTypeInvalidLeftOperand', |
155 | | - // 'PhanTypeInvalidRightOperand', |
156 | | - // 'PhanTypeMismatchArgument', |
157 | | - // 'PhanTypeMismatchArgumentInternal', |
158 | | - // 'PhanTypeMismatchDefault', |
159 | | - // 'PhanTypeMismatchForeach', |
160 | | - // 'PhanTypeMismatchProperty', |
161 | | - // 'PhanTypeMismatchReturn', |
162 | | - // 'PhanTypeMissingReturn', |
163 | | - // 'PhanTypeNonVarPassByRef', |
164 | | - // 'PhanTypeParentConstructorCalled', |
165 | | - // 'PhanTypeVoidAssignment', |
166 | | - // 'PhanUnanalyzable', |
167 | | - // 'PhanUndeclaredClass', |
168 | | - // 'PhanUndeclaredClassCatch', |
169 | | - // 'PhanUndeclaredClassConstant', |
170 | | - // 'PhanUndeclaredClassInstanceof', |
171 | | - // 'PhanUndeclaredClassMethod', |
172 | | - // 'PhanUndeclaredClassReference', |
173 | | - // 'PhanUndeclaredConstant', |
174 | | - // 'PhanUndeclaredExtendedClass', |
175 | | - // 'PhanUndeclaredFunction', |
176 | | - // 'PhanUndeclaredInterface', |
177 | | - // 'PhanUndeclaredMethod', |
178 | | - // 'PhanUndeclaredProperty', |
179 | | - // 'PhanUndeclaredStaticMethod', |
180 | | - // 'PhanUndeclaredStaticProperty', |
181 | | - // 'PhanUndeclaredTrait', |
182 | | - // 'PhanUndeclaredTypeParameter', |
183 | | - // 'PhanUndeclaredTypeProperty', |
184 | | - // 'PhanUndeclaredVariable', |
185 | | - // 'PhanUnreferencedClass', |
186 | | - // 'PhanUnreferencedConstant', |
187 | | - // 'PhanUnreferencedMethod', |
188 | | - // 'PhanUnreferencedProperty', |
189 | | - // 'PhanVariableUseClause', |
190 | 139 | ], |
191 | 140 |
|
192 | 141 | // A list of files to include in analysis |
193 | 142 | 'file_list' => [ |
194 | 143 | // 'vendor/phpunit/phpunit/src/Framework/TestCase.php', |
195 | 144 | ], |
196 | 145 |
|
| 146 | + // A regular expression to match files to be excluded |
| 147 | + // from parsing and analysis and will not be read at all. |
| 148 | + // |
| 149 | + // This is useful for excluding groups of test or example |
| 150 | + // directories/files, unanalyzable files, or files that |
| 151 | + // can't be removed for whatever reason. |
| 152 | + // (e.g. '@Test\.php$@', or '@vendor/.*/(tests|Tests)/@') |
| 153 | + 'exclude_file_regex' => '@^vendor/.*/(tests|Tests)/@', |
| 154 | + |
197 | 155 | // A file list that defines files that will be excluded |
198 | 156 | // from parsing and analysis and will not be read at all. |
199 | 157 | // |
|
229 | 187 | // should be added to the `directory_list` as |
230 | 188 | // to `exclude_analysis_directory_list`. |
231 | 189 | "exclude_analysis_directory_list" => [ |
232 | | - 'vendor/nikic/php-parser/lib', |
| 190 | + 'vendor', |
233 | 191 | ], |
234 | 192 |
|
| 193 | + // By default, Phan will log error messages to stdout if PHP is using options that slow the analysis. |
| 194 | + // (e.g. PHP is compiled with --enable-debug or when using XDebug) |
| 195 | + 'skip_slow_php_options_warning' => false, |
| 196 | + |
235 | 197 | // A list of plugin files to execute |
236 | 198 | 'plugins' => [ |
237 | 199 | // NOTE: src/Phan/Language/Internal/FunctionSignatureMap.php mixes value without key as return type with values having keys deliberately. |
238 | | - 'vendor/etsy/phan/.phan/plugins/AlwaysReturnPlugin.php', // (TODO: make BlockExitStatus more reliable) |
239 | | - 'vendor/etsy/phan/.phan/plugins/DollarDollarPlugin.php', |
240 | | - 'vendor/etsy/phan/.phan/plugins/DuplicateArrayKeyPlugin.php', |
241 | | - 'vendor/etsy/phan/.phan/plugins/UnreachableCodePlugin.php', // (TODO: make BlockExitStatus more reliable) |
| 200 | + 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php', // (TODO: make BlockExitStatus more reliable) |
| 201 | + 'vendor/phan/phan/.phan/plugins/DollarDollarPlugin.php', |
| 202 | + 'vendor/phan/phan/.phan/plugins/DuplicateArrayKeyPlugin.php', |
| 203 | + 'vendor/phan/phan/.phan/plugins/UnreachableCodePlugin.php', // (TODO: make BlockExitStatus more reliable) |
242 | 204 | // NOTE: This plugin only produces correct results when |
243 | 205 | // Phan is run on a single core (-j1). |
244 | | - // 'vendor/etsy/phan/.phan/plugins/UnusedSuppressionPlugin.php', |
| 206 | + // 'vendor/phan/phan/.phan/plugins/UnusedSuppressionPlugin.php', |
245 | 207 | ], |
246 | 208 |
|
247 | 209 | ]; |
0 commit comments