From 274cebce833588acbcd54df7ec8412eaaa7ba03e Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Fri, 27 May 2022 17:59:55 +0900 Subject: [PATCH] Bump version to PHPStan 1.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PHPStan のエラー修正 --- composer.json | 2 +- composer.lock | 21 ++++++++------------ phpstan.neon.dist | 4 ---- src/Eccube/Entity/Product.php | 2 +- src/Eccube/Form/Type/Admin/OrderItemType.php | 2 +- src/Eccube/Service/EntityProxyService.php | 2 +- src/Eccube/Service/MailService.php | 2 +- 7 files changed, 13 insertions(+), 22 deletions(-) diff --git a/composer.json b/composer.json index d8b0266a25e..0471325f240 100644 --- a/composer.json +++ b/composer.json @@ -108,7 +108,7 @@ "dama/doctrine-test-bundle": "^6.6", "fakerphp/faker": "^1.16", "mikey179/vfsstream": "^1.6", - "phpstan/phpstan": "^0.12", + "phpstan/phpstan": "^1.7", "symfony/browser-kit": "^5.4", "symfony/phpunit-bridge": "^5.4" }, diff --git a/composer.lock b/composer.lock index 8911d243736..32b30615718 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": "a2e906c3604f34dd1d254da67c0d00cd", + "content-hash": "00ba2149f4afb427ed9129a766b56cfe", "packages": [ { "name": "composer/ca-bundle", @@ -11820,20 +11820,20 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.99", + "version": "1.7.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7" + "reference": "c602f80d66ba425943b0f4aaa27010c822dd8f87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b4d40f1d759942f523be267a1bab6884f46ca3f7", - "reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c602f80d66ba425943b0f4aaa27010c822dd8f87", + "reference": "c602f80d66ba425943b0f4aaa27010c822dd8f87", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.2|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -11843,11 +11843,6 @@ "phpstan.phar" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.12-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -11860,7 +11855,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.99" + "source": "https://github.com/phpstan/phpstan/tree/1.7.2" }, "funding": [ { @@ -11880,7 +11875,7 @@ "type": "tidelift" } ], - "time": "2021-09-12T20:09:55+00:00" + "time": "2022-05-26T12:59:20+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 8b9b71bfd1d..213da6dad2a 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,6 +1,2 @@ parameters: level: 1 - ignoreErrors: - - - message: "#^Function twig_localized_date_filter not found\\.$#" - path: src/Eccube/Twig/Extension/IntlExtension.php diff --git a/src/Eccube/Entity/Product.php b/src/Eccube/Entity/Product.php index 88a7c09020d..8321d776600 100644 --- a/src/Eccube/Entity/Product.php +++ b/src/Eccube/Entity/Product.php @@ -417,7 +417,7 @@ public function getMainListImage() { $ProductImages = $this->getProductImage(); - return empty($ProductImages) ? null : $ProductImages[0]; + return $ProductImages->isEmpty() ? null : $ProductImages[0]; } public function getMainFileName() diff --git a/src/Eccube/Form/Type/Admin/OrderItemType.php b/src/Eccube/Form/Type/Admin/OrderItemType.php index 63f7ad13f19..d3cf5393a03 100644 --- a/src/Eccube/Form/Type/Admin/OrderItemType.php +++ b/src/Eccube/Form/Type/Admin/OrderItemType.php @@ -310,7 +310,7 @@ public function getBlockPrefix() */ protected function addErrorsIfExists(FormInterface $form, ConstraintViolationListInterface $errors) { - if (empty($errors)) { + if (count($errors) < 1) { return; } diff --git a/src/Eccube/Service/EntityProxyService.php b/src/Eccube/Service/EntityProxyService.php index f3dfc18707e..03f336c21b1 100644 --- a/src/Eccube/Service/EntityProxyService.php +++ b/src/Eccube/Service/EntityProxyService.php @@ -134,7 +134,7 @@ private function originalEntityPath(string $entityClassName): string return $originalPath; } - $rc = new ClassReflection($entityClassName); + $rc = new \ReflectionClass($entityClassName); return str_replace('\\', '/', $rc->getFileName()); } diff --git a/src/Eccube/Service/MailService.php b/src/Eccube/Service/MailService.php index 6b2a51d05b1..3af514e2b0c 100644 --- a/src/Eccube/Service/MailService.php +++ b/src/Eccube/Service/MailService.php @@ -389,7 +389,7 @@ public function sendOrderMail(Order $Order) // HTML用メールの設定 $htmlBody = $message->getHtmlBody(); - if (!empty($multipart)) { + if (!empty($htmlBody)) { $MailHistory->setMailHtmlBody($htmlBody); }