From 834b18201d41dbb022a21e5c4abdcf48cda02635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Hochd=C3=B6rfer?= Date: Sat, 13 Feb 2021 21:03:01 +0100 Subject: [PATCH] Add phpstan/phpstan-strict-rules dependency --- composer.json | 9 +- composer.lock | 373 ++++++++++-------- phpstan.neon | 12 +- .../Command/PasswordNormalizer.php | 18 +- .../PasswordNormalizer/Command/SqlHelper.php | 4 +- .../Command/PasswordNormalizerUnitTest.php | 146 +++---- .../Command/SqlHelperUnitTest.php | 20 +- 7 files changed, 318 insertions(+), 264 deletions(-) diff --git a/composer.json b/composer.json index 27e06b8..3e3cc00 100644 --- a/composer.json +++ b/composer.json @@ -23,9 +23,9 @@ ], "require": { "php": "^7.4", - "magento/framework": "^103.0.2", - "magento/module-customer": "^103.0.2", - "magento/module-indexer" : "^100.4.2" + "magento/framework": "102.0.6|103.0.0|103.0.1|103.0.2", + "magento/module-customer": "102.0.6|103.0.0|103.0.1|103.0.2", + "magento/module-indexer" : "100.3.6|100.4.0|100.4.1|100.4.2" }, "require-dev": { "n98/magerun2": "^4.0.0", @@ -38,7 +38,8 @@ "bitexpert/phpstan-magento": "^0.6.0", "roave/security-advisories": "dev-latest", "infection/infection": "^0.21.0", - "bitexpert/captainhook-infection": "^0.3.0" + "bitexpert/captainhook-infection": "^0.3.0", + "phpstan/phpstan-strict-rules": "^0.12.9" }, "repositories": [ { diff --git a/composer.lock b/composer.lock index fe2843e..3d8de18 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": "eb1a32105aad449c56eac4902311774a", + "content-hash": "b5743e91b976269c03d2bc664a1e5b88", "packages": [ { "name": "colinmollenhour/credis", @@ -156,16 +156,16 @@ }, { "name": "composer/composer", - "version": "1.10.20", + "version": "1.10.19", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "e55d297525f0ecc805c813a0f63a40114fd670f6" + "reference": "196601d50c08c3fae389a417a7689367fcf37cef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/e55d297525f0ecc805c813a0f63a40114fd670f6", - "reference": "e55d297525f0ecc805c813a0f63a40114fd670f6", + "url": "https://api.github.com/repos/composer/composer/zipball/196601d50c08c3fae389a417a7689367fcf37cef", + "reference": "196601d50c08c3fae389a417a7689367fcf37cef", "shasum": "" }, "require": { @@ -246,7 +246,7 @@ "type": "tidelift" } ], - "time": "2021-01-27T14:41:06+00:00" + "time": "2020-12-04T08:14:16+00:00" }, { "name": "composer/semver", @@ -1629,16 +1629,16 @@ }, { "name": "laminas/laminas-mail", - "version": "2.13.0", + "version": "2.12.5", "source": { "type": "git", "url": "https://github.com/laminas/laminas-mail.git", - "reference": "a259ddb091618bdcbfb1540e0fe4671a823c342b" + "reference": "ed5b36a0deef4ffafe6138c2ae9cafcffafab856" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-mail/zipball/a259ddb091618bdcbfb1540e0fe4671a823c342b", - "reference": "a259ddb091618bdcbfb1540e0fe4671a823c342b", + "url": "https://api.github.com/repos/laminas/laminas-mail/zipball/ed5b36a0deef4ffafe6138c2ae9cafcffafab856", + "reference": "ed5b36a0deef4ffafe6138c2ae9cafcffafab856", "shasum": "" }, "require": { @@ -1648,7 +1648,7 @@ "laminas/laminas-stdlib": "^2.7 || ^3.0", "laminas/laminas-validator": "^2.10.2", "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.3 || ~8.0.0", + "php": "^7.1", "true/punycode": "^2.1" }, "replace": { @@ -1656,10 +1656,10 @@ }, "require-dev": { "laminas/laminas-coding-standard": "~1.0.0", - "laminas/laminas-config": "^3.4", + "laminas/laminas-config": "^2.6", "laminas/laminas-crypt": "^2.6 || ^3.0", "laminas/laminas-servicemanager": "^3.2.1", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^7.5.20" }, "suggest": { "laminas/laminas-crypt": "Crammd5 support in SMTP Auth", @@ -1693,7 +1693,7 @@ "type": "community_bridge" } ], - "time": "2021-01-26T13:40:34+00:00" + "time": "2020-12-31T11:41:57+00:00" }, { "name": "laminas/laminas-math", @@ -1955,16 +1955,16 @@ }, { "name": "laminas/laminas-servicemanager", - "version": "3.6.4", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "b1445e1a7077c21b0fad0974a1b7a11b9dbe0828" + "reference": "69a33802574e34357da6937602622a8a8db69883" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/b1445e1a7077c21b0fad0974a1b7a11b9dbe0828", - "reference": "b1445e1a7077c21b0fad0974a1b7a11b9dbe0828", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/69a33802574e34357da6937602622a8a8db69883", + "reference": "69a33802574e34357da6937602622a8a8db69883", "shasum": "" }, "require": { @@ -2030,7 +2030,7 @@ "type": "community_bridge" } ], - "time": "2021-02-03T08:44:41+00:00" + "time": "2021-01-17T17:08:19+00:00" }, { "name": "laminas/laminas-session", @@ -2209,16 +2209,16 @@ }, { "name": "laminas/laminas-validator", - "version": "2.14.4", + "version": "2.14.2", "source": { "type": "git", "url": "https://github.com/laminas/laminas-validator.git", - "reference": "e370c4695db1c81e6dfad38d8c4dbdb37b23d776" + "reference": "270c210c5c2b589a4ce83ad422ad8a6698451344" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/e370c4695db1c81e6dfad38d8c4dbdb37b23d776", - "reference": "e370c4695db1c81e6dfad38d8c4dbdb37b23d776", + "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/270c210c5c2b589a4ce83ad422ad8a6698451344", + "reference": "270c210c5c2b589a4ce83ad422ad8a6698451344", "shasum": "" }, "require": { @@ -2289,7 +2289,7 @@ "type": "community_bridge" } ], - "time": "2021-01-24T20:45:49+00:00" + "time": "2021-01-22T13:34:31+00:00" }, { "name": "laminas/laminas-zendframework-bridge", @@ -2433,10 +2433,10 @@ }, { "name": "magento/framework-message-queue", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/framework-message-queue/magento-framework-message-queue-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/framework-message-queue/magento-framework-message-queue-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -2460,10 +2460,10 @@ }, { "name": "magento/module-asynchronous-operations", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-asynchronous-operations/magento-module-asynchronous-operations-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-asynchronous-operations/magento-module-asynchronous-operations-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -2496,10 +2496,10 @@ }, { "name": "magento/module-authorization", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-authorization/magento-module-authorization-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-authorization/magento-module-authorization-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -2524,16 +2524,15 @@ }, { "name": "magento/module-backend", - "version": "102.0.2", + "version": "102.0.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-backend/magento-module-backend-102.0.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-backend/magento-module-backend-102.0.1.zip" }, "require": { "magento/framework": "103.0.*", "magento/module-backup": "100.4.*", "magento/module-catalog": "104.0.*", - "magento/module-cms": "104.0.*", "magento/module-config": "101.2.*", "magento/module-customer": "103.0.*", "magento/module-developer": "100.4.*", @@ -2556,8 +2555,7 @@ "type": "magento2-module", "autoload": { "files": [ - "registration.php", - "cli_commands.php" + "registration.php" ], "psr-4": { "Magento\\Backend\\": "" @@ -2572,10 +2570,10 @@ }, { "name": "magento/module-backup", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-backup/magento-module-backup-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-backup/magento-module-backup-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -2602,10 +2600,10 @@ }, { "name": "magento/module-bundle", - "version": "101.0.2", + "version": "101.0.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-bundle/magento-module-bundle-101.0.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-bundle/magento-module-bundle-101.0.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -2649,10 +2647,10 @@ }, { "name": "magento/module-captcha", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-captcha/magento-module-captcha-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-captcha/magento-module-captcha-100.4.1.zip" }, "require": { "laminas/laminas-captcha": "^2.7.1", @@ -2684,10 +2682,10 @@ }, { "name": "magento/module-catalog", - "version": "104.0.2", + "version": "104.0.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-catalog/magento-module-catalog-104.0.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-catalog/magento-module-catalog-104.0.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -2741,10 +2739,10 @@ }, { "name": "magento/module-catalog-import-export", - "version": "101.1.2", + "version": "101.1.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-catalog-import-export/magento-module-catalog-import-export-101.1.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-catalog-import-export/magento-module-catalog-import-export-101.1.1.zip" }, "require": { "ext-ctype": "*", @@ -2779,10 +2777,10 @@ }, { "name": "magento/module-catalog-inventory", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-catalog-inventory/magento-module-catalog-inventory-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-catalog-inventory/magento-module-catalog-inventory-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -2813,10 +2811,10 @@ }, { "name": "magento/module-catalog-rule", - "version": "101.2.2", + "version": "101.2.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-catalog-rule/magento-module-catalog-rule-101.2.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-catalog-rule/magento-module-catalog-rule-101.2.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -2851,10 +2849,10 @@ }, { "name": "magento/module-catalog-url-rewrite", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-catalog-url-rewrite/magento-module-catalog-url-rewrite-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-catalog-url-rewrite/magento-module-catalog-url-rewrite-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -2889,10 +2887,10 @@ }, { "name": "magento/module-checkout", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-checkout/magento-module-checkout-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-checkout/magento-module-checkout-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -2910,7 +2908,6 @@ "magento/module-quote": "101.2.*", "magento/module-sales": "103.0.*", "magento/module-sales-rule": "101.2.*", - "magento/module-security": "100.4.*", "magento/module-shipping": "100.4.*", "magento/module-store": "101.1.*", "magento/module-tax": "100.4.*", @@ -2939,10 +2936,10 @@ }, { "name": "magento/module-cms", - "version": "104.0.2", + "version": "104.0.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-cms/magento-module-cms-104.0.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-cms/magento-module-cms-104.0.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3008,10 +3005,10 @@ }, { "name": "magento/module-config", - "version": "101.2.2", + "version": "101.2.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-config/magento-module-config-101.2.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-config/magento-module-config-101.2.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3042,10 +3039,10 @@ }, { "name": "magento/module-contact", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-contact/magento-module-contact-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-contact/magento-module-contact-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3073,10 +3070,10 @@ }, { "name": "magento/module-cron", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-cron/magento-module-cron-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-cron/magento-module-cron-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3154,10 +3151,10 @@ }, { "name": "magento/module-deploy", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-deploy/magento-module-deploy-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-deploy/magento-module-deploy-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3186,10 +3183,10 @@ }, { "name": "magento/module-developer", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-developer/magento-module-developer-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-developer/magento-module-developer-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3215,10 +3212,10 @@ }, { "name": "magento/module-directory", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-directory/magento-module-directory-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-directory/magento-module-directory-100.4.1.zip" }, "require": { "lib-libxml": "*", @@ -3246,10 +3243,10 @@ }, { "name": "magento/module-downloadable", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-downloadable/magento-module-downloadable-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-downloadable/magento-module-downloadable-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3292,10 +3289,10 @@ }, { "name": "magento/module-eav", - "version": "102.1.2", + "version": "102.1.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-eav/magento-module-eav-102.1.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-eav/magento-module-eav-102.1.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3324,10 +3321,10 @@ }, { "name": "magento/module-email", - "version": "101.1.2", + "version": "101.1.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-email/magento-module-email-101.1.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-email/magento-module-email-101.1.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3363,10 +3360,10 @@ }, { "name": "magento/module-gift-message", - "version": "100.4.1", + "version": "100.4.0", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-gift-message/magento-module-gift-message-100.4.1.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-gift-message/magento-module-gift-message-100.4.0.zip" }, "require": { "magento/framework": "103.0.*", @@ -3402,10 +3399,10 @@ }, { "name": "magento/module-import-export", - "version": "101.0.2", + "version": "101.0.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-import-export/magento-module-import-export-101.0.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-import-export/magento-module-import-export-101.0.1.zip" }, "require": { "ext-ctype": "*", @@ -3464,10 +3461,10 @@ }, { "name": "magento/module-integration", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-integration/magento-module-integration-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-integration/magento-module-integration-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3498,10 +3495,10 @@ }, { "name": "magento/module-media-storage", - "version": "100.4.1", + "version": "100.4.0", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-media-storage/magento-module-media-storage-100.4.1.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-media-storage/magento-module-media-storage-100.4.0.zip" }, "require": { "magento/framework": "103.0.*", @@ -3533,10 +3530,10 @@ }, { "name": "magento/module-msrp", - "version": "100.4.1", + "version": "100.4.0", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-msrp/magento-module-msrp-100.4.1.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-msrp/magento-module-msrp-100.4.0.zip" }, "require": { "magento/framework": "103.0.*", @@ -3569,10 +3566,10 @@ }, { "name": "magento/module-newsletter", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-newsletter/magento-module-newsletter-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-newsletter/magento-module-newsletter-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3605,10 +3602,10 @@ }, { "name": "magento/module-page-cache", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-page-cache/magento-module-page-cache-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-page-cache/magento-module-page-cache-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3635,10 +3632,10 @@ }, { "name": "magento/module-payment", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-payment/magento-module-payment-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-payment/magento-module-payment-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3704,10 +3701,10 @@ }, { "name": "magento/module-quote", - "version": "101.2.2", + "version": "101.2.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-quote/magento-module-quote-101.2.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-quote/magento-module-quote-101.2.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3748,10 +3745,10 @@ }, { "name": "magento/module-reports", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-reports/magento-module-reports-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-reports/magento-module-reports-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3761,7 +3758,6 @@ "magento/module-cms": "104.0.*", "magento/module-config": "101.2.*", "magento/module-customer": "103.0.*", - "magento/module-directory": "100.4.*", "magento/module-downloadable": "100.4.*", "magento/module-eav": "102.1.*", "magento/module-quote": "101.2.*", @@ -3819,10 +3815,10 @@ }, { "name": "magento/module-review", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-review/magento-module-review-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-review/magento-module-review-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3858,10 +3854,10 @@ }, { "name": "magento/module-rss", - "version": "100.4.1", + "version": "100.4.0", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-rss/magento-module-rss-100.4.1.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-rss/magento-module-rss-100.4.0.zip" }, "require": { "magento/framework": "103.0.*", @@ -3888,10 +3884,10 @@ }, { "name": "magento/module-rule", - "version": "100.4.1", + "version": "100.4.0", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-rule/magento-module-rule-100.4.1.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-rule/magento-module-rule-100.4.0.zip" }, "require": { "lib-libxml": "*", @@ -3920,10 +3916,10 @@ }, { "name": "magento/module-sales", - "version": "103.0.2", + "version": "103.0.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-sales/magento-module-sales-103.0.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-sales/magento-module-sales-103.0.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -3974,10 +3970,10 @@ }, { "name": "magento/module-sales-rule", - "version": "101.2.2", + "version": "101.2.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-sales-rule/magento-module-sales-rule-101.2.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-sales-rule/magento-module-sales-rule-101.2.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -4050,10 +4046,10 @@ }, { "name": "magento/module-security", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-security/magento-module-security-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-security/magento-module-security-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -4083,10 +4079,10 @@ }, { "name": "magento/module-shipping", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-shipping/magento-module-shipping-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-shipping/magento-module-shipping-100.4.1.zip" }, "require": { "ext-gd": "*", @@ -4129,10 +4125,10 @@ }, { "name": "magento/module-store", - "version": "101.1.2", + "version": "101.1.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-store/magento-module-store-101.1.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-store/magento-module-store-101.1.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -4167,10 +4163,10 @@ }, { "name": "magento/module-tax", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-tax/magento-module-tax-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-tax/magento-module-tax-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -4211,10 +4207,10 @@ }, { "name": "magento/module-theme", - "version": "101.1.2", + "version": "101.1.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-theme/magento-module-theme-101.1.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-theme/magento-module-theme-101.1.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -4253,10 +4249,10 @@ }, { "name": "magento/module-translation", - "version": "100.4.2", + "version": "100.4.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-translation/magento-module-translation-100.4.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-translation/magento-module-translation-100.4.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -4287,10 +4283,10 @@ }, { "name": "magento/module-ui", - "version": "101.2.2", + "version": "101.2.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-ui/magento-module-ui-101.2.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-ui/magento-module-ui-101.2.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -4356,10 +4352,10 @@ }, { "name": "magento/module-user", - "version": "101.2.2", + "version": "101.2.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-user/magento-module-user-101.2.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-user/magento-module-user-101.2.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -4421,10 +4417,10 @@ }, { "name": "magento/module-widget", - "version": "101.2.2", + "version": "101.2.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-widget/magento-module-widget-101.2.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-widget/magento-module-widget-101.2.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -4458,10 +4454,10 @@ }, { "name": "magento/module-wishlist", - "version": "101.2.2", + "version": "101.2.1", "dist": { "type": "zip", - "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-wishlist/magento-module-wishlist-101.2.2.zip" + "url": "https://repo-magento-mirror.fooman.co.nz/dist/magento/module-wishlist/magento-module-wishlist-101.2.1.zip" }, "require": { "magento/framework": "103.0.*", @@ -5049,16 +5045,16 @@ }, { "name": "symfony/console", - "version": "v4.4.19", + "version": "v4.4.18", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "24026c44fc37099fa145707fecd43672831b837a" + "reference": "12e071278e396cc3e1c149857337e9e192deca0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/24026c44fc37099fa145707fecd43672831b837a", - "reference": "24026c44fc37099fa145707fecd43672831b837a", + "url": "https://api.github.com/repos/symfony/console/zipball/12e071278e396cc3e1c149857337e9e192deca0b", + "reference": "12e071278e396cc3e1c149857337e9e192deca0b", "shasum": "" }, "require": { @@ -5115,7 +5111,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Eases the creation of beautiful and testable command line interfaces", + "description": "Symfony Console Component", "homepage": "https://symfony.com", "funding": [ { @@ -5131,20 +5127,20 @@ "type": "tidelift" } ], - "time": "2021-01-27T09:09:26+00:00" + "time": "2020-12-18T07:41:31+00:00" }, { "name": "symfony/filesystem", - "version": "v5.2.3", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "262d033b57c73e8b59cd6e68a45c528318b15038" + "reference": "fa8f8cab6b65e2d99a118e082935344c5ba8c60d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/262d033b57c73e8b59cd6e68a45c528318b15038", - "reference": "262d033b57c73e8b59cd6e68a45c528318b15038", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/fa8f8cab6b65e2d99a118e082935344c5ba8c60d", + "reference": "fa8f8cab6b65e2d99a118e082935344c5ba8c60d", "shasum": "" }, "require": { @@ -5174,7 +5170,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides basic utilities for the filesystem", + "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", "funding": [ { @@ -5190,20 +5186,20 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:01:46+00:00" + "time": "2020-11-30T17:05:38+00:00" }, { "name": "symfony/finder", - "version": "v4.4.19", + "version": "v4.4.18", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "25d79cfccfc12e84e7a63a248c3f0720fdd92db6" + "reference": "ebd0965f2dc2d4e0f11487c16fbb041e50b5c09b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/25d79cfccfc12e84e7a63a248c3f0720fdd92db6", - "reference": "25d79cfccfc12e84e7a63a248c3f0720fdd92db6", + "url": "https://api.github.com/repos/symfony/finder/zipball/ebd0965f2dc2d4e0f11487c16fbb041e50b5c09b", + "reference": "ebd0965f2dc2d4e0f11487c16fbb041e50b5c09b", "shasum": "" }, "require": { @@ -5232,7 +5228,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Finds files and directories via an intuitive fluent interface", + "description": "Symfony Finder Component", "homepage": "https://symfony.com", "funding": [ { @@ -5248,7 +5244,7 @@ "type": "tidelift" } ], - "time": "2021-01-27T09:09:26+00:00" + "time": "2020-12-08T16:59:59+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5799,16 +5795,16 @@ }, { "name": "symfony/process", - "version": "v4.4.19", + "version": "v4.4.18", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "7e950b6366d4da90292c2e7fa820b3c1842b965a" + "reference": "075316ff72233ce3d04a9743414292e834f2cb4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/7e950b6366d4da90292c2e7fa820b3c1842b965a", - "reference": "7e950b6366d4da90292c2e7fa820b3c1842b965a", + "url": "https://api.github.com/repos/symfony/process/zipball/075316ff72233ce3d04a9743414292e834f2cb4a", + "reference": "075316ff72233ce3d04a9743414292e834f2cb4a", "shasum": "" }, "require": { @@ -5837,7 +5833,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Executes commands in sub-processes", + "description": "Symfony Process Component", "homepage": "https://symfony.com", "funding": [ { @@ -5853,7 +5849,7 @@ "type": "tidelift" } ], - "time": "2021-01-27T09:09:26+00:00" + "time": "2020-12-08T16:59:59+00:00" }, { "name": "symfony/service-contracts", @@ -6179,6 +6175,10 @@ } ], "description": "Captain Hook Plugin to run InfectionPHP only against the files of the current changeset", + "support": { + "issues": "https://github.com/bitExpert/captainhook-infection/issues", + "source": "https://github.com/bitExpert/captainhook-infection/tree/v0.3.0" + }, "time": "2021-02-05T19:09:43+00:00" }, { @@ -7588,16 +7588,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.75", + "version": "0.12.71", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "2e4738cd67e0163861a065180eff7eb5c8417d6e" + "reference": "d508fa3b0ecc5fc91ac70c6c7ac2862f968ba2b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2e4738cd67e0163861a065180eff7eb5c8417d6e", - "reference": "2e4738cd67e0163861a065180eff7eb5c8417d6e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d508fa3b0ecc5fc91ac70c6c7ac2862f968ba2b5", + "reference": "d508fa3b0ecc5fc91ac70c6c7ac2862f968ba2b5", "shasum": "" }, "require": { @@ -7640,7 +7640,58 @@ "type": "tidelift" } ], - "time": "2021-02-11T13:58:47+00:00" + "time": "2021-02-01T18:24:00+00:00" + }, + { + "name": "phpstan/phpstan-strict-rules", + "version": "0.12.9", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-strict-rules.git", + "reference": "0705fefc7c9168529fd130e341428f5f10f4f01d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/0705fefc7c9168529fd130e341428f5f10f4f01d", + "reference": "0705fefc7c9168529fd130e341428f5f10f4f01d", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "phpstan/phpstan": "^0.12.66" + }, + "require-dev": { + "phing/phing": "^2.16.3", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-phpunit": "^0.12.16", + "phpunit/phpunit": "^7.5.20" + }, + "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": "Extra strict and opinionated rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/0.12.9" + }, + "time": "2021-01-13T08:50:28+00:00" }, { "name": "phpunit/php-code-coverage", @@ -8117,12 +8168,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "5f40d4d577a71466f9723122251b46bdaf634709" + "reference": "f7d723a10c7cb36e11430182f5813ecb1b887da0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/5f40d4d577a71466f9723122251b46bdaf634709", - "reference": "5f40d4d577a71466f9723122251b46bdaf634709", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/f7d723a10c7cb36e11430182f5813ecb1b887da0", + "reference": "f7d723a10c7cb36e11430182f5813ecb1b887da0", "shasum": "" }, "conflict": { @@ -8239,7 +8290,7 @@ "october/backend": ">=1.0.319,<1.0.470", "october/cms": "= 1.0.469|>=1.0.319,<1.0.469", "october/october": ">=1.0.319,<1.0.466", - "october/rain": "<1.0.472|>=1.1,<1.1.2", + "october/rain": ">=1.0.319,<1.0.468", "onelogin/php-saml": "<2.10.4", "oneup/uploader-bundle": "<1.9.3|>=2,<2.1.5", "openid/php-openid": "<2.3", @@ -8283,7 +8334,7 @@ "sensiolabs/connect": "<4.2.3", "serluck/phpwhois": "<=4.2.6", "shopware/core": "<=6.3.4", - "shopware/platform": "<=6.3.5", + "shopware/platform": "<=6.3.4", "shopware/shopware": "<5.6.9", "silverstripe/admin": ">=1.0.3,<1.0.4|>=1.1,<1.1.1", "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", @@ -8430,7 +8481,7 @@ "type": "tidelift" } ], - "time": "2021-02-10T03:02:31+00:00" + "time": "2021-02-02T10:05:32+00:00" }, { "name": "sanmai/later", @@ -10507,5 +10558,5 @@ "php": "^7.4" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.0.0" } diff --git a/phpstan.neon b/phpstan.neon index 9e9886d..85e51b6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,13 @@ parameters: - level: 7 + level: max + fileExtensions: + - php paths: - - src + - src/BitExpert + - tests/BitExpert bootstrapFiles: - vendor/bitexpert/phpstan-magento/autoload.php - + ignoreErrors: + - + message: '~Unable to resolve the template type CallbackInput in call to method static method PHPUnit\\Framework\\Assert::callback\(\)~' + path: tests/BitExpert/Magento/PasswordNormalizer/Command/PasswordNormalizerUnitTest.php diff --git a/src/BitExpert/Magento/PasswordNormalizer/Command/PasswordNormalizer.php b/src/BitExpert/Magento/PasswordNormalizer/Command/PasswordNormalizer.php index f3c8911..16864aa 100644 --- a/src/BitExpert/Magento/PasswordNormalizer/Command/PasswordNormalizer.php +++ b/src/BitExpert/Magento/PasswordNormalizer/Command/PasswordNormalizer.php @@ -86,16 +86,16 @@ protected function configure(): void * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int|void + * @return int * @throws LocalizedException * @throws \Zend_Db_Statement_Exception */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { // check environment - $force = $input->getOption(self::OPTION_FORCE); + $force = (bool) $input->getOption(self::OPTION_FORCE); - if (!($force || State::MODE_DEVELOPER == $this->getState()->getMode())) { + if (!($force || State::MODE_DEVELOPER === $this->getState()->getMode())) { throw new LocalizedException(__('This command can only be run in developer mode!')); } @@ -107,11 +107,11 @@ protected function execute(InputInterface $input, OutputInterface $output) $mailMask = is_string($mailMask) ? $mailMask : ''; // option validation - if (empty($password)) { + if ($password === '') { throw new LocalizedException(__('--password is a required option')); } - if (!strpos($mailMask, SqlHelper::ID_PLACEHOLDER)) { + if (strpos($mailMask, SqlHelper::ID_PLACEHOLDER) === false) { throw new LocalizedException(__('--email-mask must contain %1', SqlHelper::ID_PLACEHOLDER)); } @@ -130,6 +130,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln('Updating customer grid...'); $this->updateCustomerGrid(); $output->writeln('Updating customer grid done.'); + + return 0; } /** @@ -149,6 +151,7 @@ private function updateCustomerGrid(): void */ protected function getResource(): ResourceConnection { + /** @var ResourceConnection */ return ObjectManager::getInstance()->get(ResourceConnection::class); } @@ -159,6 +162,7 @@ protected function getResource(): ResourceConnection */ protected function getEncryptor(): EncryptorInterface { + /** @var EncryptorInterface */ return ObjectManager::getInstance()->get(EncryptorInterface::class); } @@ -169,6 +173,7 @@ protected function getEncryptor(): EncryptorInterface */ protected function getState(): State { + /** @var State */ return ObjectManager::getInstance()->get(State::class); } @@ -179,6 +184,7 @@ protected function getState(): State */ protected function getIndexer(): Indexer { + /** @var Indexer */ return ObjectManager::getInstance()->get(Indexer::class); } } diff --git a/src/BitExpert/Magento/PasswordNormalizer/Command/SqlHelper.php b/src/BitExpert/Magento/PasswordNormalizer/Command/SqlHelper.php index 79f5b39..f8d9e16 100644 --- a/src/BitExpert/Magento/PasswordNormalizer/Command/SqlHelper.php +++ b/src/BitExpert/Magento/PasswordNormalizer/Command/SqlHelper.php @@ -47,9 +47,9 @@ public function buildSql(string $mailMask, string $passwordHash): string * @param string $excludedEmails * @return string */ - public function appendSqlWhereClause(string $sql, string $excludedEmails = null): string + public function appendSqlWhereClause(string $sql, string $excludedEmails = ''): string { - if (isset($excludedEmails) && !empty($excludedEmails)) { + if ($excludedEmails !== '') { $excludedEmailsArr = explode(';', $excludedEmails); $concated = implode("' AND email NOT LIKE '", $excludedEmailsArr); $sql = sprintf( diff --git a/tests/BitExpert/Magento/PasswordNormalizer/Command/PasswordNormalizerUnitTest.php b/tests/BitExpert/Magento/PasswordNormalizer/Command/PasswordNormalizerUnitTest.php index 331ce2c..08d7b6a 100644 --- a/tests/BitExpert/Magento/PasswordNormalizer/Command/PasswordNormalizerUnitTest.php +++ b/tests/BitExpert/Magento/PasswordNormalizer/Command/PasswordNormalizerUnitTest.php @@ -19,6 +19,8 @@ use Magento\Framework\Exception\LocalizedException; use Magento\Indexer\Model\Indexer; use N98\Magento\Application; +use PHPUnit\Framework\Constraint\Callback; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -27,11 +29,11 @@ class PasswordNormalizerUnitTest extends TestCase { /** - * @var InputInterface + * @var MockObject&InputInterface */ private $input; /** - * @var OutputInterface + * @var MockObject&OutputInterface */ private $output; /** @@ -39,27 +41,27 @@ class PasswordNormalizerUnitTest extends TestCase */ private $application; /** - * @var ResourceConnection + * @var MockObject&ResourceConnection */ private $resourceConnection; /** - * @var EncryptorInterface + * @var MockObject&EncryptorInterface */ private $encryptor; /** - * @var Zend_Db_Statement_Interface + * @var MockObject&Zend_Db_Statement_Interface */ private $statement; /** - * @var AdapterInterface + * @var MockObject&AdapterInterface */ private $connection; /** - * @var State + * @var MockObject&State */ private $state; /** - * @var Indexer + * @var MockObject&Indexer */ private $indexer; @@ -78,7 +80,7 @@ public function setUp(): void $this->application = new Application(); $this->application->init([], $this->input, $this->output); $this->resourceConnection = $this->createMock(ResourceConnection::class); - $this->resourceConnection->expects($this->any()) + $this->resourceConnection->expects(self::any()) ->method('getConnection') ->willReturn($this->connection); $this->encryptor = $this->createMock(EncryptorInterface::class); @@ -92,20 +94,20 @@ public function checkCommandConfiguration(): void { $command = $this->getPasswordNormalizerMock(); $options = $command->getDefinition()->getOptions(); - $this->assertSame('dev:customer:normalize-passwords', $command->getName()); - $this->assertSame('Normalizes all customer-email-addresses and passwords', $command->getDescription()); - $this->assertCount(4, $options); + self::assertSame('dev:customer:normalize-passwords', $command->getName()); + self::assertSame('Normalizes all customer-email-addresses and passwords', $command->getDescription()); + self::assertCount(4, $options); } /** * @test */ - public function commandCannotBeRunInProductionMode() + public function commandCannotBeRunInProductionMode(): void { - self::expectException(LocalizedException::class); - self::expectExceptionMessage('This command can only be run in developer mode!'); + $this->expectException(LocalizedException::class); + $this->expectExceptionMessage('This command can only be run in developer mode!'); - $this->state->expects($this->any()) + $this->state->expects(self::any()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_PRODUCTION); @@ -118,12 +120,12 @@ public function commandCannotBeRunInProductionMode() /** * @test */ - public function commandCannotBeRunInDefaultMode() + public function commandCannotBeRunInDefaultMode(): void { - self::expectException(LocalizedException::class); - self::expectExceptionMessage('This command can only be run in developer mode!'); + $this->expectException(LocalizedException::class); + $this->expectExceptionMessage('This command can only be run in developer mode!'); - $this->state->expects($this->any()) + $this->state->expects(self::any()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_DEFAULT); @@ -136,12 +138,12 @@ public function commandCannotBeRunInDefaultMode() /** * @test */ - public function missingPasswordParameterThrowsException() + public function missingPasswordParameterThrowsException(): void { - self::expectException(LocalizedException::class); - self::expectExceptionMessage('--password is a required option'); + $this->expectException(LocalizedException::class); + $this->expectExceptionMessage('--password is a required option'); - $this->state->expects($this->any()) + $this->state->expects(self::any()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_DEVELOPER); @@ -154,12 +156,12 @@ public function missingPasswordParameterThrowsException() /** * @test */ - public function emailMaskMissingPlaceholderThrowsException() + public function emailMaskMissingPlaceholderThrowsException(): void { - self::expectException(LocalizedException::class); - self::expectExceptionMessage('--email-mask must contain (ID)'); + $this->expectException(LocalizedException::class); + $this->expectExceptionMessage('--email-mask must contain (ID)'); - $this->input->expects($this->any()) + $this->input->expects(self::any()) ->method('getOption') ->willReturnMap([ [PasswordNormalizer::OPTION_PASSWORD, 'random-password-to-set'], @@ -167,7 +169,7 @@ public function emailMaskMissingPlaceholderThrowsException() [PasswordNormalizer::OPTION_EXCLUDE_EMAILS, ''], ]); - $this->state->expects($this->any()) + $this->state->expects(self::any()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_DEVELOPER); @@ -181,9 +183,9 @@ public function emailMaskMissingPlaceholderThrowsException() /** * @test */ - public function passingRequiredPasswordParameterSucceeds() + public function passingRequiredPasswordParameterSucceeds(): void { - $this->input->expects($this->any()) + $this->input->expects(self::any()) ->method('getOption') ->willReturnMap([ [PasswordNormalizer::OPTION_PASSWORD, 'random-password-to-set'], @@ -191,24 +193,24 @@ public function passingRequiredPasswordParameterSucceeds() [PasswordNormalizer::OPTION_EXCLUDE_EMAILS, ''], ]); - $this->state->expects($this->any()) + $this->state->expects(self::any()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_DEVELOPER); - $this->connection->expects($this->any()) + $this->connection->expects(self::any()) ->method('query') ->willReturn($this->statement); - $this->encryptor->expects($this->any()) + $this->encryptor->expects(self::any()) ->method('getHash') ->willReturn('abcdef'); // when everything is working fine, writeln() will be the last operation of the command. Thus, if the method // is called we can assume that the execution went well. - $this->output->expects($this->exactly(3)) + $this->output->expects(self::exactly(3)) ->method('writeln'); - $this->indexer->expects($this->once()) + $this->indexer->expects(self::once()) ->method('reindexAll'); /** @var PasswordNormalizer $command */ @@ -220,9 +222,9 @@ public function passingRequiredPasswordParameterSucceeds() /** * @test */ - public function withAllRequiredOptionsProvidedTheSqlUpdateIsIssued() + public function withAllRequiredOptionsProvidedTheSqlUpdateIsIssued(): void { - $this->input->expects($this->any()) + $this->input->expects(self::any()) ->method('getOption') ->willReturnMap([ [PasswordNormalizer::OPTION_PASSWORD, 'random-password-to-set'], @@ -230,22 +232,22 @@ public function withAllRequiredOptionsProvidedTheSqlUpdateIsIssued() [PasswordNormalizer::OPTION_EXCLUDE_EMAILS, ''], ]); - $this->state->expects($this->any()) + $this->state->expects(self::any()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_DEVELOPER); - $this->encryptor->expects($this->once()) + $this->encryptor->expects(self::once()) ->method('getHash') ->with( - $this->equalTo('random-password-to-set'), - $this->equalTo(true) + self::equalTo('random-password-to-set'), + self::equalTo(true) ) ->willReturn('encrypted-random-password'); - $this->connection->expects($this->once()) + $this->connection->expects(self::once()) ->method('query') ->with( - $this->callback(function ($sql) { + self::callback(function ($sql): bool { return strpos($sql, 'encrypted-random-password') > 0; }) ) @@ -260,11 +262,11 @@ public function withAllRequiredOptionsProvidedTheSqlUpdateIsIssued() /** * @test */ - public function passingEmailMaskWithoutPlaceholderThrowsException() + public function passingEmailMaskWithoutPlaceholderThrowsException(): void { - self::expectException(LocalizedException::class); + $this->expectException(LocalizedException::class); - $this->input->expects($this->any()) + $this->input->expects(self::any()) ->method('getOption') ->willReturnMap([ [PasswordNormalizer::OPTION_PASSWORD, ''], @@ -272,7 +274,7 @@ public function passingEmailMaskWithoutPlaceholderThrowsException() [PasswordNormalizer::OPTION_EXCLUDE_EMAILS, ''], ]); - $this->state->expects($this->any()) + $this->state->expects(self::any()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_DEVELOPER); @@ -285,9 +287,9 @@ public function passingEmailMaskWithoutPlaceholderThrowsException() /** * @test */ - public function withAllRequiredOptionsAndEmailMaskProvidedTheSqlUpdateIsIssued() + public function withAllRequiredOptionsAndEmailMaskProvidedTheSqlUpdateIsIssued(): void { - $this->input->expects($this->any()) + $this->input->expects(self::any()) ->method('getOption') ->willReturnMap([ [PasswordNormalizer::OPTION_PASSWORD, 'random-password-to-set'], @@ -295,34 +297,34 @@ public function withAllRequiredOptionsAndEmailMaskProvidedTheSqlUpdateIsIssued() [PasswordNormalizer::OPTION_EXCLUDE_EMAILS, 'bitexpert.de'], ]); - $this->state->expects($this->any()) + $this->state->expects(self::any()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_DEVELOPER); - $this->encryptor->expects($this->once()) + $this->encryptor->expects(self::once()) ->method('getHash') ->with( - $this->equalTo('random-password-to-set'), - $this->equalTo(true) + self::equalTo('random-password-to-set'), + self::equalTo(true) ) ->willReturn('encrypted-random-password'); - $this->connection->expects($this->once()) + $this->connection->expects(self::once()) ->method('query') ->with( - $this->callback(function ($sql) { + self::callback(function ($sql): bool { return strpos($sql, 'encrypted-random-password') > 0 && strpos($sql, 'bitexpert.de') > 0; }) ) ->willReturn($this->statement); - $this->indexer->expects($this->once()) + $this->indexer->expects(self::once()) ->method('load') ->with( - $this->equalTo(Customer::CUSTOMER_GRID_INDEXER_ID) + self::equalTo(Customer::CUSTOMER_GRID_INDEXER_ID) ); - $this->indexer->expects($this->once()) + $this->indexer->expects(self::once()) ->method('reindexAll'); /** @var PasswordNormalizer $command */ @@ -334,9 +336,9 @@ public function withAllRequiredOptionsAndEmailMaskProvidedTheSqlUpdateIsIssued() /** * @test */ - public function passingForceParameterBypassModeCheck() + public function passingForceParameterBypassModeCheck(): void { - $this->input->expects($this->any()) + $this->input->expects(self::any()) ->method('getOption') ->willReturnMap([ [PasswordNormalizer::OPTION_PASSWORD, 'random-password-to-set'], @@ -345,28 +347,28 @@ public function passingForceParameterBypassModeCheck() [PasswordNormalizer::OPTION_FORCE, true] ]); - $this->state->expects($this->any()) + $this->state->expects(self::any()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_DEVELOPER); - $this->state->expects($this->never()) + $this->state->expects(self::never()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_PRODUCTION); - $this->connection->expects($this->any()) + $this->connection->expects(self::any()) ->method('query') ->willReturn($this->statement); - $this->encryptor->expects($this->any()) + $this->encryptor->expects(self::any()) ->method('getHash') ->willReturn('abcdef'); // when everything is working fine, writeln() will be the last operation of the command. Thus, if the method // is called we can assume that the execution went well. - $this->output->expects($this->exactly(3)) + $this->output->expects(self::exactly(3)) ->method('writeln'); - $this->indexer->expects($this->once())->method('reindexAll'); + $this->indexer->expects(self::once())->method('reindexAll'); /** @var PasswordNormalizer $command */ $command = $this->getPasswordNormalizerMock(); @@ -377,17 +379,17 @@ public function passingForceParameterBypassModeCheck() /** * @test */ - public function missingForceParameterBypassModeCheck() + public function missingForceParameterBypassModeCheck(): void { - self::expectException(LocalizedException::class); + $this->expectException(LocalizedException::class); - $this->input->expects($this->any()) + $this->input->expects(self::any()) ->method('getOption') ->willReturnMap([ [PasswordNormalizer::OPTION_FORCE, false] ]); - $this->state->expects($this->any()) + $this->state->expects(self::any()) ->method('getMode') ->willReturn(\Magento\Framework\App\State::MODE_PRODUCTION); @@ -401,7 +403,7 @@ public function missingForceParameterBypassModeCheck() * Helper method to configure a mocked version of * {@link \BitExpert\Magento\PasswordNormalizer\Command\PasswordNormalizer}. * - * @return PasswordNormalizer|\PHPUnit\Framework\MockObject\MockObject + * @return MockObject&PasswordNormalizer */ protected function getPasswordNormalizerMock() { diff --git a/tests/BitExpert/Magento/PasswordNormalizer/Command/SqlHelperUnitTest.php b/tests/BitExpert/Magento/PasswordNormalizer/Command/SqlHelperUnitTest.php index f381736..65be265 100644 --- a/tests/BitExpert/Magento/PasswordNormalizer/Command/SqlHelperUnitTest.php +++ b/tests/BitExpert/Magento/PasswordNormalizer/Command/SqlHelperUnitTest.php @@ -44,7 +44,7 @@ public function setUp(): void /** * @test */ - public function buildSqlWithMailMaskAndPasswordHash() + public function buildSqlWithMailMaskAndPasswordHash(): void { $mailMask = 'c_' . SqlHelper::ID_PLACEHOLDER . '@example.com'; $passwordHash = '12345'; @@ -58,19 +58,7 @@ public function buildSqlWithMailMaskAndPasswordHash() /** * @test */ - public function appendSqlWhereClauseWithNoExclusions() - { - $expected = 'SELECT * FROM my_awesome_table'; - - $actual = $this->sqlHelper->appendSqlWhereClause($expected, null); - - self::assertEquals($expected, $actual); - } - - /** - * @test - */ - public function appendSqlWhereClauseWithEmptyString() + public function appendSqlWhereClauseWithEmptyString(): void { $expected = 'SELECT * FROM my_awesome_table'; @@ -82,7 +70,7 @@ public function appendSqlWhereClauseWithEmptyString() /** * @test */ - public function appendSqlWhereClauseWithOneEmail() + public function appendSqlWhereClauseWithOneEmail(): void { $exampleSql = 'SELECT * FROM my_awesome_table'; $mails = 'foo@example.com'; @@ -96,7 +84,7 @@ public function appendSqlWhereClauseWithOneEmail() /** * @test */ - public function appendSqlWhereClauseWithTwoEmail() + public function appendSqlWhereClauseWithTwoEmail(): void { $exampleSql = 'SELECT * FROM my_awesome_table'; $mails = 'foo@example.com;bar@example.com';