5 // If xdebug is enabled, we need to increase the nesting level for phan
6 ini_set( 'xdebug.max_nesting_level', 1000 );
9 * This configuration will be read and overlayed on top of the
10 * default configuration. Command line arguments will be applied
11 * after this file is read.
13 * @see src/Phan/Config.php
14 * See Config for all configurable options.
19 * Files referenced from this file should be defined as
22 * Config::projectPath('relative_path/to/file')
25 * where the relative path is relative to the root of the
26 * project which is defined as either the working directory
27 * of the phan executable or a path passed in via the CLI
32 * A list of individual files to include in analysis
33 * with a path relative to the root directory of the
34 * project. directory_list won't find .inc files so
37 'file_list' => array_merge(
38 function_exists( 'register_postsend_function' ) ?
[] : [ 'tests/phan/stubs/hhvm.php' ],
39 function_exists( 'wikidiff2_do_diff' ) ?
[] : [ 'tests/phan/stubs/wikidiff.php' ],
40 function_exists( 'tideways_enable' ) ?
[] : [ 'tests/phan/stubs/tideways.php' ],
41 class_exists( PEAR
::class ) ?
[] : [ 'tests/phan/stubs/mail.php' ],
42 class_exists( Memcached
::class ) ?
[] : [ 'tests/phan/stubs/memcached.php' ],
44 'maintenance/7zip.inc',
45 'maintenance/backupPrefetch.inc',
46 'maintenance/commandLine.inc',
47 'maintenance/sqlite.inc',
48 'maintenance/userOptions.inc',
49 'maintenance/backup.inc',
50 'maintenance/cleanupTable.inc',
51 'maintenance/importImages.inc',
52 'maintenance/userDupes.inc',
53 'maintenance/language/checkLanguage.inc',
54 'maintenance/language/languages.inc',
59 * A list of directories that should be parsed for class and
60 * method information. After excluding the directories
61 * defined in exclude_analysis_directory_list, the remaining
62 * files will be statically analyzed for errors.
64 * Thus, both first-party and third-party code being used by
65 * your application should be included in this list.
78 * A file list that defines files that will be excluded
79 * from parsing and analysis and will not be read at all.
81 * This is useful for excluding hopelessly unanalyzable
82 * files that can't be removed for whatever reason.
84 'exclude_file_list' => [],
87 * A list of directories holding code that we want
88 * to parse, but not analyze. Also works for individual
91 "exclude_analysis_directory_list" => [
94 // The referenced classes are not available in vendor, only when
95 // included from composer.
97 // Directly references classes that only exist in Translate extension
98 'maintenance/language/',
100 'includes/libs/jsminplus.php',
101 // separate repositories
106 * Backwards Compatibility Checking. This is slow
107 * and expensive, but you should consider running
108 * it before upgrading your version of PHP to a
109 * new version that has backward compatibility
112 'backward_compatibility_checks' => false,
115 * A set of fully qualified class-names for which
116 * a call to parent::__construct() is required
118 'parent_constructor_required' => [
122 * Run a quick version of checks that takes less
123 * time at the cost of not running as thorough
124 * an analysis. You should consider setting this
125 * to true only when you wish you had more issues
126 * to fix in your code base.
128 * In quick-mode the scanner doesn't rescan a function
129 * or a method's code block every time a call is seen.
130 * This means that the problem here won't be detected:
134 * function test($arg):int {
140 * This would normally generate:
143 * test.php:3 TypeError return string but `test()` is declared to return int
146 * The initial scan of the function's code block has no
147 * type information for `$arg`. It isn't until we see
148 * the call and rescan test()'s code block that we can
149 * detect that it is actually returning the passed in
150 * `string` instead of an `int` as declared.
152 'quick_mode' => false,
155 * By default, Phan will not analyze all node types
156 * in order to save time. If this config is set to true,
157 * Phan will dig deeper into the AST tree and do an
158 * analysis on all nodes, possibly finding more issues.
160 * See \Phan\Analysis::shouldVisit for the set of skipped
163 'should_visit_all_nodes' => true,
166 * If enabled, check all methods that override a
167 * parent method to make sure its signature is
168 * compatible with the parent's. This check
169 * can add quite a bit of time to the analysis.
171 'analyze_signature_compatibility' => true,
173 // Emit all issues. They are then suppressed via
174 // suppress_issue_types, rather than a minimum
176 "minimum_severity" => 0,
179 * If true, missing properties will be created when
180 * they are first seen. If false, we'll report an
181 * error message if there is an attempt to write
182 * to a class property that wasn't explicitly
185 'allow_missing_properties' => false,
188 * Allow null to be cast as any type and for any
189 * type to be cast to null. Setting this to false
190 * will cut down on false positives.
192 'null_casts_as_any_type' => true,
195 * If enabled, scalars (int, float, bool, string, null)
196 * are treated as if they can cast to each other.
198 * MediaWiki is pretty lax and uses many scalar
199 * types interchangably.
201 'scalar_implicit_cast' => true,
204 * If true, seemingly undeclared variables in the global
205 * scope will be ignored. This is useful for projects
206 * with complicated cross-file globals that you have no
209 'ignore_undeclared_variables_in_global_scope' => true,
212 * Set to true in order to attempt to detect dead
213 * (unreferenced) code. Keep in mind that the
214 * results will only be a guess given that classes,
215 * properties, constants and methods can be referenced
216 * as variables (like `$class->$property` or
217 * `$class->$method()`) in ways that we're unable
220 'dead_code_detection' => false,
223 * If true, the dead code detection rig will
224 * prefer false negatives (not report dead code) to
225 * false positives (report dead code that is not
226 * actually dead) which is to say that the graph of
227 * references will create too many edges rather than
228 * too few edges when guesses have to be made about
229 * what references what.
231 'dead_code_detection_prefer_false_negative' => true,
234 * If disabled, Phan will not read docblock type
235 * annotation comments (such as for @return, @param,
236 * @var, @suppress, @deprecated) and only rely on
237 * types expressed in code.
239 'read_type_annotations' => true,
242 * If a file path is given, the code base will be
243 * read from and written to the given location in
244 * order to attempt to save some work from being
245 * done. Only changed files will get analyzed if
248 'stored_state_file_path' => null,
251 * Set to true in order to ignore issue suppression.
252 * This is useful for testing the state of your code, but
253 * unlikely to be useful outside of that.
255 'disable_suppression' => false,
258 * If set to true, we'll dump the AST instead of
264 * If set to a string, we'll dump the fully qualified lowercase
265 * function and method signatures instead of analyzing files.
267 'dump_signatures_file' => null,
270 * If true (and if stored_state_file_path is set) we'll
271 * look at the list of files passed in and expand the list
272 * to include files that depend on the given files
274 'expand_file_list' => false,
276 // Include a progress bar in the output
277 'progress_bar' => false,
280 * The probability of actually emitting any progress
281 * bar update. Setting this to something very low
282 * is good for reducing network IO and filling up
283 * your terminal's buffer when running phan on a
286 'progress_bar_sample_rate' => 0.005,
289 * The number of processes to fork off during the analysis
295 * Add any issue types (such as 'PhanUndeclaredMethod')
296 * to this black-list to inhibit them from being reported.
298 'suppress_issue_types' => [
299 // approximate error count: 8
300 "PhanDeprecatedClass",
301 // approximate error count: 441
302 "PhanDeprecatedFunction",
303 // approximate error count: 24
304 "PhanDeprecatedProperty",
305 // approximate error count: 12
306 "PhanParamReqAfterOpt",
307 // approximate error count: 748
308 "PhanParamSignatureMismatch",
309 // approximate error count: 7
310 "PhanParamSignatureMismatchInternal",
311 // approximate error count: 308
313 // approximate error count: 3
314 "PhanParamTooManyInternal",
315 // approximate error count: 1
316 "PhanRedefineFunctionInternal",
317 // approximate error count: 2
318 "PhanTraitParentReference",
319 // approximate error count: 4
320 "PhanTypeComparisonFromArray",
321 // approximate error count: 3
322 "PhanTypeInvalidRightOperand",
323 // approximate error count: 563
324 "PhanTypeMismatchArgument",
325 // approximate error count: 39
326 "PhanTypeMismatchArgumentInternal",
327 // approximate error count: 16
328 "PhanTypeMismatchForeach",
329 // approximate error count: 63
330 "PhanTypeMismatchProperty",
331 // approximate error count: 95
332 "PhanTypeMismatchReturn",
333 // approximate error count: 11
334 "PhanTypeMissingReturn",
335 // approximate error count: 5
336 "PhanTypeNonVarPassByRef",
337 // approximate error count: 27
338 "PhanUndeclaredConstant",
339 // approximate error count: 185
340 "PhanUndeclaredMethod",
341 // approximate error count: 1342
342 "PhanUndeclaredProperty",
343 // approximate error count: 3
344 "PhanUndeclaredStaticMethod",
348 * If empty, no filter against issues types will be applied.
349 * If this white-list is non-empty, only issues within the list
350 * will be emitted by Phan.
352 'whitelist_issue_types' => [
353 // 'PhanAccessMethodPrivate',
354 // 'PhanAccessMethodProtected',
355 // 'PhanAccessNonStaticToStatic',
356 // 'PhanAccessPropertyPrivate',
357 // 'PhanAccessPropertyProtected',
358 // 'PhanAccessSignatureMismatch',
359 // 'PhanAccessSignatureMismatchInternal',
360 // 'PhanAccessStaticToNonStatic',
361 // 'PhanCompatibleExpressionPHP7',
362 // 'PhanCompatiblePHP7',
363 // 'PhanContextNotObject',
364 // 'PhanDeprecatedClass',
365 // 'PhanDeprecatedFunction',
366 // 'PhanDeprecatedProperty',
368 // 'PhanNonClassMethodCall',
370 // 'PhanNoopClosure',
371 // 'PhanNoopConstant',
372 // 'PhanNoopProperty',
373 // 'PhanNoopVariable',
374 // 'PhanParamRedefined',
375 // 'PhanParamReqAfterOpt',
376 // 'PhanParamSignatureMismatch',
377 // 'PhanParamSignatureMismatchInternal',
378 // 'PhanParamSpecial1',
379 // 'PhanParamSpecial2',
380 // 'PhanParamSpecial3',
381 // 'PhanParamSpecial4',
382 // 'PhanParamTooFew',
383 // 'PhanParamTooFewInternal',
384 // 'PhanParamTooMany',
385 // 'PhanParamTooManyInternal',
386 // 'PhanParamTypeMismatch',
387 // 'PhanParentlessClass',
388 // 'PhanRedefineClass',
389 // 'PhanRedefineClassInternal',
390 // 'PhanRedefineFunction',
391 // 'PhanRedefineFunctionInternal',
392 // 'PhanStaticCallToNonStatic',
393 // 'PhanSyntaxError',
394 // 'PhanTraitParentReference',
395 // 'PhanTypeArrayOperator',
396 // 'PhanTypeArraySuspicious',
397 // 'PhanTypeComparisonFromArray',
398 // 'PhanTypeComparisonToArray',
399 // 'PhanTypeConversionFromArray',
400 // 'PhanTypeInstantiateAbstract',
401 // 'PhanTypeInstantiateInterface',
402 // 'PhanTypeInvalidLeftOperand',
403 // 'PhanTypeInvalidRightOperand',
404 // 'PhanTypeMismatchArgument',
405 // 'PhanTypeMismatchArgumentInternal',
406 // 'PhanTypeMismatchDefault',
407 // 'PhanTypeMismatchForeach',
408 // 'PhanTypeMismatchProperty',
409 // 'PhanTypeMismatchReturn',
410 // 'PhanTypeMissingReturn',
411 // 'PhanTypeNonVarPassByRef',
412 // 'PhanTypeParentConstructorCalled',
413 // 'PhanTypeVoidAssignment',
414 // 'PhanUnanalyzable',
415 // 'PhanUndeclaredClass',
416 // 'PhanUndeclaredClassCatch',
417 // 'PhanUndeclaredClassConstant',
418 // 'PhanUndeclaredClassInstanceof',
419 // 'PhanUndeclaredClassMethod',
420 // 'PhanUndeclaredClassReference',
421 // 'PhanUndeclaredConstant',
422 // 'PhanUndeclaredExtendedClass',
423 // 'PhanUndeclaredFunction',
424 // 'PhanUndeclaredInterface',
425 // 'PhanUndeclaredMethod',
426 // 'PhanUndeclaredProperty',
427 // 'PhanUndeclaredStaticMethod',
428 // 'PhanUndeclaredStaticProperty',
429 // 'PhanUndeclaredTrait',
430 // 'PhanUndeclaredTypeParameter',
431 // 'PhanUndeclaredTypeProperty',
432 // 'PhanUndeclaredVariable',
433 // 'PhanUnreferencedClass',
434 // 'PhanUnreferencedConstant',
435 // 'PhanUnreferencedMethod',
436 // 'PhanUnreferencedProperty',
437 // 'PhanVariableUseClause',
441 * Override to hardcode existence and types of (non-builtin) globals in the global scope.
442 * Class names must be prefixed with '\\'.
443 * (E.g. ['_FOO' => '\\FooClass', 'page' => '\\PageClass', 'userId' => 'int'])
445 'globals_type_map' => [
449 // Emit issue messages with markdown formatting
450 'markdown_issue_messages' => false,
453 * Enable or disable support for generic templated
456 'generic_types_enabled' => true,
458 // A list of plugin files to execute