From 237222c9816ad8bd1dba142427f72819dbba395e Mon Sep 17 00:00:00 2001 From: Vladimir Vukanac Date: Sun, 17 Mar 2019 22:16:25 +0100 Subject: [PATCH 1/5] Add phan and update Travis CI --- .phan/config.php | 356 +++++++++++++++++++++++++++++++++++++++++ .travis.yml | 11 +- README.md | 2 + composer.json | 1 + composer.lock | 408 ++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 774 insertions(+), 4 deletions(-) create mode 100644 .phan/config.php diff --git a/.phan/config.php b/.phan/config.php new file mode 100644 index 0000000..ef6a890 --- /dev/null +++ b/.phan/config.php @@ -0,0 +1,356 @@ + NULL, + + // If enabled, missing properties will be created when + // they are first seen. If false, we'll report an + // error message if there is an attempt to write + // to a class property that wasn't explicitly + // defined. + 'allow_missing_properties' => true, + + // If enabled, null can be cast to any type and any + // type can be cast to null. Setting this to true + // will cut down on false positives. + 'null_casts_as_any_type' => true, + + // If enabled, allow null to be cast as any array-like type. + // + // This is an incremental step in migrating away from `null_casts_as_any_type`. + // If `null_casts_as_any_type` is true, this has no effect. + 'null_casts_as_array' => true, + + // If enabled, allow any array-like type to be cast to null. + // This is an incremental step in migrating away from `null_casts_as_any_type`. + // If `null_casts_as_any_type` is true, this has no effect. + 'array_casts_as_null' => true, + + // If enabled, scalars (int, float, bool, string, null) + // are treated as if they can cast to each other. + // This does not affect checks of array keys. See `scalar_array_key_cast`. + 'scalar_implicit_cast' => true, + + // If enabled, any scalar array keys (int, string) + // are treated as if they can cast to each other. + // E.g. `array` can cast to `array` and vice versa. + // Normally, a scalar type such as int could only cast to/from int and mixed. + 'scalar_array_key_cast' => true, + + // If this has entries, scalars (int, float, bool, string, null) + // are allowed to perform the casts listed. + // + // E.g. `['int' => ['float', 'string'], 'float' => ['int'], 'string' => ['int'], 'null' => ['string']]` + // allows casting null to a string, but not vice versa. + // (subset of `scalar_implicit_cast`) + 'scalar_implicit_partial' => [], + + // If enabled, Phan will warn if **any** type in a method invocation's object + // is definitely not an object, + // or if **any** type in an invoked expression is not a callable. + // Setting this to true will introduce numerous false positives + // (and reveal some bugs). + 'strict_method_checking' => false, + + // If enabled, Phan will warn if **any** type in the argument's union type + // cannot be cast to a type in the parameter's expected union type. + // Setting this to true will introduce numerous false positives + // (and reveal some bugs). + 'strict_param_checking' => false, + + // If enabled, Phan will warn if **any** type in a returned value's union type + // cannot be cast to the declared return type. + // Setting this to true will introduce numerous false positives + // (and reveal some bugs). + 'strict_return_checking' => false, + + // If enabled, Phan will warn if **any** type in a property assignment's union type + // cannot be cast to a type in the property's declared union type. + // Setting this to true will introduce numerous false positives + // (and reveal some bugs). + 'strict_property_checking' => false, + + // If true, seemingly undeclared variables in the global + // scope will be ignored. + // + // This is useful for projects with complicated cross-file + // globals that you have no hope of fixing. + 'ignore_undeclared_variables_in_global_scope' => true, + + // Set this to false to emit `PhanUndeclaredFunction` issues for internal functions that Phan has signatures for, + // but aren't available in the codebase, or the internal functions used to run Phan + // (may lead to false positives if an extension isn't loaded) + // + // If this is true(default), then Phan will not warn. + 'ignore_undeclared_functions_with_known_signatures' => true, + + // Backwards Compatibility Checking. This is slow + // and expensive, but you should consider running + // it before upgrading your version of PHP to a + // new version that has backward compatibility + // breaks. + // + // If you are migrating from PHP 5 to PHP 7, + // you should also look into using + // [php7cc (no longer maintained)](https://github.com/sstalle/php7cc) + // and [php7mar](https://github.com/Alexia/php7mar), + // which have different backwards compatibility checks. + 'backward_compatibility_checks' => false, + + // If true, check to make sure the return type declared + // in the doc-block (if any) matches the return type + // declared in the method signature. + 'check_docblock_signature_return_type_match' => false, + + // If true, make narrowed types from phpdoc params override + // the real types from the signature, when real types exist. + // (E.g. allows specifying desired lists of subclasses, + // or to indicate a preference for non-nullable types over nullable types) + // + // Affects analysis of the body of the method and the param types passed in by callers. + // + // (*Requires `check_docblock_signature_param_type_match` to be true*) + 'prefer_narrowed_phpdoc_param_type' => true, + + // (*Requires `check_docblock_signature_return_type_match` to be true*) + // + // If true, make narrowed types from phpdoc returns override + // the real types from the signature, when real types exist. + // + // (E.g. allows specifying desired lists of subclasses, + // or to indicate a preference for non-nullable types over nullable types) + // + // This setting affects the analysis of return statements in the body of the method and the return types passed in by callers. + 'prefer_narrowed_phpdoc_return_type' => true, + + // If enabled, check all methods that override a + // parent method to make sure its signature is + // compatible with the parent's. + // + // This check can add quite a bit of time to the analysis. + // + // This will also check if final methods are overridden, etc. + 'analyze_signature_compatibility' => false, + + // This setting maps case-insensitive strings to union types. + // + // This is useful if a project uses phpdoc that differs from the phpdoc2 standard. + // + // If the corresponding value is the empty string, + // then Phan will ignore that union type (E.g. can ignore 'the' in `@return the value`) + // + // If the corresponding value is not empty, + // then Phan will act as though it saw the corresponding UnionTypes(s) + // when the keys show up in a UnionType of `@param`, `@return`, `@var`, `@property`, etc. + // + // This matches the **entire string**, not parts of the string. + // (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) + // + // (These are not aliases, this setting is ignored outside of doc comments). + // (Phan does not check if classes with these names exist) + // + // Example setting: `['unknown' => '', 'number' => 'int|float', 'char' => 'string', 'long' => 'int', 'the' => '']` + 'phpdoc_type_mapping' => [], + + // Set to true in order to attempt to detect dead + // (unreferenced) code. Keep in mind that the + // results will only be a guess given that classes, + // properties, constants and methods can be referenced + // as variables (like `$class->$property` or + // `$class->$method()`) in ways that we're unable + // to make sense of. + 'dead_code_detection' => false, + + // Set to true in order to attempt to detect unused variables. + // `dead_code_detection` will also enable unused variable detection. + // + // This has a few known false positives, e.g. for loops or branches. + 'unused_variable_detection' => false, + + // If true, this runs a quick version of checks that takes less + // time at the cost of not running as thorough + // of an analysis. You should consider setting this + // to true only when you wish you had more **undiagnosed** issues + // to fix in your code base. + // + // In quick-mode the scanner doesn't rescan a function + // or a method's code block every time a call is seen. + // This means that the problem here won't be detected: + // + // ```php + // true, + + // If true, then before analysis, try to simplify AST into a form + // which improves Phan's type inference in edge cases. + // + // This may conflict with `dead_code_detection`. + // When this is true, this slows down analysis slightly. + // + // E.g. rewrites `if ($a = value() && $a > 0) {...}` + // into `$a = value(); if ($a) { if ($a > 0) {...}}` + 'simplify_ast' => true, + + // Enable or disable support for generic templated + // class types. + 'generic_types_enabled' => true, + + // Override to hardcode existence and types of (non-builtin) globals in the global scope. + // Class names should be prefixed with `\`. + // + // (E.g. `['_FOO' => '\FooClass', 'page' => '\PageClass', 'userId' => 'int']`) + 'globals_type_map' => [], + + // The minimum severity level to report on. This can be + // set to `Issue::SEVERITY_LOW`, `Issue::SEVERITY_NORMAL` or + // `Issue::SEVERITY_CRITICAL`. Setting it to only + // critical issues is a good place to start on a big + // sloppy mature code base. + 'minimum_severity' => Issue::SEVERITY_NORMAL, + + // Add any issue types (such as `'PhanUndeclaredMethod'`) + // to this black-list to inhibit them from being reported. + 'suppress_issue_types' => [], + + // A regular expression to match files to be excluded + // from parsing and analysis and will not be read at all. + // + // This is useful for excluding groups of test or example + // directories/files, unanalyzable files, or files that + // can't be removed for whatever reason. + // (e.g. `'@Test\.php$@'`, or `'@vendor/.*/(tests|Tests)/@'`) + 'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@', + + // A file list that defines files that will be excluded + // from parsing and analysis and will not be read at all. + // + // This is useful for excluding hopelessly unanalyzable + // files that can't be removed for whatever reason. + 'exclude_file_list' => [], + + // A directory list that defines files that will be excluded + // from static analysis, but whose class and method + // information should be included. + // + // Generally, you'll want to include the directories for + // third-party code (such as "vendor/") in this list. + // + // n.b.: If you'd like to parse but not analyze 3rd + // party code, directories containing that code + // should be added to the `directory_list` as well as + // to `exclude_analysis_directory_list`. + 'exclude_analysis_directory_list' => [ + 'vendor/', + ], + + // Enable this to enable checks of require/include statements referring to valid paths. + 'enable_include_path_checks' => false, + + // The number of processes to fork off during the analysis + // phase. + 'processes' => 1, + + // List of case-insensitive file extensions supported by Phan. + // (e.g. `['php', 'html', 'htm']`) + 'analyzed_file_extensions' => [ + 'php', + ], + + // You can put paths to stubs of internal extensions in this config option. + // If the corresponding extension is **not** loaded, then Phan will use the stubs instead. + // Phan will continue using its detailed type annotations, + // but load the constants, classes, functions, and classes (and their Reflection types) + // from these stub files (doubling as valid php files). + // Use a different extension from php to avoid accidentally loading these. + // The `tools/make_stubs` script can be used to generate your own stubs (compatible with php 7.0+ right now) + // + // (e.g. `['xdebug' => '.phan/internal_stubs/xdebug.phan_php']`) + 'autoload_internal_extension_signatures' => [], + + // A list of plugin files to execute. + // + // Plugins which are bundled with Phan can be added here by providing their name (e.g. `'AlwaysReturnPlugin'`) + // + // Documentation about available bundled plugins can be found [here](https://github.com/phan/phan/tree/master/.phan/plugins). + // + // 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'`) + 'plugins' => [], + + // A list of directories that should be parsed for class and + // method information. After excluding the directories + // defined in `exclude_analysis_directory_list`, the remaining + // files will be statically analyzed for errors. + // + // Thus, both first-party and third-party code being used by + // your application should be included in this list. + 'directory_list' => [ + 'src', + 'vendor/phan/phan/src/Phan', + 'vendor/phpunit/phpunit/src', + 'vendor/sebastian/phpcpd/src', + ], + + // A list of individual files to include in analysis + // with a path relative to the root directory of the + // project. + 'file_list' => [], +]; diff --git a/.travis.yml b/.travis.yml index bafb4a2..61a94fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,13 @@ language: php php: - - 7.2 + - 7.3 - nightly cache: directories: - - $HOME/.composer/cache/files + - $HOME/.composer/cache + - $HOME/.cache/phan-ast/build install: - composer install --no-interaction --prefer-source @@ -19,6 +20,8 @@ before_script: # Run here all same as in `composer ci` script: - composer validate --no-check-all --strict + # Install phan separately because the tolerant-php-parser version may be behind. + - composer create-project phan/phan=1.2.1 ~/phan-install; ~/phan-install/phan - vendor/bin/phpcs --standard=PSR2 src - vendor/bin/phpcpd src tests - vendor/bin/phpunit --coverage-clover=coverage.xml @@ -27,3 +30,7 @@ script: # public repo on Travis CI (without token) after_success: - bash <(curl -s https://codecov.io/bash) + +branches: + only: + - master diff --git a/README.md b/README.md index d48a17e..6b68bfa 100644 --- a/README.md +++ b/README.md @@ -97,3 +97,5 @@ MIT Vladimir Vukanac + composer require --dev phan/phan + pecl install ast diff --git a/composer.json b/composer.json index 7cad050..40a75e6 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "require": { }, "require-dev": { + "phan/phan": "^1.2", "phpunit/phpunit": "^7.4", "sebastian/phpcpd": "^4.1", "squizlabs/php_codesniffer": "^3.3" diff --git a/composer.lock b/composer.lock index dbb8a2d..5b0b6ed 100644 --- a/composer.lock +++ b/composer.lock @@ -1,12 +1,118 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "0b42b8bc1adaef7c2d8af8d7fb863bfb", + "content-hash": "a43389358b4954f299b0ba3921b9140e", "packages": [], "packages-dev": [ + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "1.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "d17708133b6c276d6e42ef887a877866b909d892" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/d17708133b6c276d6e42ef887a877866b909d892", + "reference": "d17708133b6c276d6e42ef887a877866b909d892", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "time": "2019-01-28T20:25:53+00:00" + }, { "name": "doctrine/instantiator", "version": "1.1.0", @@ -61,6 +167,88 @@ ], "time": "2017-07-22T11:58:36+00:00" }, + { + "name": "felixfbecker/advanced-json-rpc", + "version": "v3.0.3", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", + "reference": "241c470695366e7b83672be04ea0e64d8085a551" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/241c470695366e7b83672be04ea0e64d8085a551", + "reference": "241c470695366e7b83672be04ea0e64d8085a551", + "shasum": "" + }, + "require": { + "netresearch/jsonmapper": "^1.0", + "php": ">=7.0", + "phpdocumentor/reflection-docblock": "^4.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "AdvancedJsonRpc\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "A more advanced JSONRPC implementation", + "time": "2018-09-10T08:58:41+00:00" + }, + { + "name": "microsoft/tolerant-php-parser", + "version": "v0.0.16", + "source": { + "type": "git", + "url": "https://github.com/Microsoft/tolerant-php-parser.git", + "reference": "b662587eb797685a98239d1d52d25168a03fdfb2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Microsoft/tolerant-php-parser/zipball/b662587eb797685a98239d1d52d25168a03fdfb2", + "reference": "b662587eb797685a98239d1d52d25168a03fdfb2", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Microsoft\\PhpParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rob Lourens", + "email": "roblou@microsoft.com" + } + ], + "description": "Tolerant PHP-to-AST parser designed for IDE usage scenarios", + "time": "2018-12-29T00:31:32+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.8.1", @@ -109,6 +297,115 @@ ], "time": "2018-06-11T23:09:50+00:00" }, + { + "name": "netresearch/jsonmapper", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/cweiske/jsonmapper.git", + "reference": "3868fe1128ce1169228acdb623359dca74db5ef3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/3868fe1128ce1169228acdb623359dca74db5ef3", + "reference": "3868fe1128ce1169228acdb623359dca74db5ef3", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4", + "squizlabs/php_codesniffer": "~1.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JsonMapper": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@cweiske.de", + "homepage": "http://github.com/cweiske/jsonmapper/", + "role": "Developer" + } + ], + "description": "Map nested JSON structures onto PHP classes", + "time": "2017-11-28T21:30:01+00:00" + }, + { + "name": "phan/phan", + "version": "1.2.6", + "source": { + "type": "git", + "url": "https://github.com/phan/phan.git", + "reference": "78b8f2bdab9dab2146872bf130a9265a3f1f9a27" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phan/phan/zipball/78b8f2bdab9dab2146872bf130a9265a3f1f9a27", + "reference": "78b8f2bdab9dab2146872bf130a9265a3f1f9a27", + "shasum": "" + }, + "require": { + "composer/semver": "^1.4", + "composer/xdebug-handler": "^1.3.2", + "ext-filter": "*", + "ext-json": "*", + "felixfbecker/advanced-json-rpc": "^3.0.3", + "microsoft/tolerant-php-parser": "0.0.16", + "php": "^7.0.0", + "sabre/event": "^5.0", + "symfony/console": "^2.3|^3.0|~4.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.3.0" + }, + "suggest": { + "ext-ast": "Needed for parsing ASTs (unless --use-fallback-parser is used). 1.0.1+ is recommended, php-ast ^0.1.5|^1.0.0 is needed.", + "ext-igbinary": "Improves performance of polyfill when ext-ast is unavailable", + "ext-tokenizer": "Needed for non-AST support and file/line-based suppressions." + }, + "bin": [ + "phan", + "phan_client", + "tocheckstyle" + ], + "type": "project", + "autoload": { + "psr-4": { + "Phan\\": "src/Phan" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rasmus Lerdorf" + }, + { + "name": "Andrew S. Morrison" + }, + { + "name": "Tyson Andre" + } + ], + "description": "A static analyzer for PHP", + "keywords": [ + "analyzer", + "php", + "static" + ], + "time": "2019-03-09T19:38:20+00:00" + }, { "name": "phar-io/manifest", "version": "1.0.3", @@ -762,6 +1059,113 @@ ], "time": "2018-10-05T04:05:24+00:00" }, + { + "name": "psr/log", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2018-11-20T15:27:04+00:00" + }, + { + "name": "sabre/event", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/event.git", + "reference": "f5cf802d240df1257866d8813282b98aee3bc548" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/event/zipball/f5cf802d240df1257866d8813282b98aee3bc548", + "reference": "f5cf802d240df1257866d8813282b98aee3bc548", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": ">=6", + "sabre/cs": "~1.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Sabre\\Event\\": "lib/" + }, + "files": [ + "lib/coroutine.php", + "lib/Loop/functions.php", + "lib/Promise/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + } + ], + "description": "sabre/event is a library for lightweight event-based programming", + "homepage": "http://sabre.io/event/", + "keywords": [ + "EventEmitter", + "async", + "coroutine", + "eventloop", + "events", + "hooks", + "plugin", + "promise", + "reactor", + "signal" + ], + "time": "2018-03-05T13:55:47+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", From b97992aa393e51d9b5009fb973fe1c4fdf66afb5 Mon Sep 17 00:00:00 2001 From: Vladimir Vukanac Date: Sun, 17 Mar 2019 22:22:55 +0100 Subject: [PATCH 2/5] Increase to strict level for phan check --- .phan/config.php | 50 +++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/.phan/config.php b/.phan/config.php index ef6a890..9508cde 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -3,7 +3,7 @@ use Phan\Issue; /** - * This configuration file was automatically generated by 'phan --init --init-level=5' + * This configuration file was automatically generated by 'phan --init --init-level=1' * * TODOs (added by 'phan --init'): * @@ -50,34 +50,34 @@ // error message if there is an attempt to write // to a class property that wasn't explicitly // defined. - 'allow_missing_properties' => true, + 'allow_missing_properties' => false, // If enabled, null can be cast to any type and any // type can be cast to null. Setting this to true // will cut down on false positives. - 'null_casts_as_any_type' => true, + 'null_casts_as_any_type' => false, // If enabled, allow null to be cast as any array-like type. // // This is an incremental step in migrating away from `null_casts_as_any_type`. // If `null_casts_as_any_type` is true, this has no effect. - 'null_casts_as_array' => true, + 'null_casts_as_array' => false, // If enabled, allow any array-like type to be cast to null. // This is an incremental step in migrating away from `null_casts_as_any_type`. // If `null_casts_as_any_type` is true, this has no effect. - 'array_casts_as_null' => true, + 'array_casts_as_null' => false, // If enabled, scalars (int, float, bool, string, null) // are treated as if they can cast to each other. // This does not affect checks of array keys. See `scalar_array_key_cast`. - 'scalar_implicit_cast' => true, + 'scalar_implicit_cast' => false, // If enabled, any scalar array keys (int, string) // are treated as if they can cast to each other. // E.g. `array` can cast to `array` and vice versa. // Normally, a scalar type such as int could only cast to/from int and mixed. - 'scalar_array_key_cast' => true, + 'scalar_array_key_cast' => false, // If this has entries, scalars (int, float, bool, string, null) // are allowed to perform the casts listed. @@ -92,39 +92,39 @@ // or if **any** type in an invoked expression is not a callable. // Setting this to true will introduce numerous false positives // (and reveal some bugs). - 'strict_method_checking' => false, + 'strict_method_checking' => true, // If enabled, Phan will warn if **any** type in the argument's union type // cannot be cast to a type in the parameter's expected union type. // Setting this to true will introduce numerous false positives // (and reveal some bugs). - 'strict_param_checking' => false, + 'strict_param_checking' => true, // If enabled, Phan will warn if **any** type in a returned value's union type // cannot be cast to the declared return type. // Setting this to true will introduce numerous false positives // (and reveal some bugs). - 'strict_return_checking' => false, + 'strict_return_checking' => true, // If enabled, Phan will warn if **any** type in a property assignment's union type // cannot be cast to a type in the property's declared union type. // Setting this to true will introduce numerous false positives // (and reveal some bugs). - 'strict_property_checking' => false, + 'strict_property_checking' => true, // If true, seemingly undeclared variables in the global // scope will be ignored. // // This is useful for projects with complicated cross-file // globals that you have no hope of fixing. - 'ignore_undeclared_variables_in_global_scope' => true, + 'ignore_undeclared_variables_in_global_scope' => false, // Set this to false to emit `PhanUndeclaredFunction` issues for internal functions that Phan has signatures for, // but aren't available in the codebase, or the internal functions used to run Phan // (may lead to false positives if an extension isn't loaded) // // If this is true(default), then Phan will not warn. - 'ignore_undeclared_functions_with_known_signatures' => true, + 'ignore_undeclared_functions_with_known_signatures' => false, // Backwards Compatibility Checking. This is slow // and expensive, but you should consider running @@ -142,7 +142,7 @@ // If true, check to make sure the return type declared // in the doc-block (if any) matches the return type // declared in the method signature. - 'check_docblock_signature_return_type_match' => false, + 'check_docblock_signature_return_type_match' => true, // If true, make narrowed types from phpdoc params override // the real types from the signature, when real types exist. @@ -172,7 +172,7 @@ // This check can add quite a bit of time to the analysis. // // This will also check if final methods are overridden, etc. - 'analyze_signature_compatibility' => false, + 'analyze_signature_compatibility' => true, // This setting maps case-insensitive strings to union types. // @@ -207,7 +207,7 @@ // `dead_code_detection` will also enable unused variable detection. // // This has a few known false positives, e.g. for loops or branches. - 'unused_variable_detection' => false, + 'unused_variable_detection' => true, // If true, this runs a quick version of checks that takes less // time at the cost of not running as thorough @@ -238,7 +238,7 @@ // the call and rescan `test()`'s code block that we can // detect that it is actually returning the passed in // `string` instead of an `int` as declared. - 'quick_mode' => true, + 'quick_mode' => false, // If true, then before analysis, try to simplify AST into a form // which improves Phan's type inference in edge cases. @@ -265,7 +265,7 @@ // `Issue::SEVERITY_CRITICAL`. Setting it to only // critical issues is a good place to start on a big // sloppy mature code base. - 'minimum_severity' => Issue::SEVERITY_NORMAL, + 'minimum_severity' => Issue::SEVERITY_LOW, // Add any issue types (such as `'PhanUndeclaredMethod'`) // to this black-list to inhibit them from being reported. @@ -303,7 +303,7 @@ ], // Enable this to enable checks of require/include statements referring to valid paths. - 'enable_include_path_checks' => false, + 'enable_include_path_checks' => true, // The number of processes to fork off during the analysis // phase. @@ -333,7 +333,17 @@ // Documentation about available bundled plugins can be found [here](https://github.com/phan/phan/tree/master/.phan/plugins). // // 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'`) - 'plugins' => [], + 'plugins' => [ + 'AlwaysReturnPlugin', + 'DollarDollarPlugin', + 'DuplicateArrayKeyPlugin', + 'DuplicateExpressionPlugin', + 'PregRegexCheckerPlugin', + 'PrintfCheckerPlugin', + 'SleepCheckerPlugin', + 'UnreachableCodePlugin', + 'UseReturnValuePlugin', + ], // A list of directories that should be parsed for class and // method information. After excluding the directories From e80987eabac1472f528ad90b16902774c45d7623 Mon Sep 17 00:00:00 2001 From: Vladimir Vukanac Date: Sun, 17 Mar 2019 22:28:02 +0100 Subject: [PATCH 3/5] Upgade phan version for Travis CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 61a94fe..2932e70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_script: script: - composer validate --no-check-all --strict # Install phan separately because the tolerant-php-parser version may be behind. - - composer create-project phan/phan=1.2.1 ~/phan-install; ~/phan-install/phan + - composer create-project phan/phan=1.2.6 ~/phan-install; ~/phan-install/phan - vendor/bin/phpcs --standard=PSR2 src - vendor/bin/phpcpd src tests - vendor/bin/phpunit --coverage-clover=coverage.xml From 103b991d5e8dae140f9156263d871cdc4b106b76 Mon Sep 17 00:00:00 2001 From: Vladimir Vukanac Date: Sun, 17 Mar 2019 22:30:54 +0100 Subject: [PATCH 4/5] Add missing ast with pear for phan on Travis CI --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2932e70..fffd114 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ cache: install: - composer install --no-interaction --prefer-source + - pecl install ast before_script: - wget https://github.com/infection/infection/releases/download/0.8.0/infection.phar From 5db18792f299c4a961f6d181f9365d86ac20cc5d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 19 Oct 2019 16:37:18 +0000 Subject: [PATCH 5/5] Fixing style errors. --- .phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.phan/config.php b/.phan/config.php index 9508cde..1ce9077 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -43,7 +43,7 @@ // Note that the **only** effect of choosing `'5.6'` is to infer that functions removed in php 7.0 exist. // (See `backward_compatibility_checks` for additional options) // TODO: Choose a target_php_version for this project, or leave as null and remove this comment - 'target_php_version' => NULL, + 'target_php_version' => null, // If enabled, missing properties will be created when // they are first seen. If false, we'll report an