From e2311b17e5baf87c0cd9bdaddfa76f3a9636b6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Magrez?= Date: Fri, 30 Sep 2022 18:01:24 +0200 Subject: [PATCH] Fixes after testing the quality module implementation --- .phpqa.yml | 5 ----- .travis.yml | 21 ------------------- CHANGELOG.md | 7 +++++++ Helper/Product.php | 2 +- .../CustomEntityProductLinkManagement.php | 11 +++++++++- composer.json | 6 ++---- phpcs.xml | 9 -------- phpcs.xml.dist | 1 + phpmd.xml | 13 ------------ phpstan.neon.dist | 6 ++++++ 10 files changed, 27 insertions(+), 54 deletions(-) delete mode 100644 .phpqa.yml delete mode 100644 .travis.yml delete mode 100644 phpcs.xml delete mode 100644 phpmd.xml diff --git a/.phpqa.yml b/.phpqa.yml deleted file mode 100644 index ca49b2f..0000000 --- a/.phpqa.yml +++ /dev/null @@ -1,5 +0,0 @@ -phpcs: - standard: phpcs.xml - ignoreWarnings: true -phpmd: - standard: phpmd.xml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 08204dc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: php -php: - - '7.1' - - '7.2' - -before_install: - - mkdir -p app/etc var - - echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGENTO_USERNAME}\",\"password\":\"${MAGENTO_PASSWORD}\"}}}" > auth.json - - if [ -n "$GITHUB_TOKEN" ]; then composer config github-oauth.github.com ${GITHUB_TOKEN}; fi; - -install: - - composer install --prefer-dist - -cache: - directories: - - vendor - - $HOME/.composer/cache - -script: - - ./vendor/bin/phpcs --config-set installed_paths vendor/magento/marketplace-eqp/,vendor/smile/magento2-smilelab-phpcs/phpcs-standards/ - - ./vendor/bin/phpqa --ignoredDirs vendor,build --output cli --ansi --tools phpcs:0,phpmd:0,phpcpd:0,parallel-lint:0,phpmetrics,phploc,pdepend diff --git a/CHANGELOG.md b/CHANGELOG.md index 7533e1b..fc1db15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. +## [1.3.6] - 2022-10-19 +[1.3.6]: https://github.com/Smile-SA/magento2-module-custom-entity-product-link/compare/1.3.5...1.3.6 + +- Add Smile Lab Quality Suite +- Analyse code style with phpcs / phpmd / phpstan command +- Add db_schema.xml instead InstallSchema + ## [1.3.5] - 2022-09-20 [1.3.5]: https://github.com/Smile-SA/magento2-module-custom-entity-product-link/compare/1.3.4...1.3.5 diff --git a/Helper/Product.php b/Helper/Product.php index f030041..3f223ec 100644 --- a/Helper/Product.php +++ b/Helper/Product.php @@ -46,10 +46,10 @@ public function __construct( public function getCustomEntities(ProductInterface $product, string $attributeCode): array { $result = []; - // @phpstan-ignore-next-line $customEntities = $product->getExtensionAttributes()->getCustomEntities(); if ($customEntities) { foreach ($customEntities as $customEntity) { + // @phpstan-ignore-next-line if ($customEntity->getProductAttributeCode() !== $attributeCode || !$customEntity->getIsActive()) { continue; } diff --git a/Model/ResourceModel/CustomEntityProductLinkManagement.php b/Model/ResourceModel/CustomEntityProductLinkManagement.php index 66c41e0..fcbcf43 100644 --- a/Model/ResourceModel/CustomEntityProductLinkManagement.php +++ b/Model/ResourceModel/CustomEntityProductLinkManagement.php @@ -9,7 +9,7 @@ /** * Custom entity product link management resource model. */ -abstract class CustomEntityProductLinkManagement extends AbstractDb +class CustomEntityProductLinkManagement extends AbstractDb { public const RELATION_TABLE_NAME = 'catalog_product_custom_entity_link'; @@ -77,4 +77,13 @@ public function saveLinks($productId, $attributeId, array $entityIds): CustomEnt return $this; } + + /** + * @inheritDoc + */ + // @codingStandardsIgnoreLine + protected function _construct() + { + // TODO: Implement _construct() method. + } } diff --git a/composer.json b/composer.json index c7edd67..d834aae 100644 --- a/composer.json +++ b/composer.json @@ -11,13 +11,11 @@ ], "require": { "php": "^7.4 || ^8.1", - "smile/module-custom-entity": "~1.3.0", + "smile/module-custom-entity": "^1.3", "smile/elasticsuite": "^2.8.0" }, "require-dev": { - "smile/magento2-smilelab-quality-suite": "^1.0.5", - "edgedesign/phpqa": "^1.18", - "jakub-onderka/php-parallel-lint": "^0.9.2" + "smile/magento2-smilelab-quality-suite": "^3.0" }, "license": "OSL-3.0", "authors": [ diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 5a4f32b..0000000 --- a/phpcs.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - Merge SmileLab and MEQP2 coding standard - - - - - - diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 7fb5aea..8501211 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -16,5 +16,6 @@ + . vendor/* diff --git a/phpmd.xml b/phpmd.xml deleted file mode 100644 index 384507f..0000000 --- a/phpmd.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 6af565e..b5efc46 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,8 +2,14 @@ parameters: level: 6 phpVersion: 70400 checkMissingIterableValueType: false + paths: + - . excludePaths: - 'vendor/*' + ignoreErrors: + - + message: '#Constant BP not found#' + path: registration.php includes: - %currentWorkingDirectory%/vendor/smile/magento2-smilelab-phpstan/extension.neon