diff --git a/.circleci/config.yml b/.circleci/config.yml
index 497dedd..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"
@@ -51,6 +56,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 +67,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: |
@@ -197,11 +205,11 @@ 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: |
- 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:
@@ -245,7 +253,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/box.json b/box.json
index 811cc3f..1895233 100644
--- a/box.json
+++ b/box.json
@@ -1,4 +1,5 @@
{
- "directories": ["phpstan", "src", "vendor"],
+ "directories": ["src", "vendor"],
+ "files": ["error-bootstrap.php"],
"stub": "stub.php"
}
diff --git a/composer.json b/composer.json
index 7aeb70b..b7e79fb 100644
--- a/composer.json
+++ b/composer.json
@@ -13,11 +13,12 @@
"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",
+ "nette/neon": "^3.1",
+ "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 0634861..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": "0e3f4ec5a396de919e336dca7c16c2d2",
+ "content-hash": "ebde8c1e295ee7d195893e6974fc3aed",
"packages": [
{
"name": "composer/xdebug-handler",
@@ -103,35 +103,31 @@
},
{
"name": "mglaman/phpstan-drupal",
- "version": "0.11.14",
+ "version": "0.12.2",
"source": {
"type": "git",
"url": "https://github.com/mglaman/phpstan-drupal.git",
- "reference": "3458665f7bb579f700c1384d5bc05d879757f76c"
+ "reference": "bcd4ba1db8f49d282f3fb6558bda5cc21f677cc9"
},
"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/bcd4ba1db8f49d282f3fb6558bda5cc21f677cc9",
+ "reference": "bcd4ba1db8f49d282f3fb6558bda5cc21f677cc9",
"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-27T20:01:01+00:00"
},
{
"name": "nette/finder",
@@ -498,185 +305,6 @@
],
"time": "2019-12-27T04:00:04+00:00"
},
- {
- "name": "nette/php-generator",
- "version": "v3.3.3",
- "source": {
- "type": "git",
- "url": "https://github.com/nette/php-generator.git",
- "reference": "a4ff22c91681fefaa774cf952a2b69c2ec9477c1"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/nette/php-generator/zipball/a4ff22c91681fefaa774cf952a2b69c2ec9477c1",
- "reference": "a4ff22c91681fefaa774cf952a2b69c2ec9477c1",
- "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": "2020-01-20T11:40:42+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.2",
- "source": {
- "type": "git",
- "url": "https://github.com/nette/schema.git",
- "reference": "febf71fb4052c824046f5a33f4f769a6e7fa0cb4"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/nette/schema/zipball/febf71fb4052c824046f5a33f4f769a6e7fa0cb4",
- "reference": "febf71fb4052c824046f5a33f4f769a6e7fa0cb4",
- "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": "2020-01-06T22:52:48+00:00"
- },
{
"name": "nette/utils",
"version": "v3.1.0",
@@ -755,58 +383,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 +433,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.8",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
- "reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7"
+ "reference": "62a552602b7586d82826231f2fd4cbfe39fe0b1d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/63cc502f6957b7f74efbac444b4cf219dcadffd7",
- "reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/62a552602b7586d82826231f2fd4cbfe39fe0b1d",
+ "reference": "62a552602b7586d82826231f2fd4cbfe39fe0b1d",
"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-26T23:36:48+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 +521,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",
@@ -1202,55 +695,6 @@
"homepage": "https://symfony.com",
"time": "2020-01-10T21:54:01+00:00"
},
- {
- "name": "symfony/finder",
- "version": "v4.4.3",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/finder.git",
- "reference": "3a50be43515590faf812fbd7708200aabc327ec3"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/3a50be43515590faf812fbd7708200aabc327ec3",
- "reference": "3a50be43515590faf812fbd7708200aabc327ec3",
- "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": "2020-01-04T13:00:46+00:00"
- },
{
"name": "symfony/polyfill-ctype",
"version": "v1.13.1",
@@ -1426,6 +870,55 @@
],
"time": "2019-11-27T16:25:15+00:00"
},
+ {
+ "name": "symfony/process",
+ "version": "v4.4.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/process.git",
+ "reference": "f5697ab4cb14a5deed7473819e63141bf5352c36"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/process/zipball/f5697ab4cb14a5deed7473819e63141bf5352c36",
+ "reference": "f5697ab4cb14a5deed7473819e63141bf5352c36",
+ "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": "2020-01-09T09:50:08+00:00"
+ },
{
"name": "symfony/service-contracts",
"version": "v2.0.1",
diff --git a/error-bootstrap.php b/error-bootstrap.php
new file mode 100644
index 0000000..c0e1e6e
--- /dev/null
+++ b/error-bootstrap.php
@@ -0,0 +1,17 @@
+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/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 59eceac..0000000
--- a/phpstan/deprecation_testing.neon
+++ /dev/null
@@ -1,12 +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
- - 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/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 d0c8a2a..0000000
--- a/phpstan/rules_and_deprecations_testing.neon
+++ /dev/null
@@ -1,6 +0,0 @@
-parameters:
- level: 1
-includes:
- - base_config.neon
- - phpstan_deprecation_rules.php
- - junit_formatter.neon
diff --git a/phpstan/rules_testing.neon b/phpstan/rules_testing.neon
deleted file mode 100644
index c514d88..0000000
--- a/phpstan/rules_testing.neon
+++ /dev/null
@@ -1,5 +0,0 @@
-parameters:
- level: 1
-includes:
- - base_config.neon
- - junit_formatter.neon
diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php
index e657516..7222c0c 100644
--- a/src/Command/CheckCommand.php
+++ b/src/Command/CheckCommand.php
@@ -2,25 +2,22 @@
namespace DrupalCheck\Command;
-use DrupalCheck\DrupalCheckErrorHandler;
use DrupalFinder\DrupalFinder;
-use PHPStan\Command\AnalyseApplication;
-use PHPStan\Command\CommandHelper;
-use PHPStan\Command\ErrorFormatter\ErrorFormatter;
-use PHPStan\Command\ErrorsConsoleStyle;
+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;
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;
@@ -37,7 +34,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'
@@ -83,9 +80,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 = [];
@@ -125,83 +119,109 @@ 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';
+ $configuration_data = [
+ 'parameters' => [
+ 'tipsOfTheDay' => false,
+ '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;
+ }
+
+ 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.#'
+ ];
+ }
+
+ if ($this->isStyleCheck) {
// @todo: only analysis check, style check. all of the above at once.
$output->writeln('Not support, yet');
return 1;
}
- 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;
+ $pharPath = \Phar::running();
+ if ($pharPath !== '') {
+ // 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';
+ $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');
}
- $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)))
- ));
- 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);
+
+ $output->writeln('PHPStan configuration:', OutputInterface::VERBOSITY_DEBUG);
+ $output->writeln($configuration_encoded, OutputInterface::VERBOSITY_DEBUG);
+
+ $command = [
+ $phpstanBin,
+ 'analyse',
+ '-c',
+ $configuration,
+ '--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';
}
-
- /** @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");
+ $command = array_merge($command, $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();
}
}
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 = [];