Skip to content

Commit f90ad87

Browse files
committed
First version
0 parents  commit f90ad87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+5690
-0
lines changed

.gitattributes

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
* text=auto
2+
*.md text diff=markdown
3+
*.json text
4+
*.toml text
5+
*.xml text
6+
*.yaml text
7+
*.yml text
8+
*.php text diff=php
9+
.php_cs text diff=php
10+
*.lock text -diff
11+
Makefile text
12+
13+
#
14+
# Exclude files from exporting
15+
#
16+
17+
/.phan export-ignore
18+
/.gitattributes export-ignore
19+
/.gitignore export-ignore
20+
/.php_cs export-ignore
21+
/.unused.php export-ignore
22+
/CHANGELOG.md export-ignore
23+
/CONTRIBUTING.md export-ignore
24+
/Makefile export-ignore
25+
/phpmd.xml export-ignore
26+
/phpstan.neon export-ignore
27+
/psalm.xml export-ignore

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/composer.phar
2+
/vendor/
3+
/composer.lock
4+
5+
/.php_cs.cache

.phan/config.php

Lines changed: 346 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,346 @@
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 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' => '7.1',
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' => false,
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' => false,
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' => false,
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' => true,
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' => true,
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' => true,
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' => true,
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' => true,
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' => false,
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' => false,
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' => true,
152+
153+
// This setting maps case-insensitive strings to union types.
154+
//
155+
// This is useful if a project uses phpdoc that differs from the phpdoc2 standard.
156+
//
157+
// If the corresponding value is the empty string,
158+
// then Phan will ignore that union type (E.g. can ignore 'the' in `@return the value`)
159+
//
160+
// If the corresponding value is not empty,
161+
// then Phan will act as though it saw the corresponding UnionTypes(s)
162+
// when the keys show up in a UnionType of `@param`, `@return`, `@var`, `@property`, etc.
163+
//
164+
// This matches the **entire string**, not parts of the string.
165+
// (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)
166+
//
167+
// (These are not aliases, this setting is ignored outside of doc comments).
168+
// (Phan does not check if classes with these names exist)
169+
//
170+
// Example setting: `['unknown' => '', 'number' => 'int|float', 'char' => 'string', 'long' => 'int', 'the' => '']`
171+
'phpdoc_type_mapping' => [],
172+
173+
// Set to true in order to attempt to detect dead
174+
// (unreferenced) code. Keep in mind that the
175+
// results will only be a guess given that classes,
176+
// properties, constants and methods can be referenced
177+
// as variables (like `$class->$property` or
178+
// `$class->$method()`) in ways that we're unable
179+
// to make sense of.
180+
'dead_code_detection' => false,
181+
182+
// Set to true in order to attempt to detect unused variables.
183+
// `dead_code_detection` will also enable unused variable detection.
184+
//
185+
// This has a few known false positives, e.g. for loops or branches.
186+
'unused_variable_detection' => true,
187+
188+
// Set to true in order to attempt to detect redundant and impossible conditions.
189+
//
190+
// This has some false positives involving loops,
191+
// variables set in branches of loops, and global variables.
192+
'redundant_condition_detection' => true,
193+
194+
// If enabled, Phan will act as though it's certain of real return types of a subset of internal functions,
195+
// 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).
196+
//
197+
// 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.
198+
// 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.
199+
'assume_real_types_for_internal_functions' => true,
200+
201+
// If true, this runs a quick version of checks that takes less
202+
// time at the cost of not running as thorough
203+
// of an analysis. You should consider setting this
204+
// to true only when you wish you had more **undiagnosed** issues
205+
// to fix in your code base.
206+
//
207+
// In quick-mode the scanner doesn't rescan a function
208+
// or a method's code block every time a call is seen.
209+
// This means that the problem here won't be detected:
210+
//
211+
// ```php
212+
// <?php
213+
// function test($arg):int {
214+
// return $arg;
215+
// }
216+
// test("abc");
217+
// ```
218+
//
219+
// This would normally generate:
220+
//
221+
// ```
222+
// test.php:3 PhanTypeMismatchReturn Returning type string but test() is declared to return int
223+
// ```
224+
//
225+
// The initial scan of the function's code block has no
226+
// type information for `$arg`. It isn't until we see
227+
// the call and rescan `test()`'s code block that we can
228+
// detect that it is actually returning the passed in
229+
// `string` instead of an `int` as declared.
230+
'quick_mode' => false,
231+
232+
// Override to hardcode existence and types of (non-builtin) globals in the global scope.
233+
// Class names should be prefixed with `\`.
234+
//
235+
// (E.g. `['_FOO' => '\FooClass', 'page' => '\PageClass', 'userId' => 'int']`)
236+
'globals_type_map' => [],
237+
238+
// The minimum severity level to report on. This can be
239+
// set to `Issue::SEVERITY_LOW`, `Issue::SEVERITY_NORMAL` or
240+
// `Issue::SEVERITY_CRITICAL`. Setting it to only
241+
// critical issues is a good place to start on a big
242+
// sloppy mature code base.
243+
'minimum_severity' => Issue::SEVERITY_LOW,
244+
245+
// Add any issue types (such as `'PhanUndeclaredMethod'`)
246+
// to this black-list to inhibit them from being reported.
247+
'suppress_issue_types' => [],
248+
249+
// A regular expression to match files to be excluded
250+
// from parsing and analysis and will not be read at all.
251+
//
252+
// This is useful for excluding groups of test or example
253+
// directories/files, unanalyzable files, or files that
254+
// can't be removed for whatever reason.
255+
// (e.g. `'@Test\.php$@'`, or `'@vendor/.*/(tests|Tests)/@'`)
256+
'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',
257+
258+
// A list of files that will be excluded from parsing and analysis
259+
// and will not be read at all.
260+
//
261+
// This is useful for excluding hopelessly unanalyzable
262+
// files that can't be removed for whatever reason.
263+
'exclude_file_list' => [
264+
'src/Kernel.php'
265+
],
266+
267+
// A directory list that defines files that will be excluded
268+
// from static analysis, but whose class and method
269+
// information should be included.
270+
//
271+
// Generally, you'll want to include the directories for
272+
// third-party code (such as "vendor/") in this list.
273+
//
274+
// n.b.: If you'd like to parse but not analyze 3rd
275+
// party code, directories containing that code
276+
// should be added to the `directory_list` as well as
277+
// to `exclude_analysis_directory_list`.
278+
'exclude_analysis_directory_list' => [
279+
'vendor/',
280+
'src/DataFixtures/',
281+
],
282+
283+
// Enable this to enable checks of require/include statements referring to valid paths.
284+
// The settings `include_paths` and `warn_about_relative_include_statement` affect the checks.
285+
'enable_include_path_checks' => true,
286+
287+
// The number of processes to fork off during the analysis
288+
// phase.
289+
'processes' => 1,
290+
291+
// List of case-insensitive file extensions supported by Phan.
292+
// (e.g. `['php', 'html', 'htm']`)
293+
'analyzed_file_extensions' => [
294+
'php',
295+
],
296+
297+
// You can put paths to stubs of internal extensions in this config option.
298+
// If the corresponding extension is **not** loaded, then Phan will use the stubs instead.
299+
// Phan will continue using its detailed type annotations,
300+
// but load the constants, classes, functions, and classes (and their Reflection types)
301+
// from these stub files (doubling as valid php files).
302+
// Use a different extension from php to avoid accidentally loading these.
303+
// The `tools/make_stubs` script can be used to generate your own stubs (compatible with php 7.0+ right now)
304+
//
305+
// (e.g. `['xdebug' => '.phan/internal_stubs/xdebug.phan_php']`)
306+
'autoload_internal_extension_signatures' => [],
307+
308+
// A list of plugin files to execute.
309+
//
310+
// Plugins which are bundled with Phan can be added here by providing their name (e.g. `'AlwaysReturnPlugin'`)
311+
//
312+
// Documentation about available bundled plugins can be found [here](https://github.com/phan/phan/tree/master/.phan/plugins).
313+
//
314+
// 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'`)
315+
'plugins' => [
316+
'AlwaysReturnPlugin',
317+
'DollarDollarPlugin',
318+
'DuplicateArrayKeyPlugin',
319+
'DuplicateExpressionPlugin',
320+
'PregRegexCheckerPlugin',
321+
'PrintfCheckerPlugin',
322+
'SleepCheckerPlugin',
323+
'UnreachableCodePlugin',
324+
'UseReturnValuePlugin',
325+
'EmptyStatementListPlugin',
326+
'StrictComparisonPlugin',
327+
'LoopVariableReusePlugin',
328+
],
329+
330+
// A list of directories that should be parsed for class and
331+
// method information. After excluding the directories
332+
// defined in `exclude_analysis_directory_list`, the remaining
333+
// files will be statically analyzed for errors.
334+
//
335+
// Thus, both first-party and third-party code being used by
336+
// your application should be included in this list.
337+
'directory_list' => [
338+
'src',
339+
'vendor/predis/predis',
340+
],
341+
342+
// A list of individual files to include in analysis
343+
// with a path relative to the root directory of the
344+
// project.
345+
'file_list' => [],
346+
];

0 commit comments

Comments
 (0)