|
| 1 | +<?php |
| 2 | + |
| 3 | +use Phan\Issue; |
| 4 | + |
| 5 | +/** |
| 6 | + * This configuration file was automatically generated by 'phan --init --init-level=3' |
| 7 | + * |
| 8 | + * TODOs (added by 'phan --init'): |
| 9 | + * |
| 10 | + * - Go through this file and verify that there are no missing/unnecessary files/directories. |
| 11 | + * (E.g. this only includes direct composer dependencies - You may have to manually add indirect composer dependencies to 'directory_list') |
| 12 | + * - Look at 'plugins' and add or remove plugins if appropriate (see https://github.com/phan/phan/tree/master/.phan/plugins#plugins) |
| 13 | + * - Add global suppressions for pre-existing issues to suppress_issue_types (https://github.com/phan/phan/wiki/Tutorial-for-Analyzing-a-Large-Sloppy-Code-Base) |
| 14 | + * |
| 15 | + * This configuration will be read and overlaid on top of the |
| 16 | + * default configuration. Command line arguments will be applied |
| 17 | + * after this file is read. |
| 18 | + * |
| 19 | + * @see src/Phan/Config.php |
| 20 | + * See Config for all configurable options. |
| 21 | + * |
| 22 | + * A Note About Paths |
| 23 | + * ================== |
| 24 | + * |
| 25 | + * Files referenced from this file should be defined as |
| 26 | + * |
| 27 | + * ``` |
| 28 | + * Config::projectPath('relative_path/to/file') |
| 29 | + * ``` |
| 30 | + * |
| 31 | + * where the relative path is relative to the root of the |
| 32 | + * project which is defined as either the working directory |
| 33 | + * of the phan executable or a path passed in via the CLI |
| 34 | + * '-d' flag. |
| 35 | + */ |
| 36 | +return [ |
| 37 | + |
| 38 | + // Supported values: `'5.6'`, `'7.0'`, `'7.1'`, `'7.2'`, `'7.3'`, `'7.4'`, `null`. |
| 39 | + // If this is set to `null`, |
| 40 | + // then Phan assumes the PHP version which is closest to the minor version |
| 41 | + // of the php executable used to execute Phan. |
| 42 | + // |
| 43 | + // Note that the **only** effect of choosing `'5.6'` is to infer that functions removed in php 7.0 exist. |
| 44 | + // (See `backward_compatibility_checks` for additional options) |
| 45 | + 'target_php_version' => '8.0', |
| 46 | + |
| 47 | + // If enabled, missing properties will be created when |
| 48 | + // they are first seen. If false, we'll report an |
| 49 | + // error message if there is an attempt to write |
| 50 | + // to a class property that wasn't explicitly |
| 51 | + // defined. |
| 52 | + 'allow_missing_properties' => false, |
| 53 | + |
| 54 | + // If enabled, null can be cast to any type and any |
| 55 | + // type can be cast to null. Setting this to true |
| 56 | + // will cut down on false positives. |
| 57 | + 'null_casts_as_any_type' => false, |
| 58 | + |
| 59 | + // If enabled, allow null to be cast as any array-like type. |
| 60 | + // |
| 61 | + // This is an incremental step in migrating away from `null_casts_as_any_type`. |
| 62 | + // If `null_casts_as_any_type` is true, this has no effect. |
| 63 | + 'null_casts_as_array' => true, |
| 64 | + |
| 65 | + // If enabled, allow any array-like type to be cast to null. |
| 66 | + // This is an incremental step in migrating away from `null_casts_as_any_type`. |
| 67 | + // If `null_casts_as_any_type` is true, this has no effect. |
| 68 | + 'array_casts_as_null' => true, |
| 69 | + |
| 70 | + // If enabled, scalars (int, float, bool, string, null) |
| 71 | + // are treated as if they can cast to each other. |
| 72 | + // This does not affect checks of array keys. See `scalar_array_key_cast`. |
| 73 | + 'scalar_implicit_cast' => false, |
| 74 | + |
| 75 | + // If enabled, any scalar array keys (int, string) |
| 76 | + // are treated as if they can cast to each other. |
| 77 | + // E.g. `array<int,stdClass>` can cast to `array<string,stdClass>` and vice versa. |
| 78 | + // Normally, a scalar type such as int could only cast to/from int and mixed. |
| 79 | + 'scalar_array_key_cast' => true, |
| 80 | + |
| 81 | + // If this has entries, scalars (int, float, bool, string, null) |
| 82 | + // are allowed to perform the casts listed. |
| 83 | + // |
| 84 | + // E.g. `['int' => ['float', 'string'], 'float' => ['int'], 'string' => ['int'], 'null' => ['string']]` |
| 85 | + // allows casting null to a string, but not vice versa. |
| 86 | + // (subset of `scalar_implicit_cast`) |
| 87 | + 'scalar_implicit_partial' => [], |
| 88 | + |
| 89 | + // If enabled, Phan will warn if **any** type in a method invocation's object |
| 90 | + // is definitely not an object, |
| 91 | + // or if **any** type in an invoked expression is not a callable. |
| 92 | + // Setting this to true will introduce numerous false positives |
| 93 | + // (and reveal some bugs). |
| 94 | + 'strict_method_checking' => false, |
| 95 | + |
| 96 | + // If enabled, Phan will warn if **any** type of the object expression for a property access |
| 97 | + // does not contain that property. |
| 98 | + 'strict_object_checking' => false, |
| 99 | + |
| 100 | + // If enabled, Phan will warn if **any** type in the argument's union type |
| 101 | + // cannot be cast to a type in the parameter's expected union type. |
| 102 | + // Setting this to true will introduce numerous false positives |
| 103 | + // (and reveal some bugs). |
| 104 | + 'strict_param_checking' => false, |
| 105 | + |
| 106 | + // If enabled, Phan will warn if **any** type in a property assignment's union type |
| 107 | + // cannot be cast to a type in the property's declared union type. |
| 108 | + // Setting this to true will introduce numerous false positives |
| 109 | + // (and reveal some bugs). |
| 110 | + 'strict_property_checking' => false, |
| 111 | + |
| 112 | + // If enabled, Phan will warn if **any** type in a returned value's union type |
| 113 | + // cannot be cast to the declared return type. |
| 114 | + // Setting this to true will introduce numerous false positives |
| 115 | + // (and reveal some bugs). |
| 116 | + 'strict_return_checking' => false, |
| 117 | + |
| 118 | + // If true, seemingly undeclared variables in the global |
| 119 | + // scope will be ignored. |
| 120 | + // |
| 121 | + // This is useful for projects with complicated cross-file |
| 122 | + // globals that you have no hope of fixing. |
| 123 | + 'ignore_undeclared_variables_in_global_scope' => true, |
| 124 | + |
| 125 | + // Set this to false to emit `PhanUndeclaredFunction` issues for internal functions that Phan has signatures for, |
| 126 | + // but aren't available in the codebase, or from Reflection. |
| 127 | + // (may lead to false positives if an extension isn't loaded) |
| 128 | + // |
| 129 | + // If this is true(default), then Phan will not warn. |
| 130 | + // |
| 131 | + // Even when this is false, Phan will still infer return values and check parameters of internal functions |
| 132 | + // if Phan has the signatures. |
| 133 | + 'ignore_undeclared_functions_with_known_signatures' => true, |
| 134 | + |
| 135 | + // Backwards Compatibility Checking. This is slow |
| 136 | + // and expensive, but you should consider running |
| 137 | + // it before upgrading your version of PHP to a |
| 138 | + // new version that has backward compatibility |
| 139 | + // breaks. |
| 140 | + // |
| 141 | + // If you are migrating from PHP 5 to PHP 7, |
| 142 | + // you should also look into using |
| 143 | + // [php7cc (no longer maintained)](https://github.com/sstalle/php7cc) |
| 144 | + // and [php7mar](https://github.com/Alexia/php7mar), |
| 145 | + // which have different backwards compatibility checks. |
| 146 | + 'backward_compatibility_checks' => false, |
| 147 | + |
| 148 | + // If true, check to make sure the return type declared |
| 149 | + // in the doc-block (if any) matches the return type |
| 150 | + // declared in the method signature. |
| 151 | + 'check_docblock_signature_return_type_match' => false, |
| 152 | + |
| 153 | + // If true, make narrowed types from phpdoc params override |
| 154 | + // the real types from the signature, when real types exist. |
| 155 | + // (E.g. allows specifying desired lists of subclasses, |
| 156 | + // or to indicate a preference for non-nullable types over nullable types) |
| 157 | + // |
| 158 | + // Affects analysis of the body of the method and the param types passed in by callers. |
| 159 | + // |
| 160 | + // (*Requires `check_docblock_signature_param_type_match` to be true*) |
| 161 | + 'prefer_narrowed_phpdoc_param_type' => true, |
| 162 | + |
| 163 | + // (*Requires `check_docblock_signature_return_type_match` to be true*) |
| 164 | + // |
| 165 | + // If true, make narrowed types from phpdoc returns override |
| 166 | + // the real types from the signature, when real types exist. |
| 167 | + // |
| 168 | + // (E.g. allows specifying desired lists of subclasses, |
| 169 | + // or to indicate a preference for non-nullable types over nullable types) |
| 170 | + // |
| 171 | + // This setting affects the analysis of return statements in the body of the method and the return types passed in by callers. |
| 172 | + 'prefer_narrowed_phpdoc_return_type' => true, |
| 173 | + |
| 174 | + // If enabled, check all methods that override a |
| 175 | + // parent method to make sure its signature is |
| 176 | + // compatible with the parent's. |
| 177 | + // |
| 178 | + // This check can add quite a bit of time to the analysis. |
| 179 | + // |
| 180 | + // This will also check if final methods are overridden, etc. |
| 181 | + 'analyze_signature_compatibility' => true, |
| 182 | + |
| 183 | + // This setting maps case-insensitive strings to union types. |
| 184 | + // |
| 185 | + // This is useful if a project uses phpdoc that differs from the phpdoc2 standard. |
| 186 | + // |
| 187 | + // If the corresponding value is the empty string, |
| 188 | + // then Phan will ignore that union type (E.g. can ignore 'the' in `@return the value`) |
| 189 | + // |
| 190 | + // If the corresponding value is not empty, |
| 191 | + // then Phan will act as though it saw the corresponding UnionTypes(s) |
| 192 | + // when the keys show up in a UnionType of `@param`, `@return`, `@var`, `@property`, etc. |
| 193 | + // |
| 194 | + // This matches the **entire string**, not parts of the string. |
| 195 | + // (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) |
| 196 | + // |
| 197 | + // (These are not aliases, this setting is ignored outside of doc comments). |
| 198 | + // (Phan does not check if classes with these names exist) |
| 199 | + // |
| 200 | + // Example setting: `['unknown' => '', 'number' => 'int|float', 'char' => 'string', 'long' => 'int', 'the' => '']` |
| 201 | + 'phpdoc_type_mapping' => [], |
| 202 | + |
| 203 | + // Set to true in order to attempt to detect dead |
| 204 | + // (unreferenced) code. Keep in mind that the |
| 205 | + // results will only be a guess given that classes, |
| 206 | + // properties, constants and methods can be referenced |
| 207 | + // as variables (like `$class->$property` or |
| 208 | + // `$class->$method()`) in ways that we're unable |
| 209 | + // to make sense of. |
| 210 | + 'dead_code_detection' => false, |
| 211 | + |
| 212 | + // Set to true in order to attempt to detect unused variables. |
| 213 | + // `dead_code_detection` will also enable unused variable detection. |
| 214 | + // |
| 215 | + // This has a few known false positives, e.g. for loops or branches. |
| 216 | + 'unused_variable_detection' => false, |
| 217 | + |
| 218 | + // Set to true in order to attempt to detect redundant and impossible conditions. |
| 219 | + // |
| 220 | + // This has some false positives involving loops, |
| 221 | + // variables set in branches of loops, and global variables. |
| 222 | + 'redundant_condition_detection' => false, |
| 223 | + |
| 224 | + // If enabled, Phan will act as though it's certain of real return types of a subset of internal functions, |
| 225 | + // even if those return types aren't available in reflection (real types were taken from php 7.3 or 8.0-dev, depending on target_php_version). |
| 226 | + // |
| 227 | + // Note that with php 7 and earlier, php would return null or false for many internal functions if the argument types or counts were incorrect. |
| 228 | + // As a result, enabling this setting with target_php_version 8.0 may result in false positives for `--redundant-condition-detection` when codebases also support php 7.x. |
| 229 | + 'assume_real_types_for_internal_functions' => false, |
| 230 | + |
| 231 | + // If true, this runs a quick version of checks that takes less |
| 232 | + // time at the cost of not running as thorough |
| 233 | + // of an analysis. You should consider setting this |
| 234 | + // to true only when you wish you had more **undiagnosed** issues |
| 235 | + // to fix in your code base. |
| 236 | + // |
| 237 | + // In quick-mode the scanner doesn't rescan a function |
| 238 | + // or a method's code block every time a call is seen. |
| 239 | + // This means that the problem here won't be detected: |
| 240 | + // |
| 241 | + // ```php |
| 242 | + // <?php |
| 243 | + // function test($arg):int { |
| 244 | + // return $arg; |
| 245 | + // } |
| 246 | + // test("abc"); |
| 247 | + // ``` |
| 248 | + // |
| 249 | + // This would normally generate: |
| 250 | + // |
| 251 | + // ``` |
| 252 | + // test.php:3 PhanTypeMismatchReturn Returning type string but test() is declared to return int |
| 253 | + // ``` |
| 254 | + // |
| 255 | + // The initial scan of the function's code block has no |
| 256 | + // type information for `$arg`. It isn't until we see |
| 257 | + // the call and rescan `test()`'s code block that we can |
| 258 | + // detect that it is actually returning the passed in |
| 259 | + // `string` instead of an `int` as declared. |
| 260 | + 'quick_mode' => false, |
| 261 | + |
| 262 | + // Enable or disable support for generic templated |
| 263 | + // class types. |
| 264 | + 'generic_types_enabled' => true, |
| 265 | + |
| 266 | + // Override to hardcode existence and types of (non-builtin) globals in the global scope. |
| 267 | + // Class names should be prefixed with `\`. |
| 268 | + // |
| 269 | + // (E.g. `['_FOO' => '\FooClass', 'page' => '\PageClass', 'userId' => 'int']`) |
| 270 | + 'globals_type_map' => [], |
| 271 | + |
| 272 | + // The minimum severity level to report on. This can be |
| 273 | + // set to `Issue::SEVERITY_LOW`, `Issue::SEVERITY_NORMAL` or |
| 274 | + // `Issue::SEVERITY_CRITICAL`. Setting it to only |
| 275 | + // critical issues is a good place to start on a big |
| 276 | + // sloppy mature code base. |
| 277 | + 'minimum_severity' => Issue::SEVERITY_LOW, |
| 278 | + |
| 279 | + // Add any issue types (such as `'PhanUndeclaredMethod'`) |
| 280 | + // to this deny-list to inhibit them from being reported. |
| 281 | + 'suppress_issue_types' => [], |
| 282 | + |
| 283 | + // A regular expression to match files to be excluded |
| 284 | + // from parsing and analysis and will not be read at all. |
| 285 | + // |
| 286 | + // This is useful for excluding groups of test or example |
| 287 | + // directories/files, unanalyzable files, or files that |
| 288 | + // can't be removed for whatever reason. |
| 289 | + // (e.g. `'@Test\.php$@'`, or `'@vendor/.*/(tests|Tests)/@'`) |
| 290 | + 'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@', |
| 291 | + |
| 292 | + // A list of files that will be excluded from parsing and analysis |
| 293 | + // and will not be read at all. |
| 294 | + // |
| 295 | + // This is useful for excluding hopelessly unanalyzable |
| 296 | + // files that can't be removed for whatever reason. |
| 297 | + 'exclude_file_list' => [ |
| 298 | + 'vendor/composer/composer/src/Composer/InstalledVersions.php' |
| 299 | + ], |
| 300 | + |
| 301 | + // A directory list that defines files that will be excluded |
| 302 | + // from static analysis, but whose class and method |
| 303 | + // information should be included. |
| 304 | + // |
| 305 | + // Generally, you'll want to include the directories for |
| 306 | + // third-party code (such as "vendor/") in this list. |
| 307 | + // |
| 308 | + // n.b.: If you'd like to parse but not analyze 3rd |
| 309 | + // party code, directories containing that code |
| 310 | + // should be added to the `directory_list` as well as |
| 311 | + // to `exclude_analysis_directory_list`. |
| 312 | + 'exclude_analysis_directory_list' => [ |
| 313 | + 'vendor/', |
| 314 | + 'proto/', |
| 315 | + 'thrift/' |
| 316 | + ], |
| 317 | + |
| 318 | + // Enable this to enable checks of require/include statements referring to valid paths. |
| 319 | + 'enable_include_path_checks' => true, |
| 320 | + |
| 321 | + // The number of processes to fork off during the analysis |
| 322 | + // phase. |
| 323 | + 'processes' => 1, |
| 324 | + |
| 325 | + // List of case-insensitive file extensions supported by Phan. |
| 326 | + // (e.g. `['php', 'html', 'htm']`) |
| 327 | + 'analyzed_file_extensions' => [ |
| 328 | + 'php', |
| 329 | + ], |
| 330 | + |
| 331 | + // You can put paths to stubs of internal extensions in this config option. |
| 332 | + // If the corresponding extension is **not** loaded, then Phan will use the stubs instead. |
| 333 | + // Phan will continue using its detailed type annotations, |
| 334 | + // but load the constants, classes, functions, and classes (and their Reflection types) |
| 335 | + // from these stub files (doubling as valid php files). |
| 336 | + // Use a different extension from php to avoid accidentally loading these. |
| 337 | + // The `tools/make_stubs` script can be used to generate your own stubs (compatible with php 7.0+ right now) |
| 338 | + // |
| 339 | + // (e.g. `['xdebug' => '.phan/internal_stubs/xdebug.phan_php']`) |
| 340 | + 'autoload_internal_extension_signatures' => [], |
| 341 | + |
| 342 | + // A list of plugin files to execute. |
| 343 | + // |
| 344 | + // Plugins which are bundled with Phan can be added here by providing their name (e.g. `'AlwaysReturnPlugin'`) |
| 345 | + // |
| 346 | + // Documentation about available bundled plugins can be found [here](https://github.com/phan/phan/tree/master/.phan/plugins). |
| 347 | + // |
| 348 | + // Alternately, you can pass in the full path to a PHP file with the plugin's implementation (e.g. `'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php'`) |
| 349 | + 'plugins' => [ |
| 350 | + 'AlwaysReturnPlugin', |
| 351 | + 'PregRegexCheckerPlugin', |
| 352 | + 'UnreachableCodePlugin', |
| 353 | + ], |
| 354 | + |
| 355 | + // A list of directories that should be parsed for class and |
| 356 | + // method information. After excluding the directories |
| 357 | + // defined in `exclude_analysis_directory_list`, the remaining |
| 358 | + // files will be statically analyzed for errors. |
| 359 | + // |
| 360 | + // Thus, both first-party and third-party code being used by |
| 361 | + // your application should be included in this list. |
| 362 | + 'directory_list' => [ |
| 363 | + 'src', |
| 364 | + 'vendor' |
| 365 | + ], |
| 366 | + |
| 367 | + // A list of individual files to include in analysis |
| 368 | + // with a path relative to the root directory of the |
| 369 | + // project. |
| 370 | + 'file_list' => [], |
| 371 | +]; |
0 commit comments