|
| 1 | +<?php |
| 2 | + |
| 3 | +use Phan\Issue; |
| 4 | + |
| 5 | +/** |
| 6 | + * This configuration file was automatically generated by 'phan --init --init-level=1' |
| 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 overlayed 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: '7.0', '7.1', '7.2', 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 | + // Automatically inferred from composer.json requirement for "php" of "^7.0" |
| 43 | + 'target_php_version' => '7.0', |
| 44 | + |
| 45 | + // If enabled, missing properties will be created when |
| 46 | + // they are first seen. If false, we'll report an |
| 47 | + // error message if there is an attempt to write |
| 48 | + // to a class property that wasn't explicitly |
| 49 | + // defined. |
| 50 | + 'allow_missing_properties' => false, |
| 51 | + |
| 52 | + // If enabled, null can be cast as any type and any |
| 53 | + // type can be cast to null. Setting this to true |
| 54 | + // will cut down on false positives. |
| 55 | + 'null_casts_as_any_type' => false, |
| 56 | + |
| 57 | + // If enabled, allow null to be cast as any array-like type. |
| 58 | + // This is an incremental step in migrating away from null_casts_as_any_type. |
| 59 | + // If null_casts_as_any_type is true, this has no effect. |
| 60 | + 'null_casts_as_array' => false, |
| 61 | + |
| 62 | + // If enabled, allow any array-like type to be cast to null. |
| 63 | + // This is an incremental step in migrating away from null_casts_as_any_type. |
| 64 | + // If null_casts_as_any_type is true, this has no effect. |
| 65 | + 'array_casts_as_null' => false, |
| 66 | + |
| 67 | + // If enabled, scalars (int, float, bool, string, null) |
| 68 | + // are treated as if they can cast to each other. |
| 69 | + // This does not affect checks of array keys. See scalar_array_key_cast. |
| 70 | + 'scalar_implicit_cast' => false, |
| 71 | + |
| 72 | + // If enabled, any scalar array keys (int, string) |
| 73 | + // are treated as if they can cast to each other. |
| 74 | + // E.g. array<int,stdClass> can cast to array<string,stdClass> and vice versa. |
| 75 | + // Normally, a scalar type such as int could only cast to/from int and mixed. |
| 76 | + 'scalar_array_key_cast' => false, |
| 77 | + |
| 78 | + // If this has entries, scalars (int, float, bool, string, null) |
| 79 | + // are allowed to perform the casts listed. |
| 80 | + // E.g. ['int' => ['float', 'string'], 'float' => ['int'], 'string' => ['int'], 'null' => ['string']] |
| 81 | + // allows casting null to a string, but not vice versa. |
| 82 | + // (subset of scalar_implicit_cast) |
| 83 | + 'scalar_implicit_partial' => [], |
| 84 | + |
| 85 | + // If true, seemingly undeclared variables in the global |
| 86 | + // scope will be ignored. This is useful for projects |
| 87 | + // with complicated cross-file globals that you have no |
| 88 | + // hope of fixing. |
| 89 | + 'ignore_undeclared_variables_in_global_scope' => false, |
| 90 | + |
| 91 | + // Backwards Compatibility Checking. This is slow |
| 92 | + // and expensive, but you should consider running |
| 93 | + // it before upgrading your version of PHP to a |
| 94 | + // new version that has backward compatibility |
| 95 | + // breaks. |
| 96 | + 'backward_compatibility_checks' => false, |
| 97 | + |
| 98 | + // If true, check to make sure the return type declared |
| 99 | + // in the doc-block (if any) matches the return type |
| 100 | + // declared in the method signature. |
| 101 | + 'check_docblock_signature_return_type_match' => true, |
| 102 | + |
| 103 | + // (*Requires check_docblock_signature_param_type_match to be true*) |
| 104 | + // If true, make narrowed types from phpdoc params override |
| 105 | + // the real types from the signature, when real types exist. |
| 106 | + // (E.g. allows specifying desired lists of subclasses, |
| 107 | + // or to indicate a preference for non-nullable types over nullable types) |
| 108 | + // Affects analysis of the body of the method and the param types passed in by callers. |
| 109 | + 'prefer_narrowed_phpdoc_param_type' => true, |
| 110 | + |
| 111 | + // (*Requires check_docblock_signature_return_type_match to be true*) |
| 112 | + // If true, make narrowed types from phpdoc returns override |
| 113 | + // the real types from the signature, when real types exist. |
| 114 | + // (E.g. allows specifying desired lists of subclasses, |
| 115 | + // or to indicate a preference for non-nullable types over nullable types) |
| 116 | + // Affects analysis of return statements in the body of the method and the return types passed in by callers. |
| 117 | + 'prefer_narrowed_phpdoc_return_type' => true, |
| 118 | + |
| 119 | + 'ensure_signature_compatibility' => true, |
| 120 | + |
| 121 | + // Set to true in order to attempt to detect dead |
| 122 | + // (unreferenced) code. Keep in mind that the |
| 123 | + // results will only be a guess given that classes, |
| 124 | + // properties, constants and methods can be referenced |
| 125 | + // as variables (like `$class->$property` or |
| 126 | + // `$class->$method()`) in ways that we're unable |
| 127 | + // to make sense of. |
| 128 | + 'dead_code_detection' => false, |
| 129 | + |
| 130 | + // If true, this run a quick version of checks that takes less |
| 131 | + // time at the cost of not running as thorough |
| 132 | + // an analysis. You should consider setting this |
| 133 | + // to true only when you wish you had more **undiagnosed** issues |
| 134 | + // to fix in your code base. |
| 135 | + // |
| 136 | + // In quick-mode the scanner doesn't rescan a function |
| 137 | + // or a method's code block every time a call is seen. |
| 138 | + // This means that the problem here won't be detected: |
| 139 | + // |
| 140 | + // ```php |
| 141 | + // <?php |
| 142 | + // function test($arg):int { |
| 143 | + // return $arg; |
| 144 | + // } |
| 145 | + // test("abc"); |
| 146 | + // ``` |
| 147 | + // |
| 148 | + // This would normally generate: |
| 149 | + // |
| 150 | + // ```sh |
| 151 | + // test.php:3 TypeError return string but `test()` is declared to return int |
| 152 | + // ``` |
| 153 | + // |
| 154 | + // The initial scan of the function's code block has no |
| 155 | + // type information for `$arg`. It isn't until we see |
| 156 | + // the call and rescan test()'s code block that we can |
| 157 | + // detect that it is actually returning the passed in |
| 158 | + // `string` instead of an `int` as declared. |
| 159 | + 'quick_mode' => false, |
| 160 | + |
| 161 | + // If true, then before analysis, try to simplify AST into a form |
| 162 | + // which improves Phan's type inference in edge cases. |
| 163 | + // |
| 164 | + // This may conflict with 'dead_code_detection'. |
| 165 | + // When this is true, this slows down analysis slightly. |
| 166 | + // |
| 167 | + // E.g. rewrites `if ($a = value() && $a > 0) {...}` |
| 168 | + // into $a = value(); if ($a) { if ($a > 0) {...}}` |
| 169 | + 'simplify_ast' => true, |
| 170 | + |
| 171 | + // Enable or disable support for generic templated |
| 172 | + // class types. |
| 173 | + 'generic_types_enabled' => true, |
| 174 | + |
| 175 | + // Override to hardcode existence and types of (non-builtin) globals in the global scope. |
| 176 | + // Class names should be prefixed with '\\'. |
| 177 | + // (E.g. ['_FOO' => '\\FooClass', 'page' => '\\PageClass', 'userId' => 'int']) |
| 178 | + 'globals_type_map' => [], |
| 179 | + |
| 180 | + // The minimum severity level to report on. This can be |
| 181 | + // set to Issue::SEVERITY_LOW, Issue::SEVERITY_NORMAL or |
| 182 | + // Issue::SEVERITY_CRITICAL. Setting it to only |
| 183 | + // critical issues is a good place to start on a big |
| 184 | + // sloppy mature code base. |
| 185 | + 'minimum_severity' => Issue::SEVERITY_LOW, |
| 186 | + |
| 187 | + // Add any issue types (such as 'PhanUndeclaredMethod') |
| 188 | + // to this black-list to inhibit them from being reported. |
| 189 | + 'suppress_issue_types' => [ |
| 190 | + 'PhanTypeMismatchDeclaredParamNullable', |
| 191 | + 'PhanUndeclaredProperty', // 66 occurence(s) (e.g. not being specific enough about the subclass) |
| 192 | + 'PhanUndeclaredMethod', // 32 occurence(s) (e.g. not being specific enough about the subclass of Node) |
| 193 | + 'PhanTypeMismatchArgument', // 21 occurence(s) |
| 194 | + 'PhanTypeMismatchProperty', // 13 occurence(s) |
| 195 | + 'PhanUnreferencedUseNormal', // 10 occurence(s) TODO: Fix |
| 196 | + 'PhanTypeMismatchDeclaredReturn', // 8 occurence(s) |
| 197 | + 'PhanUndeclaredTypeProperty', // 7 occurence(s) |
| 198 | + 'PhanTypeMismatchReturn', // 6 occurence(s) |
| 199 | + 'PhanUndeclaredVariable', // 4 occurence(s) |
| 200 | + 'PhanUndeclaredTypeReturnType', // 4 occurence(s) |
| 201 | + 'PhanParamTooMany', // 3 occurence(s) |
| 202 | + 'PhanUndeclaredTypeParameter', // 2 occurence(s) |
| 203 | + 'PhanUndeclaredClassProperty', // 2 occurence(s) |
| 204 | + 'PhanTypeSuspiciousStringExpression', // 2 occurence(s) |
| 205 | + 'PhanTypeMismatchArgumentInternal', // 2 occurence(s) |
| 206 | + 'PhanUnextractableAnnotationElementName', // 1 occurence(s) |
| 207 | + 'PhanUndeclaredClassMethod', // 1 occurence(s) |
| 208 | + 'PhanUndeclaredClassInstanceof', // 1 occurence(s) |
| 209 | + 'PhanTypeSuspiciousNonTraversableForeach', // 1 occurence(s) |
| 210 | + 'PhanTypeMismatchDimAssignment', // 1 occurence(s) |
| 211 | + 'PhanTypeMismatchDeclaredParam', // 1 occurence(s) |
| 212 | + 'PhanTypeInvalidDimOffset', // 1 occurence(s) |
| 213 | + ], |
| 214 | + |
| 215 | + // A regular expression to match files to be excluded |
| 216 | + // from parsing and analysis and will not be read at all. |
| 217 | + // |
| 218 | + // This is useful for excluding groups of test or example |
| 219 | + // directories/files, unanalyzable files, or files that |
| 220 | + // can't be removed for whatever reason. |
| 221 | + // (e.g. '@Test\.php$@', or '@vendor/.*/(tests|Tests)/@') |
| 222 | + 'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@', |
| 223 | + |
| 224 | + // A file list that defines files that will be excluded |
| 225 | + // from parsing and analysis and will not be read at all. |
| 226 | + // |
| 227 | + // This is useful for excluding hopelessly unanalyzable |
| 228 | + // files that can't be removed for whatever reason. |
| 229 | + 'exclude_file_list' => [], |
| 230 | + |
| 231 | + // A directory list that defines files that will be excluded |
| 232 | + // from static analysis, but whose class and method |
| 233 | + // information should be included. |
| 234 | + // |
| 235 | + // Generally, you'll want to include the directories for |
| 236 | + // third-party code (such as "vendor/") in this list. |
| 237 | + // |
| 238 | + // n.b.: If you'd like to parse but not analyze 3rd |
| 239 | + // party code, directories containing that code |
| 240 | + // should be added to the `directory_list` as |
| 241 | + // to `excluce_analysis_directory_list`. |
| 242 | + 'exclude_analysis_directory_list' => [ |
| 243 | + 'vendor/', |
| 244 | + ], |
| 245 | + |
| 246 | + // The number of processes to fork off during the analysis |
| 247 | + // phase. |
| 248 | + 'processes' => 1, |
| 249 | + |
| 250 | + // List of case-insensitive file extensions supported by Phan. |
| 251 | + // (e.g. php, html, htm) |
| 252 | + 'analyzed_file_extensions' => [ |
| 253 | + 'php', |
| 254 | + ], |
| 255 | + |
| 256 | + // You can put paths to stubs of internal extensions in this config option. |
| 257 | + // If the corresponding extension is **not** loaded, then phan will use the stubs instead. |
| 258 | + // Phan will continue using its detailed type annotations, |
| 259 | + // but load the constants, classes, functions, and classes (and their Reflection types) |
| 260 | + // from these stub files (doubling as valid php files). |
| 261 | + // Use a different extension from php to avoid accidentally loading these. |
| 262 | + // The 'tools/make_stubs' script can be used to generate your own stubs (compatible with php 7.0+ right now) |
| 263 | + 'autoload_internal_extension_signatures' => [], |
| 264 | + |
| 265 | + // A list of plugin files to execute |
| 266 | + // Plugins which are bundled with Phan can be added here by providing their name (e.g. 'AlwaysReturnPlugin') |
| 267 | + // 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') |
| 268 | + 'plugins' => [ |
| 269 | + 'AlwaysReturnPlugin', |
| 270 | + 'DollarDollarPlugin', |
| 271 | + 'DuplicateArrayKeyPlugin', |
| 272 | + 'PregRegexCheckerPlugin', |
| 273 | + 'PrintfCheckerPlugin', |
| 274 | + 'UnreachableCodePlugin', |
| 275 | + ], |
| 276 | + |
| 277 | + // A list of directories that should be parsed for class and |
| 278 | + // method information. After excluding the directories |
| 279 | + // defined in exclude_analysis_directory_list, the remaining |
| 280 | + // files will be statically analyzed for errors. |
| 281 | + // |
| 282 | + // Thus, both first-party and third-party code being used by |
| 283 | + // your application should be included in this list. |
| 284 | + 'directory_list' => [ |
| 285 | + 'src', |
| 286 | + 'vendor/composer/xdebug-handler/src', |
| 287 | + 'vendor/felixfbecker/advanced-json-rpc/lib', |
| 288 | + 'vendor/felixfbecker/language-server-protocol/src/', |
| 289 | + 'vendor/microsoft/tolerant-php-parser/src', |
| 290 | + 'vendor/netresearch/jsonmapper/src', |
| 291 | + 'vendor/phpdocumentor/reflection-common/src', |
| 292 | + 'vendor/phpdocumentor/reflection-docblock/src', |
| 293 | + 'vendor/phpdocumentor/type-resolver/src', |
| 294 | + 'vendor/phpunit/phpunit/src', |
| 295 | + 'vendor/psr/log/Psr', |
| 296 | + 'vendor/sabre/event/lib', |
| 297 | + 'vendor/sabre/uri/lib', |
| 298 | + 'vendor/webmozart/glob/src', |
| 299 | + 'vendor/webmozart/path-util/src', |
| 300 | + ], |
| 301 | + |
| 302 | + // A list of individual files to include in analysis |
| 303 | + // with a path relative to the root directory of the |
| 304 | + // project |
| 305 | + 'file_list' => [ |
| 306 | + 'bin/php-language-server.php', |
| 307 | + ], |
| 308 | +]; |
0 commit comments