|
| 1 | +<?php |
| 2 | + |
| 3 | +use \Phan\Issue; |
| 4 | + |
| 5 | +/** |
| 6 | + * This configuration will be read and overlayed on top of the |
| 7 | + * default configuration. Command line arguments will be applied |
| 8 | + * after this file is read. |
| 9 | + * |
| 10 | + * @see src/Phan/Config.php |
| 11 | + * See Config for all configurable options. |
| 12 | + * |
| 13 | + * A Note About Paths |
| 14 | + * ================== |
| 15 | + * |
| 16 | + * Files referenced from this file should be defined as |
| 17 | + * |
| 18 | + * ``` |
| 19 | + * Config::projectPath('relative_path/to/file') |
| 20 | + * ``` |
| 21 | + * |
| 22 | + * where the relative path is relative to the root of the |
| 23 | + * project which is defined as either the working directory |
| 24 | + * of the phan executable or a path passed in via the CLI |
| 25 | + * '-d' flag. |
| 26 | + */ |
| 27 | +return [ |
| 28 | + |
| 29 | + // If true, missing properties will be created when |
| 30 | + // they are first seen. If false, we'll report an |
| 31 | + // error message. |
| 32 | + "allow_missing_properties" => false, |
| 33 | + |
| 34 | + // Allow null to be cast as any type and for any |
| 35 | + // type to be cast to null. |
| 36 | + "null_casts_as_any_type" => false, |
| 37 | + |
| 38 | + // If enabled, scalars (int, float, bool, string, null) |
| 39 | + // are treated as if they can cast to each other. |
| 40 | + 'scalar_implicit_cast' => false, |
| 41 | + |
| 42 | + // If true, seemingly undeclared variables in the global |
| 43 | + // scope will be ignored. This is useful for projects |
| 44 | + // with complicated cross-file globals that you have no |
| 45 | + // hope of fixing. |
| 46 | + 'ignore_undeclared_variables_in_global_scope' => false, |
| 47 | + |
| 48 | + // Backwards Compatibility Checking |
| 49 | + 'backward_compatibility_checks' => false, |
| 50 | + |
| 51 | + // If true, check to make sure the return type declared |
| 52 | + // in the doc-block (if any) matches the return type |
| 53 | + // declared in the method signature. This process is |
| 54 | + // slow. |
| 55 | + 'check_docblock_signature_return_type_match' => true, |
| 56 | + |
| 57 | + // If true, check to make sure the return type declared |
| 58 | + // in the doc-block (if any) matches the return type |
| 59 | + // declared in the method signature. This process is |
| 60 | + // slow. |
| 61 | + 'check_docblock_signature_param_type_match' => true, |
| 62 | + |
| 63 | + // (*Requires check_docblock_signature_param_type_match to be true*) |
| 64 | + // If true, make narrowed types from phpdoc override |
| 65 | + // the real types from the signature, when real types exist. |
| 66 | + // Ignore incompatible or wider phpdoc union types. |
| 67 | + // (E.g. allows specifying desired lists of subclasses, |
| 68 | + // or to indicate a preference for non-nullable types over nullable types) |
| 69 | + // Affects analysis of the body of the method and the param types passed in by callers. |
| 70 | + 'prefer_narrowed_phpdoc_param_types' => true, |
| 71 | + |
| 72 | + // If enabled, check all methods that override a |
| 73 | + // parent method to make sure its signature is |
| 74 | + // compatible with the parent's. This check |
| 75 | + // can add quite a bit of time to the analysis. |
| 76 | + 'analyze_signature_compatibility' => true, |
| 77 | + |
| 78 | + // Set to true in order to attempt to detect dead |
| 79 | + // (unreferenced) code. Keep in mind that the |
| 80 | + // results will only be a guess given that classes, |
| 81 | + // properties, constants and methods can be referenced |
| 82 | + // as variables (like `$class->$property` or |
| 83 | + // `$class->$method()`) in ways that we're unable |
| 84 | + // to make sense of. |
| 85 | + 'dead_code_detection' => false, |
| 86 | + |
| 87 | + // Run a quick version of checks that takes less |
| 88 | + // time |
| 89 | + "quick_mode" => false, |
| 90 | + |
| 91 | + // If true, then try to simplify AST into a form which improves Phan's type inference. |
| 92 | + // E.g. rewrites `if (!is_string($foo)) { return; } b($foo);` |
| 93 | + // into `if (is_string($foo)) {b($foo);} else {return;}` |
| 94 | + // This may conflict with 'dead_code_detection' |
| 95 | + // This slows down analysis noticeably. |
| 96 | + "simplify_ast" => false, |
| 97 | + |
| 98 | + // Enable or disable support for generic templated |
| 99 | + // class types. |
| 100 | + 'generic_types_enabled' => true, |
| 101 | + |
| 102 | + // Setting this to true makes the process assignment for file analysis |
| 103 | + // as predictable as possible, using consistent hashing. |
| 104 | + // Even if files are added or removed, or process counts change, |
| 105 | + // relatively few files will move to a different group. |
| 106 | + // (use when the number of files is much larger than the process count) |
| 107 | + // NOTE: If you rely on Phan parsing files/directories in the order |
| 108 | + // that they were provided in this config, don't use this) |
| 109 | + // See https://github.com/etsy/phan/wiki/Different-Issue-Sets-On-Different-Numbers-of-CPUs |
| 110 | + 'consistent_hashing_file_order' => false, |
| 111 | + |
| 112 | + // Override to hardcode existence and types of (non-builtin) globals. |
| 113 | + // Class names must be prefixed with '\\'. |
| 114 | + 'globals_type_map' => [], |
| 115 | + |
| 116 | + // The minimum severity level to report on. This can be |
| 117 | + // set to Issue::SEVERITY_LOW, Issue::SEVERITY_NORMAL or |
| 118 | + // Issue::SEVERITY_CRITICAL. |
| 119 | + 'minimum_severity' => Issue::SEVERITY_LOW, |
| 120 | + |
| 121 | + // Add any issue types (such as 'PhanUndeclaredMethod') |
| 122 | + // here to inhibit them from being reported |
| 123 | + 'suppress_issue_types' => [ |
| 124 | + // 'PhanUndeclaredMethod', |
| 125 | + ], |
| 126 | + |
| 127 | + // If empty, no filter against issues types will be applied. |
| 128 | + // If non-empty, only issues within the list will be emitted |
| 129 | + // by Phan. |
| 130 | + 'whitelist_issue_types' => [ |
| 131 | + // 'PhanAccessMethodPrivate', |
| 132 | + // 'PhanAccessMethodProtected', |
| 133 | + // 'PhanAccessNonStaticToStatic', |
| 134 | + // 'PhanAccessPropertyPrivate', |
| 135 | + // 'PhanAccessPropertyProtected', |
| 136 | + // 'PhanAccessSignatureMismatch', |
| 137 | + // 'PhanAccessSignatureMismatchInternal', |
| 138 | + // 'PhanAccessStaticToNonStatic', |
| 139 | + // 'PhanCompatibleExpressionPHP7', |
| 140 | + // 'PhanCompatiblePHP7', |
| 141 | + // 'PhanContextNotObject', |
| 142 | + // 'PhanDeprecatedClass', |
| 143 | + // 'PhanDeprecatedFunction', |
| 144 | + // 'PhanDeprecatedProperty', |
| 145 | + // 'PhanEmptyFile', |
| 146 | + // 'PhanNonClassMethodCall', |
| 147 | + // 'PhanNoopArray', |
| 148 | + // 'PhanNoopClosure', |
| 149 | + // 'PhanNoopConstant', |
| 150 | + // 'PhanNoopProperty', |
| 151 | + // 'PhanNoopVariable', |
| 152 | + // 'PhanParamRedefined', |
| 153 | + // 'PhanParamReqAfterOpt', |
| 154 | + // 'PhanParamSignatureMismatch', |
| 155 | + // 'PhanParamSignatureMismatchInternal', |
| 156 | + // 'PhanParamSpecial1', |
| 157 | + // 'PhanParamSpecial2', |
| 158 | + // 'PhanParamSpecial3', |
| 159 | + // 'PhanParamSpecial4', |
| 160 | + // 'PhanParamTooFew', |
| 161 | + // 'PhanParamTooFewInternal', |
| 162 | + // 'PhanParamTooMany', |
| 163 | + // 'PhanParamTooManyInternal', |
| 164 | + // 'PhanParamTypeMismatch', |
| 165 | + // 'PhanParentlessClass', |
| 166 | + // 'PhanRedefineClass', |
| 167 | + // 'PhanRedefineClassInternal', |
| 168 | + // 'PhanRedefineFunction', |
| 169 | + // 'PhanRedefineFunctionInternal', |
| 170 | + // 'PhanStaticCallToNonStatic', |
| 171 | + // 'PhanSyntaxError', |
| 172 | + // 'PhanTraitParentReference', |
| 173 | + // 'PhanTypeArrayOperator', |
| 174 | + // 'PhanTypeArraySuspicious', |
| 175 | + // 'PhanTypeComparisonFromArray', |
| 176 | + // 'PhanTypeComparisonToArray', |
| 177 | + // 'PhanTypeConversionFromArray', |
| 178 | + // 'PhanTypeInstantiateAbstract', |
| 179 | + // 'PhanTypeInstantiateInterface', |
| 180 | + // 'PhanTypeInvalidLeftOperand', |
| 181 | + // 'PhanTypeInvalidRightOperand', |
| 182 | + // 'PhanTypeMismatchArgument', |
| 183 | + // 'PhanTypeMismatchArgumentInternal', |
| 184 | + // 'PhanTypeMismatchDefault', |
| 185 | + // 'PhanTypeMismatchForeach', |
| 186 | + // 'PhanTypeMismatchProperty', |
| 187 | + // 'PhanTypeMismatchReturn', |
| 188 | + // 'PhanTypeMissingReturn', |
| 189 | + // 'PhanTypeNonVarPassByRef', |
| 190 | + // 'PhanTypeParentConstructorCalled', |
| 191 | + // 'PhanTypeVoidAssignment', |
| 192 | + // 'PhanUnanalyzable', |
| 193 | + // 'PhanUndeclaredClass', |
| 194 | + // 'PhanUndeclaredClassCatch', |
| 195 | + // 'PhanUndeclaredClassConstant', |
| 196 | + // 'PhanUndeclaredClassInstanceof', |
| 197 | + // 'PhanUndeclaredClassMethod', |
| 198 | + // 'PhanUndeclaredClassReference', |
| 199 | + // 'PhanUndeclaredConstant', |
| 200 | + // 'PhanUndeclaredExtendedClass', |
| 201 | + // 'PhanUndeclaredFunction', |
| 202 | + // 'PhanUndeclaredInterface', |
| 203 | + // 'PhanUndeclaredMethod', |
| 204 | + // 'PhanUndeclaredProperty', |
| 205 | + // 'PhanUndeclaredStaticMethod', |
| 206 | + // 'PhanUndeclaredStaticProperty', |
| 207 | + // 'PhanUndeclaredTrait', |
| 208 | + // 'PhanUndeclaredTypeParameter', |
| 209 | + // 'PhanUndeclaredTypeProperty', |
| 210 | + // 'PhanUndeclaredVariable', |
| 211 | + // 'PhanUnreferencedClass', |
| 212 | + // 'PhanUnreferencedConstant', |
| 213 | + // 'PhanUnreferencedMethod', |
| 214 | + // 'PhanUnreferencedProperty', |
| 215 | + // 'PhanVariableUseClause', |
| 216 | + ], |
| 217 | + |
| 218 | + // A list of files to include in analysis |
| 219 | + 'file_list' => [ |
| 220 | + ], |
| 221 | + |
| 222 | + // A regular expression to match files to be excluded |
| 223 | + // from parsing and analysis and will not be read at all. |
| 224 | + // |
| 225 | + // This is useful for excluding groups of test or example |
| 226 | + // directories/files, unanalyzable files, or files that |
| 227 | + // can't be removed for whatever reason. |
| 228 | + // (e.g. '@Test\.php$@', or '@vendor/.*/(tests|Tests)/@') |
| 229 | + 'exclude_file_regex' => '@^vendor/.*/(tests|Tests)/@', |
| 230 | + |
| 231 | + // A file list that defines files that will be excluded |
| 232 | + // from parsing and analysis and will not be read at all. |
| 233 | + // |
| 234 | + // This is useful for excluding hopelessly unanalyzable |
| 235 | + // files that can't be removed for whatever reason. |
| 236 | + 'exclude_file_list' => [], |
| 237 | + |
| 238 | + // The number of processes to fork off during the analysis |
| 239 | + // phase. |
| 240 | + 'processes' => 1, |
| 241 | + |
| 242 | + // A list of directories that should be parsed for class and |
| 243 | + // method information. After excluding the directories |
| 244 | + // defined in exclude_analysis_directory_list, the remaining |
| 245 | + // files will be statically analyzed for errors. |
| 246 | + // |
| 247 | + // Thus, both first-party and third-party code being used by |
| 248 | + // your application should be included in this list. |
| 249 | + 'directory_list' => [ |
| 250 | + 'src/', |
| 251 | + 'tests/', |
| 252 | + 'vendor/phpspec/prophecy/src/Prophecy/', |
| 253 | + 'vendor/phpunit/php-code-coverage/src/', |
| 254 | + 'vendor/phpunit/php-file-iterator/src/', |
| 255 | + 'vendor/phpunit/php-text-template/src/', |
| 256 | + 'vendor/phpunit/php-timer/src/', |
| 257 | + 'vendor/phpunit/php-token-stream/src/', |
| 258 | + 'vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/', |
| 259 | + 'vendor/sebastian/comparator/src/', |
| 260 | + 'vendor/sebastian/diff/src/', |
| 261 | + 'vendor/sebastian/environment/src/', |
| 262 | + 'vendor/sebastian/exporter/src/', |
| 263 | + 'vendor/sebastian/global-state/src/', |
| 264 | + 'vendor/sebastian/recursion-context/src/', |
| 265 | + 'vendor/sebastian/version/src/', |
| 266 | + ], |
| 267 | + |
| 268 | + // List of case-insensitive file extensions supported by Phan. |
| 269 | + // (e.g. php, html, htm) |
| 270 | + 'analyzed_file_extensions' => ['php'], |
| 271 | + |
| 272 | + // A directory list that defines files that will be excluded |
| 273 | + // from static analysis, but whose class and method |
| 274 | + // information should be included. |
| 275 | + // |
| 276 | + // Generally, you'll want to include the directories for |
| 277 | + // third-party code (such as "vendor/") in this list. |
| 278 | + // |
| 279 | + // n.b.: If you'd like to parse but not analyze 3rd |
| 280 | + // party code, directories containing that code |
| 281 | + // should be added to the `directory_list` as |
| 282 | + // to `exclude_analysis_directory_list`. |
| 283 | + "exclude_analysis_directory_list" => [ |
| 284 | + 'vendor/' |
| 285 | + ], |
| 286 | + |
| 287 | + // A list of plugin files to execute |
| 288 | + 'plugins' => [ |
| 289 | + ], |
| 290 | + |
| 291 | +]; |
0 commit comments