[TASK] composer require --dev phpstan/phpstan 51/62851/4
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Sun, 12 Jan 2020 15:09:36 +0000 (16:09 +0100)
committerFrank Nägler <frank.naegler@typo3.org>
Fri, 17 Jan 2020 14:17:31 +0000 (15:17 +0100)
This commit introduces a development requirement to
phpstan/phpstan to enable static code analysis.

A basic configuration file has been added as well to
identify most basic errors in the TYPO3 code base.

Releases: master
Resolves: #90097
Change-Id: I87e11eca6296864fdd7ba8cd109a23b82c27f641
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62851
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Steffen Frese <steffenf14@gmail.com>
Tested-by: Felix P. <f.pachowsky@neusta.de>
Tested-by: Sascha Egerer <sascha@sascha-egerer.de>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Steffen Frese <steffenf14@gmail.com>
Reviewed-by: Felix P. <f.pachowsky@neusta.de>
Reviewed-by: Sascha Egerer <sascha@sascha-egerer.de>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
composer.json
composer.lock
phpstan.neon [new file with mode: 0644]

index 92dae65..c8951be 100644 (file)
@@ -77,6 +77,7 @@
                "codeception/codeception": "^2.5.4 || ^3",
                "friendsofphp/php-cs-fixer": "^2.16.1",
                "phpspec/prophecy": "^1.7.5",
+               "phpstan/phpstan": "^0.12.5",
                "rector/rector": "~0.6",
                "typo3/cms-styleguide": "~10.0.2",
                "typo3/testing-framework": "~6.1.0"
index 4ece61f..6e778b5 100644 (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": "e687c985b6332fcf07571d1821f60711",
+    "content-hash": "daf37d00689135848528f707a4b893d2",
     "packages": [
         {
             "name": "cogpowered/finediff",
         },
         {
             "name": "phpstan/phpstan",
-            "version": "0.12.3",
+            "version": "0.12.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phpstan/phpstan.git",
-                "reference": "c15a6ea55da71d8133399306f560cfe4d30301b7"
+                "reference": "71a20c18f06c53605251a00a8efe443fa85225d1"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c15a6ea55da71d8133399306f560cfe4d30301b7",
-                "reference": "c15a6ea55da71d8133399306f560cfe4d30301b7",
+                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/71a20c18f06c53605251a00a8efe443fa85225d1",
+                "reference": "71a20c18f06c53605251a00a8efe443fa85225d1",
                 "shasum": ""
             },
             "require": {
-                "nikic/php-parser": "^4.3.0",
                 "php": "^7.1"
             },
             "bin": [
                 "MIT"
             ],
             "description": "PHPStan - PHP Static Analysis Tool",
-            "time": "2019-12-14T13:41:17+00:00"
+            "time": "2020-01-12T14:31:21+00:00"
         },
         {
             "name": "phpstan/phpstan-phpunit",
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644 (file)
index 0000000..afb2c1f
--- /dev/null
@@ -0,0 +1,26 @@
+parameters:
+  level: 0
+
+  paths:
+    - %currentWorkingDirectory%/typo3/sysext/
+
+  excludes_analyse:
+    - %currentWorkingDirectory%/typo3/sysext/*/Tests/*
+    - %currentWorkingDirectory%/typo3/sysext/*/Documentation/*
+    - %currentWorkingDirectory%/typo3/sysext/*/Resources/*
+    - %currentWorkingDirectory%/typo3/sysext/*/Configuration/*
+
+  ignoreErrors:
+    - '#Undefined variable: \$_EXTKEY#'
+    -
+      message: '#Instantiated class Composer\\Util\\Filesystem not found\.#'
+      path: %currentWorkingDirectory%/typo3/sysext/core/Classes/Composer/CliEntryPoint.php
+    -
+      message: '#Parameter \$event of method [\w\\]+::\w+\(\) has invalid typehint type Composer\\Script\\Event\.#'
+      path: %currentWorkingDirectory%/typo3/sysext/*/Classes/Composer/*
+    -
+      message: '#Access to undefined constant PDO::PGSQL_.+#'
+      path: %currentWorkingDirectory%/typo3/sysext/core/Classes/Database/Driver/PDOPgSql/Driver.php
+    -
+      message: '#Access to undefined constant PDO::SQLSRV_.+#'
+      path: %currentWorkingDirectory%/typo3/sysext/core/Classes/Database/Driver/PDOSqlsrv/Statement.php