Added detection for deprecated features into phpstan

This commit is contained in:
Matias Griese
2019-03-19 13:37:02 +02:00
parent 8c1c813acd
commit 5995515419
4 changed files with 50 additions and 23 deletions

View File

@@ -54,7 +54,7 @@
"require-dev": {
"codeception/codeception": "^2.4",
"phpstan/phpstan": "^0.11",
"phpstan/phpstan-strict-rules": "^0.11",
"phpstan/phpstan-deprecation-rules": "^0.11.0",
"phpunit/php-code-coverage": "~6.0",
"fzaninotto/faker": "^1.8",
"victorjonsson/markdowndocs": "dev-master"

38
composer.lock generated
View File

@@ -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": "584da9b89b2ab2de09b0ccc5c4bee34d",
"content-hash": "dce6e4d72c9b5ac769cd3d93fecdf1c2",
"packages": [
{
"name": "antoligy/dom-string-iterators",
@@ -4153,16 +4153,16 @@
},
{
"name": "phpstan/phpstan",
"version": "0.11.3",
"version": "0.11.4",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "e4644b4a8fd393c346f1137305fb2f76a7dc20a7"
"reference": "ccc4f854748664cc61d1f3d4ecb26810df1f0cd4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e4644b4a8fd393c346f1137305fb2f76a7dc20a7",
"reference": "e4644b4a8fd393c346f1137305fb2f76a7dc20a7",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/ccc4f854748664cc61d1f3d4ecb26810df1f0cd4",
"reference": "ccc4f854748664cc61d1f3d4ecb26810df1f0cd4",
"shasum": ""
},
"require": {
@@ -4222,20 +4222,20 @@
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"time": "2019-03-10T16:25:30+00:00"
"time": "2019-03-14T14:46:15+00:00"
},
{
"name": "phpstan/phpstan-strict-rules",
"name": "phpstan/phpstan-deprecation-rules",
"version": "0.11",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
"reference": "747a742b26a35ef4e4ebef5ec4490ad74eebcbc0"
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
"reference": "449fee6223220b337760abca4444801ddcc8b38d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/747a742b26a35ef4e4ebef5ec4490ad74eebcbc0",
"reference": "747a742b26a35ef4e4ebef5ec4490ad74eebcbc0",
"url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/449fee6223220b337760abca4444801ddcc8b38d",
"reference": "449fee6223220b337760abca4444801ddcc8b38d",
"shasum": ""
},
"require": {
@@ -4267,8 +4267,8 @@
"license": [
"MIT"
],
"description": "Extra strict and opinionated rules for PHPStan",
"time": "2019-01-14T09:56:55+00:00"
"description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.",
"time": "2018-12-05T18:04:16+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -4524,16 +4524,16 @@
},
{
"name": "phpunit/phpunit",
"version": "7.5.6",
"version": "7.5.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9"
"reference": "eb343b86753d26de07ecba7868fa983104361948"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9",
"reference": "09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/eb343b86753d26de07ecba7868fa983104361948",
"reference": "eb343b86753d26de07ecba7868fa983104361948",
"shasum": ""
},
"require": {
@@ -4551,7 +4551,7 @@
"phpunit/php-code-coverage": "^6.0.7",
"phpunit/php-file-iterator": "^2.0.1",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-timer": "^2.0",
"phpunit/php-timer": "^2.1",
"sebastian/comparator": "^3.0",
"sebastian/diff": "^3.0",
"sebastian/environment": "^4.0",
@@ -4604,7 +4604,7 @@
"testing",
"xunit"
],
"time": "2019-02-18T09:24:50+00:00"
"time": "2019-03-16T07:31:17+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",

View File

@@ -1,5 +1,6 @@
includes:
#- vendor/phpstan/phpstan-strict-rules/rules.neon
#- '../../vendor/phpstan/phpstan-strict-rules/rules.neon'
- '../../vendor/phpstan/phpstan-deprecation-rules/rules.neon'
parameters:
fileExtensions:
- php
@@ -30,6 +31,11 @@ parameters:
message: '#Cannot call method path\(\) on string#'
path: 'system/src/Grav/Common/Page/Media.php'
# TODO: system.twig.umask_fix will not work with Twig 2 anymore
-
message: '#Call to deprecated method writeCacheFile\(\) of class Twig\\Environment#'
path: 'system/src/Grav/Common/Twig/WriteCacheFileTrait.php'
# Needed: full coverage (probably with admin plugin...) then redesign constructor
-
message: '#Grav\\Common\\GPM\\Remote\\GravCore::__construct\(\) does not call parent constructor from Grav\\Common\\GPM\\Remote\\AbstractPackageCollection#'
@@ -77,4 +83,24 @@ parameters:
path: 'system/src/Grav/Common/Cache.php'
-
message: '#on an unknown class Collator#'
path: 'system/src/Grav/Common/Page/Pages.php'
path: 'system/src/Grav/Common/Page/Pages.php'
# Support for deprecated features
-
message: '#Instantiation of deprecated class Doctrine\\Common\\Cache\\MemcacheCache#'
path: 'system/src/Grav/Common/Cache.php'
-
message: '#Call to deprecated method order#'
path: 'system/src/Grav/Common/Page/Pages.php'
-
message: '#Fetching class constant class of deprecated class Grav\\Common\\User\\User#'
path: 'system/src/Grav/Common/Service/AccountsServiceProvider.php'
-
message: '#Call to deprecated method getLegacyFiles\(\)#'
path: 'system/src/Grav/Common/Session.php'
-
message: '#Call to deprecated method getType\(\) of class#'
path: 'system/src/Grav/Framework/Object/Base/ObjectTrait.php'
-
message: '#deprecated class#'
path: 'system/src/Grav/Framework/Uri/Uri.php'

View File

@@ -1,5 +1,6 @@
includes:
#- vendor/phpstan/phpstan-strict-rules/rules.neon
#- '../../vendor/phpstan/phpstan-strict-rules/rules.neon'
- '../../vendor/phpstan/phpstan-deprecation-rules/rules.neon'
parameters:
fileExtensions:
- php