diff --git a/.gitignore b/.gitignore index 394c1d5..78f5fba 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ !/**/.gitkeep !/.idea/** !/config/** +!/phpstan.neon !/scripts/** !/web/modules/custom/** !/web/sites/default/environments/settings.*.php diff --git a/composer.json b/composer.json index e5f1ee9..e69b8bc 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,10 @@ }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2", - "drupal/coder": "^8.3" + "drupal/coder": "^8.3", + "mglaman/phpstan-drupal": "^0.12.3", + "phpstan/phpstan": "^0.12.19", + "phpstan/phpstan-deprecation-rules": "^0.12.2" }, "conflict": { "drupal/drupal": "*" diff --git a/composer.lock b/composer.lock index 47eca69..d94fa0a 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": "7774bc7cd069993030bd31b9913bf6f2", + "content-hash": "048aa398777f70ad3f8d134435feee84", "packages": [ { "name": "asm89/stack-cors", @@ -6503,6 +6503,343 @@ ], "time": "2020-03-08T19:03:35+00:00" }, + { + "name": "mglaman/phpstan-drupal", + "version": "0.12.3", + "source": { + "type": "git", + "url": "https://github.com/mglaman/phpstan-drupal.git", + "reference": "c72367d12498c9f5d3738852d4089b4570690a55" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/c72367d12498c9f5d3738852d4089b4570690a55", + "reference": "c72367d12498c9f5d3738852d4089b4570690a55", + "shasum": "" + }, + "require": { + "nette/finder": "^2.5", + "php": "^7.1", + "phpstan/phpstan": "^0.12.0", + "symfony/yaml": "~3.4.5|^4.2", + "webflo/drupal-finder": "^1.2" + }, + "require-dev": { + "composer/installers": "^1.6", + "drupal/core-recommended": "^8.8@alpha", + "drush/drush": "^9.6", + "phpstan/phpstan-deprecation-rules": "~0.12.0", + "phpstan/phpstan-strict-rules": "^0.12.0", + "phpunit/phpunit": "^7.5", + "squizlabs/php_codesniffer": "^3.3" + }, + "suggest": { + "phpstan/phpstan-deprecation-rules": "For catching deprecations, especially in Drupal core." + }, + "type": "phpstan-extension", + "extra": { + "branch-alias": { + "dev-master": "0.12-dev" + }, + "installer-paths": { + "tests/fixtures/drupal/core": [ + "type:drupal-core" + ], + "tests/fixtures/drupal/libraries/{$name}": [ + "type:drupal-library" + ], + "tests/fixtures/drupal/modules/contrib/{$name}": [ + "type:drupal-module" + ], + "tests/fixtures/drupal/profiles/contrib/{$name}": [ + "type:drupal-profile" + ], + "tests/fixtures/drupal/themes/contrib/{$name}": [ + "type:drupal-theme" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matt Glaman", + "email": "nmd.matt@gmail.com" + } + ], + "description": "Drupal extension and rules for PHPStan", + "funding": [ + { + "url": "https://github.com/mglaman", + "type": "github" + }, + { + "url": "https://liberapay.com/mglaman", + "type": "liberapay" + } + ], + "time": "2020-03-31T19:03:49+00:00" + }, + { + "name": "nette/finder", + "version": "v2.5.2", + "source": { + "type": "git", + "url": "https://github.com/nette/finder.git", + "reference": "4ad2c298eb8c687dd0e74ae84206a4186eeaed50" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/finder/zipball/4ad2c298eb8c687dd0e74ae84206a4186eeaed50", + "reference": "4ad2c298eb8c687dd0e74ae84206a4186eeaed50", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4 || ^3.0", + "php": ">=7.1" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "phpstan/phpstan": "^0.12", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-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 Finder: find files and directories with an intuitive API.", + "homepage": "https://nette.org", + "keywords": [ + "filesystem", + "glob", + "iterator", + "nette" + ], + "time": "2020-01-03T20:35:40+00:00" + }, + { + "name": "nette/utils", + "version": "v3.1.1", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "2c17d16d8887579ae1c0898ff94a3668997fd3eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/2c17d16d8887579ae1c0898ff94a3668997fd3eb", + "reference": "2c17d16d8887579ae1c0898ff94a3668997fd3eb", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "nette/tester": "~2.0", + "phpstan/phpstan": "^0.12", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize() and toAscii()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "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-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "time": "2020-02-09T14:10:55+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "0.12.19", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "054f6d76b12ba9a6c13a5a8d5fcdf51219615f4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/054f6d76b12ba9a6c13a5a8d5fcdf51219615f4d", + "reference": "054f6d76b12ba9a6c13a5a8d5fcdf51219615f4d", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.12-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpstan", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2020-04-19T20:35:10+00:00" + }, + { + "name": "phpstan/phpstan-deprecation-rules", + "version": "0.12.2", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", + "reference": "51d21a83b97e539e1fc56c1ce42ac0f187407fb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/51d21a83b97e539e1fc56c1ce42ac0f187407fb6", + "reference": "51d21a83b97e539e1fc56c1ce42ac0f187407fb6", + "shasum": "" + }, + "require": { + "php": "~7.1", + "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.12", + "phpunit/phpunit": "^7.0", + "slevomat/coding-standard": "^4.5.2" + }, + "type": "phpstan-extension", + "extra": { + "branch-alias": { + "dev-master": "0.12-dev" + }, + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", + "time": "2020-01-12T16:25:40+00:00" + }, { "name": "squizlabs/php_codesniffer", "version": "3.5.4", diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..85d00f4 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,12 @@ +parameters: + level: 7 + paths: + - web/modules/custom + - web/themes/custom + excludes_analyse: + - *Test.php + - *TestBase.php + checkMissingIterableValueType: false +includes: + - vendor/mglaman/phpstan-drupal/extension.neon + - vendor/phpstan/phpstan-deprecation-rules/rules.neon