From 5ba70f0ecbf37abbd907dea1690266f2a62c7829 Mon Sep 17 00:00:00 2001 From: Arjen Miedema Date: Wed, 3 Jan 2018 11:45:45 +0100 Subject: [PATCH 1/4] Remove TestFramework and Factory errors in PHPStan Since TestFramework and Factory classes are used in quite some extensions, but are dynamically generated by Magento by running the Magento 2 setup, this will result in several errors when checking your extension with the testing suite. Source: https://github.com/tddwizard/magento2-fixtures/blob/master/phpstan.neon --- phpstan.neon | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpstan.neon b/phpstan.neon index cbef7da..9241ef0 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,6 @@ parameters: excludes_analyse: - src/installers.php + ignoreErrors: + - '#(class|type) Magento\\TestFramework#i' + - '#(class|type) Magento\\\S*Factory#i' From 3d0d6f13e73d4242445459c0b89d7e23d5138705 Mon Sep 17 00:00:00 2001 From: Arjen Miedema Date: Wed, 3 Jan 2018 13:03:08 +0100 Subject: [PATCH 2/4] Move phpstan.neon file/changes to the correct folder The ignoreErrors section was in the wrong phpstan.neon file, so it wasn't available for Magento 2 projects, but for the Testing Suite itself. --- phpstan.neon | 3 --- templates/files/magento2/phpstan.neon | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 templates/files/magento2/phpstan.neon diff --git a/phpstan.neon b/phpstan.neon index 9241ef0..cbef7da 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,3 @@ parameters: excludes_analyse: - src/installers.php - ignoreErrors: - - '#(class|type) Magento\\TestFramework#i' - - '#(class|type) Magento\\\S*Factory#i' diff --git a/templates/files/magento2/phpstan.neon b/templates/files/magento2/phpstan.neon new file mode 100644 index 0000000..f1df636 --- /dev/null +++ b/templates/files/magento2/phpstan.neon @@ -0,0 +1,6 @@ +parameters: + excludes_analyse: +# - %rootDir%/../../../path/to/exclude/* + ignoreErrors: + - '#(class|type) Magento\\TestFramework#i' + - '#(class|type) Magento\\\S*Factory#i' \ No newline at end of file From 23e7b5f43fa4690dc9820f8b779162e4412dcf90 Mon Sep 17 00:00:00 2001 From: Arjen Miedema Date: Tue, 9 Jan 2018 14:47:04 +0100 Subject: [PATCH 3/4] Remove unwanted comment from phpstan.neon There was a commented line in phpstan.neon that's currently not being used and has therefore been removed. --- templates/files/magento2/phpstan.neon | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/templates/files/magento2/phpstan.neon b/templates/files/magento2/phpstan.neon index f1df636..1536901 100644 --- a/templates/files/magento2/phpstan.neon +++ b/templates/files/magento2/phpstan.neon @@ -1,6 +1,4 @@ parameters: - excludes_analyse: -# - %rootDir%/../../../path/to/exclude/* ignoreErrors: - '#(class|type) Magento\\TestFramework#i' - - '#(class|type) Magento\\\S*Factory#i' \ No newline at end of file + - '#(class|type) Magento\\\S*Factory#i' From dd48d8f4bb99a6fb3eab4038a8700353b06576f6 Mon Sep 17 00:00:00 2001 From: Arjen Miedema Date: Tue, 9 Jan 2018 15:23:11 +0100 Subject: [PATCH 4/4] Add custom Magento 2 phpstan.neon file to mapping The mapping for the phpstan.neon file for Magento 2 was missing and has been added. --- templates/mapping/project/magento2 | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/mapping/project/magento2 b/templates/mapping/project/magento2 index 6178af7..c578f81 100644 --- a/templates/mapping/project/magento2 +++ b/templates/mapping/project/magento2 @@ -1 +1,2 @@ {magento2/,}phpcs.xml +{magento2/,}phpstan.neon