From 689f1645e89cbced4b0a60066803f898b7ab7caf Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Mon, 9 Dec 2019 13:29:45 -0600 Subject: [PATCH 01/19] Bump to phpstan-drupal 0.11.13 --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 0634861..328b405 100644 --- a/composer.lock +++ b/composer.lock @@ -103,16 +103,16 @@ }, { "name": "mglaman/phpstan-drupal", - "version": "0.11.14", + "version": "0.11.13", "source": { "type": "git", "url": "https://github.com/mglaman/phpstan-drupal.git", - "reference": "3458665f7bb579f700c1384d5bc05d879757f76c" + "reference": "1d73e1acc717a3cfb6ef355535c7940e8c25ce97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/3458665f7bb579f700c1384d5bc05d879757f76c", - "reference": "3458665f7bb579f700c1384d5bc05d879757f76c", + "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/1d73e1acc717a3cfb6ef355535c7940e8c25ce97", + "reference": "1d73e1acc717a3cfb6ef355535c7940e8c25ce97", "shasum": "" }, "require": { @@ -182,7 +182,7 @@ } ], "description": "Drupal extension and rules for PHPStan", - "time": "2019-12-10T15:17:37+00:00" + "time": "2019-12-09T19:26:22+00:00" }, { "name": "mglaman/phpstan-junit", From c95b30c9da4c3a462c7e20f8090af04d023bda4b Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Tue, 10 Dec 2019 21:02:35 -0600 Subject: [PATCH 02/19] Bump to 0.11.4 --- composer.lock | 60 +++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/composer.lock b/composer.lock index 328b405..15ec179 100644 --- a/composer.lock +++ b/composer.lock @@ -103,16 +103,16 @@ }, { "name": "mglaman/phpstan-drupal", - "version": "0.11.13", + "version": "0.11.14", "source": { "type": "git", "url": "https://github.com/mglaman/phpstan-drupal.git", - "reference": "1d73e1acc717a3cfb6ef355535c7940e8c25ce97" + "reference": "3458665f7bb579f700c1384d5bc05d879757f76c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/1d73e1acc717a3cfb6ef355535c7940e8c25ce97", - "reference": "1d73e1acc717a3cfb6ef355535c7940e8c25ce97", + "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/3458665f7bb579f700c1384d5bc05d879757f76c", + "reference": "3458665f7bb579f700c1384d5bc05d879757f76c", "shasum": "" }, "require": { @@ -182,7 +182,7 @@ } ], "description": "Drupal extension and rules for PHPStan", - "time": "2019-12-09T19:26:22+00:00" + "time": "2019-12-10T15:17:37+00:00" }, { "name": "mglaman/phpstan-junit", @@ -500,16 +500,16 @@ }, { "name": "nette/php-generator", - "version": "v3.3.3", + "version": "v3.3.1", "source": { "type": "git", "url": "https://github.com/nette/php-generator.git", - "reference": "a4ff22c91681fefaa774cf952a2b69c2ec9477c1" + "reference": "4240fd7adf499138c07b814ef9b9a6df9f6d7187" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/php-generator/zipball/a4ff22c91681fefaa774cf952a2b69c2ec9477c1", - "reference": "a4ff22c91681fefaa774cf952a2b69c2ec9477c1", + "url": "https://api.github.com/repos/nette/php-generator/zipball/4240fd7adf499138c07b814ef9b9a6df9f6d7187", + "reference": "4240fd7adf499138c07b814ef9b9a6df9f6d7187", "shasum": "" }, "require": { @@ -556,7 +556,7 @@ "php", "scaffolding" ], - "time": "2020-01-20T11:40:42+00:00" + "time": "2019-11-22T11:12:11+00:00" }, { "name": "nette/robot-loader", @@ -623,16 +623,16 @@ }, { "name": "nette/schema", - "version": "v1.0.2", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "febf71fb4052c824046f5a33f4f769a6e7fa0cb4" + "reference": "337117df1dade22e2ba1fdc4a4b832c1e9b06b76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/febf71fb4052c824046f5a33f4f769a6e7fa0cb4", - "reference": "febf71fb4052c824046f5a33f4f769a6e7fa0cb4", + "url": "https://api.github.com/repos/nette/schema/zipball/337117df1dade22e2ba1fdc4a4b832c1e9b06b76", + "reference": "337117df1dade22e2ba1fdc4a4b832c1e9b06b76", "shasum": "" }, "require": { @@ -675,7 +675,7 @@ "config", "nette" ], - "time": "2020-01-06T22:52:48+00:00" + "time": "2019-10-31T20:52:19+00:00" }, { "name": "nette/utils", @@ -1128,16 +1128,16 @@ }, { "name": "symfony/console", - "version": "v4.4.3", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f" + "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", - "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", + "url": "https://api.github.com/repos/symfony/console/zipball/f0aea3df20d15635b3cb9730ca5eea1c65b7f201", + "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201", "shasum": "" }, "require": { @@ -1200,20 +1200,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2020-01-10T21:54:01+00:00" + "time": "2019-12-01T10:06:17+00:00" }, { "name": "symfony/finder", - "version": "v4.4.3", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "3a50be43515590faf812fbd7708200aabc327ec3" + "reference": "ce8743441da64c41e2a667b8eb66070444ed911e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/3a50be43515590faf812fbd7708200aabc327ec3", - "reference": "3a50be43515590faf812fbd7708200aabc327ec3", + "url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e", + "reference": "ce8743441da64c41e2a667b8eb66070444ed911e", "shasum": "" }, "require": { @@ -1249,7 +1249,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2020-01-04T13:00:46+00:00" + "time": "2019-11-17T21:56:56+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1486,16 +1486,16 @@ }, { "name": "symfony/yaml", - "version": "v4.4.3", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "cd014e425b3668220adb865f53bff64b3ad21767" + "reference": "76de473358fe802578a415d5bb43c296cf09d211" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/cd014e425b3668220adb865f53bff64b3ad21767", - "reference": "cd014e425b3668220adb865f53bff64b3ad21767", + "url": "https://api.github.com/repos/symfony/yaml/zipball/76de473358fe802578a415d5bb43c296cf09d211", + "reference": "76de473358fe802578a415d5bb43c296cf09d211", "shasum": "" }, "require": { @@ -1541,7 +1541,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2020-01-21T11:12:16+00:00" + "time": "2019-11-12T14:51:11+00:00" }, { "name": "webflo/drupal-finder", From e8b6c3883128e70390b96e7b82be50b68b42897f Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Mon, 13 Jan 2020 15:18:15 -0600 Subject: [PATCH 03/19] Update phpstan 0.12 --- composer.json | 7 +- composer.lock | 700 ++------------------ phpstan/deprecation_testing.neon | 1 - phpstan/junit_formatter.neon | 3 - phpstan/rules_and_deprecations_testing.neon | 1 - phpstan/rules_testing.neon | 1 - 6 files changed, 44 insertions(+), 669 deletions(-) delete mode 100644 phpstan/junit_formatter.neon diff --git a/composer.json b/composer.json index 7aeb70b..a3f863b 100644 --- a/composer.json +++ b/composer.json @@ -13,10 +13,9 @@ "php": "~7.2", "composer/xdebug-handler": "^1.3", "jean85/pretty-package-versions": "^1.2", - "mglaman/phpstan-drupal": "^0.11.1", - "mglaman/phpstan-junit": "^0.11.1", - "phpstan/phpstan": "^0.11.17", - "phpstan/phpstan-deprecation-rules": "^0.11.0", + "mglaman/phpstan-drupal": "^0.12", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-deprecation-rules": "^0.12", "symfony/console": "~3.2 || ~4.0", "webflo/drupal-finder": "^1.1" }, diff --git a/composer.lock b/composer.lock index 15ec179..36db08c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0e3f4ec5a396de919e336dca7c16c2d2", + "content-hash": "6ad9e73296a9a4757b85518761474918", "packages": [ { "name": "composer/xdebug-handler", @@ -103,35 +103,31 @@ }, { "name": "mglaman/phpstan-drupal", - "version": "0.11.14", + "version": "0.12.1", "source": { "type": "git", "url": "https://github.com/mglaman/phpstan-drupal.git", - "reference": "3458665f7bb579f700c1384d5bc05d879757f76c" + "reference": "3a2ba26a67c9095a7a47841d73561baceda3a20a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/3458665f7bb579f700c1384d5bc05d879757f76c", - "reference": "3458665f7bb579f700c1384d5bc05d879757f76c", + "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/3a2ba26a67c9095a7a47841d73561baceda3a20a", + "reference": "3a2ba26a67c9095a7a47841d73561baceda3a20a", "shasum": "" }, "require": { - "nette/di": "^3.0", + "nette/finder": "^2.5", "php": "^7.1", - "phpstan/phpstan": "~0.11.0", + "phpstan/phpstan": "^0.12.0", "symfony/yaml": "~3.4.5|^4.2", "webflo/drupal-finder": "^1.2" }, - "conflict": { - "phpstan/phpstan": ">=0.12", - "phpstan/phpstan-deprecation-rules": ">=0.12" - }, "require-dev": { "composer/installers": "^1.6", "drupal/core-recommended": "^8.8@alpha", "drush/drush": "^9.6", - "phpstan/phpstan-deprecation-rules": "~0.11.0", - "phpstan/phpstan-strict-rules": "~0.11.0", + "phpstan/phpstan-deprecation-rules": "~0.12.0", + "phpstan/phpstan-strict-rules": "^0.12.0", "phpunit/phpunit": "^7.5", "squizlabs/php_codesniffer": "^3.3" }, @@ -182,196 +178,7 @@ } ], "description": "Drupal extension and rules for PHPStan", - "time": "2019-12-10T15:17:37+00:00" - }, - { - "name": "mglaman/phpstan-junit", - "version": "0.11.2", - "source": { - "type": "git", - "url": "https://github.com/mglaman/phpstan-junit.git", - "reference": "f5a3bd48e2868902e540d8ff44af9da1853aa37e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mglaman/phpstan-junit/zipball/f5a3bd48e2868902e540d8ff44af9da1853aa37e", - "reference": "f5a3bd48e2868902e540d8ff44af9da1853aa37e", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "phpstan/phpstan": "^0.11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.12-dev" - } - }, - "autoload": { - "psr-4": { - "PHPStan\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Matt Glaman", - "email": "nmd.matt@gmail.com" - } - ], - "description": "ErrorFormatter for PHPStan to output errors in JUnit format", - "time": "2019-02-15T19:43:32+00:00" - }, - { - "name": "nette/bootstrap", - "version": "v3.0.1", - "source": { - "type": "git", - "url": "https://github.com/nette/bootstrap.git", - "reference": "b45a1e33b6a44beb307756522396551e5a9ff249" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/bootstrap/zipball/b45a1e33b6a44beb307756522396551e5a9ff249", - "reference": "b45a1e33b6a44beb307756522396551e5a9ff249", - "shasum": "" - }, - "require": { - "nette/di": "^3.0", - "nette/utils": "^3.0", - "php": ">=7.1" - }, - "conflict": { - "tracy/tracy": "<2.6" - }, - "require-dev": { - "latte/latte": "^2.2", - "nette/application": "^3.0", - "nette/caching": "^3.0", - "nette/database": "^3.0", - "nette/forms": "^3.0", - "nette/http": "^3.0", - "nette/mail": "^3.0", - "nette/robot-loader": "^3.0", - "nette/safe-stream": "^2.2", - "nette/security": "^3.0", - "nette/tester": "^2.0", - "tracy/tracy": "^2.6" - }, - "suggest": { - "nette/robot-loader": "to use Configurator::createRobotLoader()", - "tracy/tracy": "to use Configurator::enableTracy()" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", - "homepage": "https://nette.org", - "keywords": [ - "bootstrapping", - "configurator", - "nette" - ], - "time": "2019-09-30T08:19:38+00:00" - }, - { - "name": "nette/di", - "version": "v3.0.3", - "source": { - "type": "git", - "url": "https://github.com/nette/di.git", - "reference": "77d69061cbf8f9cfb7363dd983136f51213d3e41" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/di/zipball/77d69061cbf8f9cfb7363dd983136f51213d3e41", - "reference": "77d69061cbf8f9cfb7363dd983136f51213d3e41", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/neon": "^3.0", - "nette/php-generator": "^3.3.3", - "nette/robot-loader": "^3.2", - "nette/schema": "^1.0", - "nette/utils": "^3.1", - "php": ">=7.1" - }, - "conflict": { - "nette/bootstrap": "<3.0" - }, - "require-dev": { - "nette/tester": "^2.2", - "phpstan/phpstan": "^0.12", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0-only", - "GPL-3.0-only" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", - "homepage": "https://nette.org", - "keywords": [ - "compiled", - "di", - "dic", - "factory", - "ioc", - "nette", - "static" - ], - "time": "2020-01-20T12:14:54+00:00" + "time": "2020-01-13T19:41:44+00:00" }, { "name": "nette/finder", @@ -436,247 +243,6 @@ ], "time": "2020-01-03T20:35:40+00:00" }, - { - "name": "nette/neon", - "version": "v3.1.0", - "source": { - "type": "git", - "url": "https://github.com/nette/neon.git", - "reference": "0a18fc88801a14d66587932de133eeca01f7ce8e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/neon/zipball/0a18fc88801a14d66587932de133eeca01f7ce8e", - "reference": "0a18fc88801a14d66587932de133eeca01f7ce8e", - "shasum": "" - }, - "require": { - "ext-iconv": "*", - "ext-json": "*", - "php": ">=7.1" - }, - "require-dev": { - "nette/tester": "^2.0", - "phpstan/phpstan": "^0.12", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🍸 Nette NEON: encodes and decodes NEON file format.", - "homepage": "http://ne-on.org", - "keywords": [ - "export", - "import", - "neon", - "nette", - "yaml" - ], - "time": "2019-12-27T04:00:04+00:00" - }, - { - "name": "nette/php-generator", - "version": "v3.3.1", - "source": { - "type": "git", - "url": "https://github.com/nette/php-generator.git", - "reference": "4240fd7adf499138c07b814ef9b9a6df9f6d7187" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/php-generator/zipball/4240fd7adf499138c07b814ef9b9a6df9f6d7187", - "reference": "4240fd7adf499138c07b814ef9b9a6df9f6d7187", - "shasum": "" - }, - "require": { - "nette/utils": "^2.4.2 || ^3.0", - "php": ">=7.1" - }, - "require-dev": { - "nette/tester": "^2.0", - "phpstan/phpstan": "^0.12", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0-only", - "GPL-3.0-only" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.4 features.", - "homepage": "https://nette.org", - "keywords": [ - "code", - "nette", - "php", - "scaffolding" - ], - "time": "2019-11-22T11:12:11+00:00" - }, - { - "name": "nette/robot-loader", - "version": "v3.2.1", - "source": { - "type": "git", - "url": "https://github.com/nette/robot-loader.git", - "reference": "d2a100e1f5cab390c78bc88709abbc91249c3993" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/robot-loader/zipball/d2a100e1f5cab390c78bc88709abbc91249c3993", - "reference": "d2a100e1f5cab390c78bc88709abbc91249c3993", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/finder": "^2.5 || ^3.0", - "nette/utils": "^3.0", - "php": ">=7.1" - }, - "require-dev": { - "nette/tester": "^2.0", - "phpstan/phpstan": "^0.12", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.", - "homepage": "https://nette.org", - "keywords": [ - "autoload", - "class", - "interface", - "nette", - "trait" - ], - "time": "2019-12-26T22:32:02+00:00" - }, - { - "name": "nette/schema", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/nette/schema.git", - "reference": "337117df1dade22e2ba1fdc4a4b832c1e9b06b76" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/337117df1dade22e2ba1fdc4a4b832c1e9b06b76", - "reference": "337117df1dade22e2ba1fdc4a4b832c1e9b06b76", - "shasum": "" - }, - "require": { - "nette/utils": "^3.1", - "php": ">=7.1" - }, - "require-dev": { - "nette/tester": "^2.2", - "phpstan/phpstan-nette": "^0.12", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": [] - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "📐 Nette Schema: validating data structures against a given Schema.", - "homepage": "https://nette.org", - "keywords": [ - "config", - "nette" - ], - "time": "2019-10-31T20:52:19+00:00" - }, { "name": "nette/utils", "version": "v3.1.0", @@ -755,58 +321,6 @@ ], "time": "2020-01-03T18:13:31+00:00" }, - { - "name": "nikic/php-parser", - "version": "v4.3.0", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9a9981c347c5c49d6dfe5cf826bb882b824080dc", - "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "0.0.5", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2019-11-08T13:50:10+00:00" - }, { "name": "ocramius/package-versions", "version": "1.4.2", @@ -857,160 +371,77 @@ "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "time": "2019-11-15T16:17:10+00:00" }, - { - "name": "phpstan/phpdoc-parser", - "version": "0.3.5", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "8c4ef2aefd9788238897b678a985e1d5c8df6db4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/8c4ef2aefd9788238897b678a985e1d5c8df6db4", - "reference": "8c4ef2aefd9788238897b678a985e1d5c8df6db4", - "shasum": "" - }, - "require": { - "php": "~7.1" - }, - "require-dev": { - "consistence/coding-standard": "^3.5", - "jakub-onderka/php-parallel-lint": "^0.9.2", - "phing/phing": "^2.16.0", - "phpstan/phpstan": "^0.10", - "phpunit/phpunit": "^6.3", - "slevomat/coding-standard": "^4.7.2", - "squizlabs/php_codesniffer": "^3.3.2", - "symfony/process": "^3.4 || ^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.3-dev" - } - }, - "autoload": { - "psr-4": { - "PHPStan\\PhpDocParser\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPDoc parser with support for nullable, intersection and generic types", - "time": "2019-06-07T19:13:52+00:00" - }, { "name": "phpstan/phpstan", - "version": "0.11.19", + "version": "0.12.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7" + "reference": "71a20c18f06c53605251a00a8efe443fa85225d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/63cc502f6957b7f74efbac444b4cf219dcadffd7", - "reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/71a20c18f06c53605251a00a8efe443fa85225d1", + "reference": "71a20c18f06c53605251a00a8efe443fa85225d1", "shasum": "" }, "require": { - "composer/xdebug-handler": "^1.3.0", - "jean85/pretty-package-versions": "^1.0.3", - "nette/bootstrap": "^2.4 || ^3.0", - "nette/di": "^2.4.7 || ^3.0", - "nette/neon": "^2.4.3 || ^3.0", - "nette/robot-loader": "^3.0.1", - "nette/schema": "^1.0", - "nette/utils": "^2.4.5 || ^3.0", - "nikic/php-parser": "^4.2.3", - "php": "~7.1", - "phpstan/phpdoc-parser": "^0.3.5", - "symfony/console": "~3.2 || ~4.0", - "symfony/finder": "~3.2 || ~4.0" - }, - "conflict": { - "symfony/console": "3.4.16 || 4.1.5" - }, - "require-dev": { - "brianium/paratest": "^2.0 || ^3.0", - "consistence/coding-standard": "^3.5", - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", - "ext-intl": "*", - "ext-mysqli": "*", - "ext-simplexml": "*", - "ext-soap": "*", - "ext-zip": "*", - "jakub-onderka/php-parallel-lint": "^1.0", - "localheinz/composer-normalize": "^1.1.0", - "phing/phing": "^2.16.0", - "phpstan/phpstan-deprecation-rules": "^0.11", - "phpstan/phpstan-php-parser": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^7.5.14 || ^8.0", - "slevomat/coding-standard": "^4.7.2", - "squizlabs/php_codesniffer": "^3.3.2" + "php": "^7.1" }, "bin": [ - "bin/phpstan" + "phpstan", + "phpstan.phar" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "0.11-dev" + "dev-master": "0.12-dev" } }, "autoload": { - "psr-4": { - "PHPStan\\": [ - "src/" - ] - } + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2019-10-22T20:20:22+00:00" + "time": "2020-01-12T14:31:21+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", - "version": "0.11.2", + "version": "0.12.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", - "reference": "5685fe48873efc5af1f2cc95d9c1b8ae82c728fe" + "reference": "51d21a83b97e539e1fc56c1ce42ac0f187407fb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/5685fe48873efc5af1f2cc95d9c1b8ae82c728fe", - "reference": "5685fe48873efc5af1f2cc95d9c1b8ae82c728fe", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/51d21a83b97e539e1fc56c1ce42ac0f187407fb6", + "reference": "51d21a83b97e539e1fc56c1ce42ac0f187407fb6", "shasum": "" }, "require": { - "nikic/php-parser": "^4.0", "php": "~7.1", - "phpstan/phpstan": "^0.11.8" + "phpstan/phpstan": "^0.12" }, "require-dev": { "consistence/coding-standard": "^3.0.1", "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", "jakub-onderka/php-parallel-lint": "^1.0", + "localheinz/composer-normalize": "^1.3.0", "phing/phing": "^2.16.0", - "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-phpunit": "^0.12", "phpunit/phpunit": "^7.0", "slevomat/coding-standard": "^4.5.2" }, "type": "phpstan-extension", "extra": { "branch-alias": { - "dev-master": "0.11-dev" + "dev-master": "0.12-dev" }, "phpstan": { "includes": [ @@ -1028,7 +459,7 @@ "MIT" ], "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", - "time": "2019-05-28T19:54:04+00:00" + "time": "2020-01-12T16:25:40+00:00" }, { "name": "psr/container", @@ -1128,16 +559,16 @@ }, { "name": "symfony/console", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201" + "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f0aea3df20d15635b3cb9730ca5eea1c65b7f201", - "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201", + "url": "https://api.github.com/repos/symfony/console/zipball/82437719dab1e6bdd28726af14cb345c2ec816d0", + "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0", "shasum": "" }, "require": { @@ -1200,56 +631,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-01T10:06:17+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.4.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "ce8743441da64c41e2a667b8eb66070444ed911e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e", - "reference": "ce8743441da64c41e2a667b8eb66070444ed911e", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2019-11-17T21:56:56+00:00" + "time": "2019-12-17T10:32:23+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1486,16 +868,16 @@ }, { "name": "symfony/yaml", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "76de473358fe802578a415d5bb43c296cf09d211" + "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/76de473358fe802578a415d5bb43c296cf09d211", - "reference": "76de473358fe802578a415d5bb43c296cf09d211", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a08832b974dd5fafe3085a66d41fe4c84bb2628c", + "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c", "shasum": "" }, "require": { @@ -1541,7 +923,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-11-12T14:51:11+00:00" + "time": "2019-12-10T10:33:21+00:00" }, { "name": "webflo/drupal-finder", diff --git a/phpstan/deprecation_testing.neon b/phpstan/deprecation_testing.neon index 59eceac..3583e30 100644 --- a/phpstan/deprecation_testing.neon +++ b/phpstan/deprecation_testing.neon @@ -9,4 +9,3 @@ parameters: includes: - base_config.neon - phpstan_deprecation_rules.php - - junit_formatter.neon diff --git a/phpstan/junit_formatter.neon b/phpstan/junit_formatter.neon deleted file mode 100644 index 6523363..0000000 --- a/phpstan/junit_formatter.neon +++ /dev/null @@ -1,3 +0,0 @@ -services: - errorFormatter.junit: - class: PHPStan\Command\ErrorFormatter\JUnitErrorFormatter diff --git a/phpstan/rules_and_deprecations_testing.neon b/phpstan/rules_and_deprecations_testing.neon index d0c8a2a..0210a16 100644 --- a/phpstan/rules_and_deprecations_testing.neon +++ b/phpstan/rules_and_deprecations_testing.neon @@ -3,4 +3,3 @@ parameters: includes: - base_config.neon - phpstan_deprecation_rules.php - - junit_formatter.neon diff --git a/phpstan/rules_testing.neon b/phpstan/rules_testing.neon index c514d88..c63d067 100644 --- a/phpstan/rules_testing.neon +++ b/phpstan/rules_testing.neon @@ -2,4 +2,3 @@ parameters: level: 1 includes: - base_config.neon - - junit_formatter.neon From d64e35dec9ab15484856612e0c6dbd0a1de9b7a6 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Wed, 15 Jan 2020 09:00:49 -0600 Subject: [PATCH 04/19] Execute phpstan as a subprocess --- composer.json | 3 + composer.lock | 157 +++++++++++++++++++- phpstan/base_config.neon | 9 -- phpstan/deprecation_testing.neon | 11 -- phpstan/phpstan_deprecation_rules.php | 16 -- phpstan/phpstan_drupal_extension.php | 19 --- phpstan/rules_and_deprecations_testing.neon | 5 - phpstan/rules_testing.neon | 4 - src/Command/CheckCommand.php | 132 ++++++++-------- 9 files changed, 217 insertions(+), 139 deletions(-) delete mode 100644 phpstan/base_config.neon delete mode 100644 phpstan/deprecation_testing.neon delete mode 100644 phpstan/phpstan_deprecation_rules.php delete mode 100644 phpstan/phpstan_drupal_extension.php delete mode 100644 phpstan/rules_and_deprecations_testing.neon delete mode 100644 phpstan/rules_testing.neon diff --git a/composer.json b/composer.json index a3f863b..dbf7cb4 100644 --- a/composer.json +++ b/composer.json @@ -14,9 +14,12 @@ "composer/xdebug-handler": "^1.3", "jean85/pretty-package-versions": "^1.2", "mglaman/phpstan-drupal": "^0.12", + "nette/neon": "^3.1", + "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12", "phpstan/phpstan-deprecation-rules": "^0.12", "symfony/console": "~3.2 || ~4.0", + "symfony/process": "~3.2 || ~4.0", "webflo/drupal-finder": "^1.1" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 36db08c..8037812 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6ad9e73296a9a4757b85518761474918", + "content-hash": "ad38ec9162bbd156e4e515d720054120", "packages": [ { "name": "composer/xdebug-handler", @@ -243,6 +243,68 @@ ], "time": "2020-01-03T20:35:40+00:00" }, + { + "name": "nette/neon", + "version": "v3.1.0", + "source": { + "type": "git", + "url": "https://github.com/nette/neon.git", + "reference": "0a18fc88801a14d66587932de133eeca01f7ce8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/neon/zipball/0a18fc88801a14d66587932de133eeca01f7ce8e", + "reference": "0a18fc88801a14d66587932de133eeca01f7ce8e", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "ext-json": "*", + "php": ">=7.1" + }, + "require-dev": { + "nette/tester": "^2.0", + "phpstan/phpstan": "^0.12", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🍸 Nette NEON: encodes and decodes NEON file format.", + "homepage": "http://ne-on.org", + "keywords": [ + "export", + "import", + "neon", + "nette", + "yaml" + ], + "time": "2019-12-27T04:00:04+00:00" + }, { "name": "nette/utils", "version": "v3.1.0", @@ -371,6 +433,50 @@ "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "time": "2019-11-15T16:17:10+00:00" }, + { + "name": "phpstan/extension-installer", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "295656793c53b5eb73a38486032ad1bd650264bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/295656793c53b5eb73a38486032ad1bd650264bc", + "reference": "295656793c53b5eb73a38486032ad1bd650264bc", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1", + "php": "^7.1", + "phpstan/phpstan": ">=0.11.6" + }, + "require-dev": { + "composer/composer": "^1.8", + "consistence/coding-standard": "^3.8", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", + "jakub-onderka/php-parallel-lint": "^1.0", + "phing/phing": "^2.16", + "phpstan/phpstan-strict-rules": "^0.11", + "slevomat/coding-standard": "^5.0.4" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "time": "2019-10-18T17:09:48+00:00" + }, { "name": "phpstan/phpstan", "version": "0.12.5", @@ -808,6 +914,55 @@ ], "time": "2019-11-27T16:25:15+00:00" }, + { + "name": "symfony/process", + "version": "v4.4.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/b84501ad50adb72a94fb460a5b5c91f693e99c9b", + "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2019-12-06T10:06:46+00:00" + }, { "name": "symfony/service-contracts", "version": "v2.0.1", diff --git a/phpstan/base_config.neon b/phpstan/base_config.neon deleted file mode 100644 index 1e21f67..0000000 --- a/phpstan/base_config.neon +++ /dev/null @@ -1,9 +0,0 @@ -parameters: - reportUnmatchedIgnoredErrors: false - # Ignore tests - excludes_analyse: - - */tests/Drupal/Tests/Listeners/Legacy/* - - */tests/fixtures/*.php - - */settings*.php -includes: - - phpstan_drupal_extension.php diff --git a/phpstan/deprecation_testing.neon b/phpstan/deprecation_testing.neon deleted file mode 100644 index 3583e30..0000000 --- a/phpstan/deprecation_testing.neon +++ /dev/null @@ -1,11 +0,0 @@ -parameters: - customRulesetUsed: true - # Ignore phpstan-drupal extension's rules. - ignoreErrors: - - '#\Drupal calls should be avoided in classes, use dependency injection instead#' - - '#Plugin definitions cannot be altered.#' - - '#Missing cache backend declaration for performance.#' - - '#Plugin manager has cache backend specified but does not declare cache tags.#' -includes: - - base_config.neon - - phpstan_deprecation_rules.php diff --git a/phpstan/phpstan_deprecation_rules.php b/phpstan/phpstan_deprecation_rules.php deleted file mode 100644 index c1d849a..0000000 --- a/phpstan/phpstan_deprecation_rules.php +++ /dev/null @@ -1,16 +0,0 @@ - [ - '../vendor/phpstan/phpstan-deprecation-rules/rules.neon', - ], - ]; -} -if (file_exists(__DIR__ . '/../../../../vendor/autoload.php')) { - return [ - 'includes' => [ - '../../../../vendor/phpstan/phpstan-deprecation-rules/rules.neon', - ], - ]; -} diff --git a/phpstan/phpstan_drupal_extension.php b/phpstan/phpstan_drupal_extension.php deleted file mode 100644 index 9c78ae7..0000000 --- a/phpstan/phpstan_drupal_extension.php +++ /dev/null @@ -1,19 +0,0 @@ - [ - '../vendor/mglaman/phpstan-drupal/extension.neon', - ], - ]; -} -if (file_exists(__DIR__ . '/../../../../vendor/autoload.php')) { - return [ - 'includes' => [ - '../../../../vendor/mglaman/phpstan-drupal/extension.neon', - ], - ]; -} - - - diff --git a/phpstan/rules_and_deprecations_testing.neon b/phpstan/rules_and_deprecations_testing.neon deleted file mode 100644 index 0210a16..0000000 --- a/phpstan/rules_and_deprecations_testing.neon +++ /dev/null @@ -1,5 +0,0 @@ -parameters: - level: 1 -includes: - - base_config.neon - - phpstan_deprecation_rules.php diff --git a/phpstan/rules_testing.neon b/phpstan/rules_testing.neon deleted file mode 100644 index c63d067..0000000 --- a/phpstan/rules_testing.neon +++ /dev/null @@ -1,4 +0,0 @@ -parameters: - level: 1 -includes: - - base_config.neon diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index e657516..86069be 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -4,23 +4,21 @@ use DrupalCheck\DrupalCheckErrorHandler; use DrupalFinder\DrupalFinder; -use PHPStan\Command\AnalyseApplication; -use PHPStan\Command\CommandHelper; -use PHPStan\Command\ErrorFormatter\ErrorFormatter; +use Nette\Neon\Neon; use PHPStan\Command\ErrorsConsoleStyle; -use PHPStan\ShouldNotHappenException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Process\Process; class CheckCommand extends Command { private $isDeprecationsCheck = false; private $isAnalysisCheck = false; private $isStyleCheck = false; - private $memoryLimit = null; + private $memoryLimit; private $drupalRoot; private $vendorRoot; @@ -125,83 +123,69 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('Could not find autoload file.'); return 1; } - // Spoof the global phpstan normally provides when running as its - // binary alongside a project. - $GLOBALS['autoloaderInWorkingDirectory'] = $this->vendorRoot . '/autoload.php'; - - $output->writeln(sprintf('Using autoloader: %s', $GLOBALS['autoloaderInWorkingDirectory']), OutputInterface::VERBOSITY_DEBUG); - - if ($this->isDeprecationsCheck && $this->isAnalysisCheck) { - $configuration = __DIR__ . '/../../phpstan/rules_and_deprecations_testing.neon'; - } elseif ($this->isDeprecationsCheck && !$this->isAnalysisCheck) { - $configuration = __DIR__ . '/../../phpstan/deprecation_testing.neon'; - } elseif (!$this->isDeprecationsCheck && $this->isAnalysisCheck) { - $configuration = __DIR__ . '/../../phpstan/rules_testing.neon'; - } else { - // @todo: only analysis check, style check. all of the above at once. - $output->writeln('Not support, yet'); - return 1; + + + $configuration_data = [ + 'parameters' => [ + 'reportUnmatchedIgnoredErrors' => false, + 'excludes_analyse' => [ + '*/tests/Drupal/Tests/Listeners/Legacy/*', + '*/tests/fixtures/*.php', + '*/settings*.php', + ], + 'drupal' => [ + 'drupal_root' => $this->drupalRoot, + ] + ] + ]; + + if ($this->isAnalysisCheck) { + $configuration_data['parameters']['level'] = 4; + } + else { + $configuration_data['parameters']['customRulesetUsed'] = true; } - try { - $inceptionResult = CommandHelper::begin( - $input, - $output, - $input->getArgument('path'), - null, - $this->memoryLimit, - null, - $configuration, - null, - false - ); - } catch (\PHPStan\Command\InceptionNotSuccessfulException $e) { - return 1; - } catch (ShouldNotHappenException $e) { - return 1; + if ($this->isDeprecationsCheck) { + $configuration_data['parameters']['ignoreErrors'] = [ + '#\Drupal calls should be avoided in classes, use dependency injection instead#', + '#Plugin definitions cannot be altered.#', + '#Missing cache backend declaration for performance.#', + '#Plugin manager has cache backend specified but does not declare cache tags.#' + ]; } - $errorOutput = $inceptionResult->getErrorOutput(); - - $container = $inceptionResult->getContainer(); - $errorFormatterServiceName = sprintf('errorFormatter.%s', $input->getOption('format')); - if (!$container->hasService($errorFormatterServiceName)) { - $errorOutput->writeln(sprintf( - 'Error formatter "%s" not found. Available error formatters are: %s', - $input->getOption('format'), - implode(', ', array_map(static function (string $name) { - return substr($name, strlen('errorFormatter.')); - }, $container->findByType(ErrorFormatter::class))) - )); + if ($this->isStyleCheck) { + // @todo: only analysis check, style check. all of the above at once. + $output->writeln('Not support, yet'); return 1; } - /** @var ErrorFormatter $errorFormatter */ - $errorFormatter = $container->getService($errorFormatterServiceName); - - /** @var AnalyseApplication $application */ - $application = $container->getByType(AnalyseApplication::class); - - $exitCode = $inceptionResult->handleReturn( - $application->analyse( - $inceptionResult->getFiles(), - $inceptionResult->isOnlyFiles(), - $inceptionResult->getConsoleStyle(), - $errorFormatter, - $inceptionResult->isDefaultLevelUsed(), - $output->getVerbosity() === OutputInterface::VERBOSITY_DEBUG, - null - ) - ); - $errorHandler->restore(); - $warnings = $errorHandler->getWarnings(); - if (count($warnings) > 0) { - $output->write(PHP_EOL); - foreach ($warnings as $warning) { - $output->writeln("$warning"); + $configuration_encoded = Neon::encode($configuration_data, Neon::BLOCK); + $configuration = sys_get_temp_dir() . '/drupal_check_phpstan_' . time() . '.neon'; + file_put_contents($configuration, $configuration_encoded); + + // @todo support all of the current input options. + $command = [ + __DIR__ . '/../../vendor/bin/phpstan', + 'analyse', + '-c', + $configuration, + '--error-format=' . $input->getOption('format'), + implode(' ', $paths) + ]; + $process = new Process($command); + $process->setTty(true); + $process->setTimeout(null); + $process->run(static function ($type, $buffer) use ($output) { + if (Process::ERR === $type) { + $output->write($buffer, false, OutputInterface::OUTPUT_RAW); + } else { + $output->writeln($buffer, OutputInterface::OUTPUT_RAW); } - } + }); + unlink($configuration); - return $exitCode; + return $process->getExitCode(); } } From 9db98626ae1d5ebb36cf5e6374b64ba326c0d9a1 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Wed, 15 Jan 2020 09:05:11 -0600 Subject: [PATCH 05/19] Update box.json for removed phpstan directory --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index 811cc3f..5b2a68f 100644 --- a/box.json +++ b/box.json @@ -1,4 +1,4 @@ { - "directories": ["phpstan", "src", "vendor"], + "directories": ["src", "vendor"], "stub": "stub.php" } From 3b8bbeaebcd0f985de44d560637f5d602dfd62bd Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Wed, 15 Jan 2020 09:09:18 -0600 Subject: [PATCH 06/19] Use string and not constant, due to namespace prefixing --- src/Command/CheckCommand.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index 86069be..453dd5f 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -35,7 +35,7 @@ protected function configure(): void ->addOption('style', 's', InputOption::VALUE_NONE, 'Check code style') ->addOption('memory-limit', null, InputOption::VALUE_OPTIONAL, 'Memory limit for analysis') ->addOption( - ErrorsConsoleStyle::OPTION_NO_PROGRESS, + 'no-progress', null, InputOption::VALUE_NONE, 'Do not show progress bar, only results' @@ -141,8 +141,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($this->isAnalysisCheck) { $configuration_data['parameters']['level'] = 4; - } - else { + } else { $configuration_data['parameters']['customRulesetUsed'] = true; } From d0c0628329411b84eb20ab55be9825b7ab6ff2bc Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Wed, 15 Jan 2020 09:13:16 -0600 Subject: [PATCH 07/19] PHP 7.1 not supported --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 8037812..76deb37 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ad38ec9162bbd156e4e515d720054120", + "content-hash": "a0ed02f5bf6a4eea7523705d8c30f9c3", "packages": [ { "name": "composer/xdebug-handler", From b513190ee2322d36d315760502fe1996e28478bd Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Wed, 15 Jan 2020 09:15:50 -0600 Subject: [PATCH 08/19] bin is not packed by box phar --- src/Command/CheckCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index 453dd5f..dba8631 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -166,7 +166,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int // @todo support all of the current input options. $command = [ - __DIR__ . '/../../vendor/bin/phpstan', + __DIR__ . '/../../vendor/phpstan/phpstan/phpstan.phar', 'analyse', '-c', $configuration, From 2f275b2d622c2df8e41705f4a9b162191d275683 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Wed, 15 Jan 2020 11:02:00 -0600 Subject: [PATCH 09/19] Fix phpstan binary path in phar --- src/Command/CheckCommand.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index dba8631..c098f32 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -165,8 +165,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int file_put_contents($configuration, $configuration_encoded); // @todo support all of the current input options. + $pharPath = \Phar::running(); + if (!empty($pharPath)) { + $phpstanBin = 'vendor/phpstan/phpstan/phpstan'; + } else { + $phpstanBin = __DIR__ . '/../../vendor/phpstan/phpstan/phpstan'; + } + $command = [ - __DIR__ . '/../../vendor/phpstan/phpstan/phpstan.phar', + $phpstanBin, 'analyse', '-c', $configuration, From d81c93327c3eec4d4b0d5d26a99b458498da296a Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Wed, 15 Jan 2020 22:00:35 -0600 Subject: [PATCH 10/19] Register error handler during phpstan bootstrap --- .circleci/config.yml | 2 +- error-bootstrap.php | 18 ++++++++++++ src/Command/CheckCommand.php | 29 +++++++++++-------- ...CheckErrorHandler.php => ErrorHandler.php} | 2 +- 4 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 error-bootstrap.php rename src/{DrupalCheckErrorHandler.php => ErrorHandler.php} (95%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 497dedd..18cc99b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -245,7 +245,7 @@ jobs: - run: name: Phar - Run against a file command: | - php drupal-check.phar /tmp/drupal/web/modules/contained_not_initialized -vvv | grep "invoked the Drupal container outside of the scope of a function or class method." + php drupal-check.phar /tmp/drupal/web/modules/contained_not_initialized -vvv workflows: version: 2 test_and_deploy: diff --git a/error-bootstrap.php b/error-bootstrap.php new file mode 100644 index 0000000..3cfcc42 --- /dev/null +++ b/error-bootstrap.php @@ -0,0 +1,18 @@ +register(); + + +register_shutdown_function(static function() use ($errorHandler): void { + $errorHandler->restore(); + $warnings = $errorHandler->getWarnings(); + if (count($warnings) > 0) { + print PHP_EOL; + foreach ($warnings as $warning) { + print $warning; + } + } +}); diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index c098f32..59267bd 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -2,10 +2,8 @@ namespace DrupalCheck\Command; -use DrupalCheck\DrupalCheckErrorHandler; use DrupalFinder\DrupalFinder; use Nette\Neon\Neon; -use PHPStan\Command\ErrorsConsoleStyle; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -81,9 +79,6 @@ protected function initialize(InputInterface $input, OutputInterface $output): v protected function execute(InputInterface $input, OutputInterface $output): int { - $errorHandler = new DrupalCheckErrorHandler(); - $errorHandler->register(); - $drupalFinder = new DrupalFinder(); $paths = []; @@ -127,6 +122,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $configuration_data = [ 'parameters' => [ + 'tipsOfTheDay' => false, 'reportUnmatchedIgnoredErrors' => false, 'excludes_analyse' => [ '*/tests/Drupal/Tests/Listeners/Legacy/*', @@ -160,26 +156,35 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 1; } - $configuration_encoded = Neon::encode($configuration_data, Neon::BLOCK); - $configuration = sys_get_temp_dir() . '/drupal_check_phpstan_' . time() . '.neon'; - file_put_contents($configuration, $configuration_encoded); - - // @todo support all of the current input options. $pharPath = \Phar::running(); if (!empty($pharPath)) { $phpstanBin = 'vendor/phpstan/phpstan/phpstan'; + $configuration['parameters']['bootstrap'] = 'error-bootstrap.php'; } else { $phpstanBin = __DIR__ . '/../../vendor/phpstan/phpstan/phpstan'; + $configuration['parameters']['bootstrap'] = __DIR__ . '/../../error-bootstrap.php'; } + $configuration_encoded = Neon::encode($configuration_data, Neon::BLOCK); + $configuration = sys_get_temp_dir() . '/drupal_check_phpstan_' . time() . '.neon'; + file_put_contents($configuration, $configuration_encoded); + $command = [ $phpstanBin, 'analyse', '-c', $configuration, - '--error-format=' . $input->getOption('format'), - implode(' ', $paths) + '--error-format=' . $input->getOption('format') ]; + if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE) { + $command[] = '-v'; + } elseif ($output->getVerbosity() === OutputInterface::VERBOSITY_VERY_VERBOSE) { + $command[] = '-vv'; + } elseif ($output->getVerbosity() === OutputInterface::VERBOSITY_DEBUG) { + $command[] = '-vvv'; + } + $command[] = implode(' ', $paths); + $process = new Process($command); $process->setTty(true); $process->setTimeout(null); diff --git a/src/DrupalCheckErrorHandler.php b/src/ErrorHandler.php similarity index 95% rename from src/DrupalCheckErrorHandler.php rename to src/ErrorHandler.php index 9fb1567..6d4eab4 100644 --- a/src/DrupalCheckErrorHandler.php +++ b/src/ErrorHandler.php @@ -2,7 +2,7 @@ namespace DrupalCheck; -final class DrupalCheckErrorHandler +final class ErrorHandler { private $previousErrorHandler; private $gatheredWarnings = []; From b4ef3572d0cea1049d10951630df9908fab13284 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Wed, 15 Jan 2020 22:20:04 -0600 Subject: [PATCH 11/19] Fix bootstrap and error handler registration --- error-bootstrap.php | 3 +-- src/Command/CheckCommand.php | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/error-bootstrap.php b/error-bootstrap.php index 3cfcc42..c0e1e6e 100644 --- a/error-bootstrap.php +++ b/error-bootstrap.php @@ -1,11 +1,10 @@ register(); - register_shutdown_function(static function() use ($errorHandler): void { $errorHandler->restore(); $warnings = $errorHandler->getWarnings(); diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index 59267bd..043d7b2 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -4,6 +4,7 @@ use DrupalFinder\DrupalFinder; use Nette\Neon\Neon; +use PHPStan\ShouldNotHappenException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -159,16 +160,24 @@ protected function execute(InputInterface $input, OutputInterface $output): int $pharPath = \Phar::running(); if (!empty($pharPath)) { $phpstanBin = 'vendor/phpstan/phpstan/phpstan'; - $configuration['parameters']['bootstrap'] = 'error-bootstrap.php'; - } else { + $configuration_data['parameters']['bootstrap'] = 'error-bootstrap.php'; + } elseif (file_exists(__DIR__ . '/../../vendor/autoload.php')) { $phpstanBin = __DIR__ . '/../../vendor/phpstan/phpstan/phpstan'; - $configuration['parameters']['bootstrap'] = __DIR__ . '/../../error-bootstrap.php'; + $configuration_data['parameters']['bootstrap'] = __DIR__ . '/../../error-bootstrap.php'; + } elseif (file_exists(__DIR__ . '/../../../../vendor/autoload.php')) { + $phpstanBin = __DIR__ . '/../../../../vendor/phpstan/phpstan/phpstan'; + $configuration_data['parameters']['bootstrap'] = __DIR__ . '/../../error-bootstrap.php'; + } else { + throw new ShouldNotHappenException('Could not determine if local or global installation'); } $configuration_encoded = Neon::encode($configuration_data, Neon::BLOCK); $configuration = sys_get_temp_dir() . '/drupal_check_phpstan_' . time() . '.neon'; file_put_contents($configuration, $configuration_encoded); + $output->writeln('PHPStan configuration:', OutputInterface::VERBOSITY_DEBUG); + $output->writeln($configuration_encoded, OutputInterface::VERBOSITY_DEBUG); + $command = [ $phpstanBin, 'analyse', From e4c8f5ee5c6b8df5a9ec4c3988014745fcfc6e40 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Wed, 15 Jan 2020 22:26:12 -0600 Subject: [PATCH 12/19] Fix bootstrap path in phar --- box.json | 1 + src/Command/CheckCommand.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/box.json b/box.json index 5b2a68f..1895233 100644 --- a/box.json +++ b/box.json @@ -1,4 +1,5 @@ { "directories": ["src", "vendor"], + "files": ["error-bootstrap.php"], "stub": "stub.php" } diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index 043d7b2..6e6815b 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -160,7 +160,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $pharPath = \Phar::running(); if (!empty($pharPath)) { $phpstanBin = 'vendor/phpstan/phpstan/phpstan'; - $configuration_data['parameters']['bootstrap'] = 'error-bootstrap.php'; + $configuration_data['parameters']['bootstrap'] = $pharPath . '/error-bootstrap.php'; } elseif (file_exists(__DIR__ . '/../../vendor/autoload.php')) { $phpstanBin = __DIR__ . '/../../vendor/phpstan/phpstan/phpstan'; $configuration_data['parameters']['bootstrap'] = __DIR__ . '/../../error-bootstrap.php'; From 49fc7f82065a4e9dd1cd9a18603d31b380ed2aea Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Mon, 27 Jan 2020 14:13:10 -0600 Subject: [PATCH 13/19] Update dependencies --- composer.lock | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/composer.lock b/composer.lock index 76deb37..addc7b3 100644 --- a/composer.lock +++ b/composer.lock @@ -103,16 +103,16 @@ }, { "name": "mglaman/phpstan-drupal", - "version": "0.12.1", + "version": "0.12.2", "source": { "type": "git", "url": "https://github.com/mglaman/phpstan-drupal.git", - "reference": "3a2ba26a67c9095a7a47841d73561baceda3a20a" + "reference": "bcd4ba1db8f49d282f3fb6558bda5cc21f677cc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/3a2ba26a67c9095a7a47841d73561baceda3a20a", - "reference": "3a2ba26a67c9095a7a47841d73561baceda3a20a", + "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/bcd4ba1db8f49d282f3fb6558bda5cc21f677cc9", + "reference": "bcd4ba1db8f49d282f3fb6558bda5cc21f677cc9", "shasum": "" }, "require": { @@ -178,7 +178,7 @@ } ], "description": "Drupal extension and rules for PHPStan", - "time": "2020-01-13T19:41:44+00:00" + "time": "2020-01-27T20:01:01+00:00" }, { "name": "nette/finder", @@ -479,16 +479,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.5", + "version": "0.12.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "71a20c18f06c53605251a00a8efe443fa85225d1" + "reference": "62a552602b7586d82826231f2fd4cbfe39fe0b1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/71a20c18f06c53605251a00a8efe443fa85225d1", - "reference": "71a20c18f06c53605251a00a8efe443fa85225d1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/62a552602b7586d82826231f2fd4cbfe39fe0b1d", + "reference": "62a552602b7586d82826231f2fd4cbfe39fe0b1d", "shasum": "" }, "require": { @@ -514,7 +514,7 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2020-01-12T14:31:21+00:00" + "time": "2020-01-26T23:36:48+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -665,16 +665,16 @@ }, { "name": "symfony/console", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0" + "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/82437719dab1e6bdd28726af14cb345c2ec816d0", - "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0", + "url": "https://api.github.com/repos/symfony/console/zipball/e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", + "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", "shasum": "" }, "require": { @@ -737,7 +737,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-17T10:32:23+00:00" + "time": "2020-01-10T21:54:01+00:00" }, { "name": "symfony/polyfill-ctype", @@ -916,16 +916,16 @@ }, { "name": "symfony/process", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b" + "reference": "f5697ab4cb14a5deed7473819e63141bf5352c36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b84501ad50adb72a94fb460a5b5c91f693e99c9b", - "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b", + "url": "https://api.github.com/repos/symfony/process/zipball/f5697ab4cb14a5deed7473819e63141bf5352c36", + "reference": "f5697ab4cb14a5deed7473819e63141bf5352c36", "shasum": "" }, "require": { @@ -961,7 +961,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-12-06T10:06:46+00:00" + "time": "2020-01-09T09:50:08+00:00" }, { "name": "symfony/service-contracts", @@ -1023,16 +1023,16 @@ }, { "name": "symfony/yaml", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c" + "reference": "cd014e425b3668220adb865f53bff64b3ad21767" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/a08832b974dd5fafe3085a66d41fe4c84bb2628c", - "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/cd014e425b3668220adb865f53bff64b3ad21767", + "reference": "cd014e425b3668220adb865f53bff64b3ad21767", "shasum": "" }, "require": { @@ -1078,7 +1078,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-12-10T10:33:21+00:00" + "time": "2020-01-21T11:12:16+00:00" }, { "name": "webflo/drupal-finder", From f0e6ad77f3dc420a32382a4e01dd9a27ba5aa890 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Mon, 27 Jan 2020 16:15:24 -0600 Subject: [PATCH 14/19] Fix Lightning install, global install detection --- .circleci/config.yml | 5 ++++- src/Command/CheckCommand.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 18cc99b..ba1f209 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,10 @@ commands: - run: composer require << parameters.project >> --working-dir /tmp/drupal global-require: steps: + - run: + name: Remove existing vendor dir + command: | + rm -rf ~/repo/vendor - run: name: Add project as a global dependency command: | @@ -58,7 +62,6 @@ commands: composer global config prefer-stable true composer global config repositories.0 '{"type": "path", "url": "'$CIRCLE_WORKING_DIRECTORY'", "options": { "symlink": false }}' composer global require mglaman/drupal-check "*" - rm -rf ~/.composer/vendor/mglaman/drupal-check/vendor - run: name: Add Composer global path command: | diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index 6e6815b..216dc70 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -164,8 +164,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int } elseif (file_exists(__DIR__ . '/../../vendor/autoload.php')) { $phpstanBin = __DIR__ . '/../../vendor/phpstan/phpstan/phpstan'; $configuration_data['parameters']['bootstrap'] = __DIR__ . '/../../error-bootstrap.php'; - } elseif (file_exists(__DIR__ . '/../../../../vendor/autoload.php')) { - $phpstanBin = __DIR__ . '/../../../../vendor/phpstan/phpstan/phpstan'; + } elseif (file_exists(__DIR__ . '/../../../../autoload.php')) { + $phpstanBin = __DIR__ . '/../../../../phpstan/phpstan/phpstan'; $configuration_data['parameters']['bootstrap'] = __DIR__ . '/../../error-bootstrap.php'; } else { throw new ShouldNotHappenException('Could not determine if local or global installation'); From 1ff520441529242ece27f732a17979d7390e3bb7 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Mon, 27 Jan 2020 17:02:50 -0600 Subject: [PATCH 15/19] Fix configuration as global installation --- src/Command/CheckCommand.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index 216dc70..f58d14b 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -158,15 +158,23 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $pharPath = \Phar::running(); - if (!empty($pharPath)) { + if ($pharPath !== '') { + // Running in packaged Phar archive. $phpstanBin = 'vendor/phpstan/phpstan/phpstan'; $configuration_data['parameters']['bootstrap'] = $pharPath . '/error-bootstrap.php'; } elseif (file_exists(__DIR__ . '/../../vendor/autoload.php')) { + // Running as a project dependency. $phpstanBin = __DIR__ . '/../../vendor/phpstan/phpstan/phpstan'; $configuration_data['parameters']['bootstrap'] = __DIR__ . '/../../error-bootstrap.php'; } elseif (file_exists(__DIR__ . '/../../../../autoload.php')) { + // Running as a global dependency. $phpstanBin = __DIR__ . '/../../../../phpstan/phpstan/phpstan'; $configuration_data['parameters']['bootstrap'] = __DIR__ . '/../../error-bootstrap.php'; + // The phpstan/extension-installer doesn't seem to register. + $configuration_data['includes'] = [ + __DIR__ . '/../../../../phpstan/phpstan-deprecation-rules/rules.neon', + __DIR__ . '/../../../../mglaman/phpstan-drupal/extension.neon', + ]; } else { throw new ShouldNotHappenException('Could not determine if local or global installation'); } From 22b4781920790ba3bfa0456944dff3850babbb18 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Mon, 27 Jan 2020 17:13:05 -0600 Subject: [PATCH 16/19] Remove phpstan/extension-installer --- composer.json | 1 - composer.lock | 46 +----------------------------------- src/Command/CheckCommand.php | 8 +++++++ 3 files changed, 9 insertions(+), 46 deletions(-) diff --git a/composer.json b/composer.json index dbf7cb4..b7e79fb 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,6 @@ "jean85/pretty-package-versions": "^1.2", "mglaman/phpstan-drupal": "^0.12", "nette/neon": "^3.1", - "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12", "phpstan/phpstan-deprecation-rules": "^0.12", "symfony/console": "~3.2 || ~4.0", diff --git a/composer.lock b/composer.lock index addc7b3..4874290 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a0ed02f5bf6a4eea7523705d8c30f9c3", + "content-hash": "ebde8c1e295ee7d195893e6974fc3aed", "packages": [ { "name": "composer/xdebug-handler", @@ -433,50 +433,6 @@ "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "time": "2019-11-15T16:17:10+00:00" }, - { - "name": "phpstan/extension-installer", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phpstan/extension-installer.git", - "reference": "295656793c53b5eb73a38486032ad1bd650264bc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/295656793c53b5eb73a38486032ad1bd650264bc", - "reference": "295656793c53b5eb73a38486032ad1bd650264bc", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1", - "php": "^7.1", - "phpstan/phpstan": ">=0.11.6" - }, - "require-dev": { - "composer/composer": "^1.8", - "consistence/coding-standard": "^3.8", - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", - "jakub-onderka/php-parallel-lint": "^1.0", - "phing/phing": "^2.16", - "phpstan/phpstan-strict-rules": "^0.11", - "slevomat/coding-standard": "^5.0.4" - }, - "type": "composer-plugin", - "extra": { - "class": "PHPStan\\ExtensionInstaller\\Plugin" - }, - "autoload": { - "psr-4": { - "PHPStan\\ExtensionInstaller\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Composer plugin for automatic installation of PHPStan extensions", - "time": "2019-10-18T17:09:48+00:00" - }, { "name": "phpstan/phpstan", "version": "0.12.8", diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index f58d14b..ce25e11 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -162,10 +162,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Running in packaged Phar archive. $phpstanBin = 'vendor/phpstan/phpstan/phpstan'; $configuration_data['parameters']['bootstrap'] = $pharPath . '/error-bootstrap.php'; + $configuration_data['includes'] = [ + $pharPath . '/vendor/phpstan/phpstan-deprecation-rules/rules.neon', + $pharPath . '/vendor/mglaman/phpstan-drupal/extension.neon', + ]; } elseif (file_exists(__DIR__ . '/../../vendor/autoload.php')) { // Running as a project dependency. $phpstanBin = __DIR__ . '/../../vendor/phpstan/phpstan/phpstan'; $configuration_data['parameters']['bootstrap'] = __DIR__ . '/../../error-bootstrap.php'; + $configuration_data['includes'] = [ + __DIR__ . '/../../vendor/phpstan/phpstan-deprecation-rules/rules.neon', + __DIR__ . '/../../vendor/mglaman/phpstan-drupal/extension.neon', + ]; } elseif (file_exists(__DIR__ . '/../../../../autoload.php')) { // Running as a global dependency. $phpstanBin = __DIR__ . '/../../../../phpstan/phpstan/phpstan'; From 5fa8adb4cd1ccf2ab0154334dd138744c70db8ae Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Tue, 28 Jan 2020 07:49:33 -0600 Subject: [PATCH 17/19] Fix multiple paths --- src/Command/CheckCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index ce25e11..7222c0c 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -208,7 +208,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } elseif ($output->getVerbosity() === OutputInterface::VERBOSITY_DEBUG) { $command[] = '-vvv'; } - $command[] = implode(' ', $paths); + $command = array_merge($command, $paths); $process = new Process($command); $process->setTty(true); From f9ea9880095adc0516c802de86a09eca8d7d0454 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Tue, 28 Jan 2020 07:52:05 -0600 Subject: [PATCH 18/19] Remove memory problems in ctools --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ba1f209..cd86178 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -204,7 +204,7 @@ jobs: - run: name: Phar - Run against a module command: | - php drupal-check.phar /tmp/drupal/web/modules/contrib/ctools || if (($? == 255)); then false; else true; fi + php -d memory_limit=-1 drupal-check.phar /tmp/drupal/web/modules/contrib/ctools || if (($? == 255)); then false; else true; fi test_global_require_with_drush: <<: *defaults steps: From 2e112a3d0287d83d21511c1cbf5d79f5830c55d9 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Tue, 28 Jan 2020 11:44:11 -0600 Subject: [PATCH 19/19] Fix memory errors and version of ctools w/ fatal error --- .circleci/config.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cd86178..6ba87fc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,6 +14,12 @@ commands: - checkout - run: sudo apt-get update && sudo apt-get install -y libpng-dev libjpeg62-turbo-dev - run: sudo docker-php-ext-install gd + - run: + name: Disable PHP memory limit + command: echo 'memory_limit=-1' | sudo tee -a /usr/local/etc/php/php.ini + - run: + name: Disable xdebug PHP extension + command: sudo rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini - restore_cache: keys: - *composer-cache @@ -23,7 +29,6 @@ commands: key: *composer-cache paths: - ~/.composer/cache - build-phar: steps: - run: echo "Downloading box.phar version $BOX_VERSION" @@ -200,7 +205,7 @@ jobs: - build-phar - create-drupal-project - require-contrib: - project: drupal/ctools:^3 + project: drupal/ctools:3.x-dev - run: name: Phar - Run against a module command: |