From 91110bf087be7d8b9fa9e264ca46855886035d4e Mon Sep 17 00:00:00 2001
From: dylanteugels <162726340+dylanteugels@users.noreply.github.com>
Date: Fri, 24 May 2024 15:37:21 +0200
Subject: [PATCH 01/10] ODOS-604 return type of command's execute method should
be INT
---
Console/Command/Export.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Console/Command/Export.php b/Console/Command/Export.php
index 70e679b..2ed1e03 100644
--- a/Console/Command/Export.php
+++ b/Console/Command/Export.php
@@ -42,7 +42,7 @@ protected function configure(): void
* @param InputInterface $input
* @param OutputInterface $output
*/
- protected function execute(InputInterface $input, OutputInterface $output): void
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
try {
$locales = $input->getArgument(self::ARGUMENT_LOCALES);
@@ -62,5 +62,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
}
+
+ return 0;
}
}
From ad27f2730b390eb88f4c5bc64e5ca4adacf2a469 Mon Sep 17 00:00:00 2001
From: dylanteugels <162726340+dylanteugels@users.noreply.github.com>
Date: Fri, 24 May 2024 15:37:41 +0200
Subject: [PATCH 02/10] ODOS-604 return type of command's execute method should
be INT
---
Console/Command/GenerateFrontendTranslations.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Console/Command/GenerateFrontendTranslations.php b/Console/Command/GenerateFrontendTranslations.php
index f004bbc..dac135d 100644
--- a/Console/Command/GenerateFrontendTranslations.php
+++ b/Console/Command/GenerateFrontendTranslations.php
@@ -42,7 +42,7 @@ protected function configure(): void
* @param InputInterface $input
* @param OutputInterface $output
*/
- protected function execute(InputInterface $input, OutputInterface $output): void
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
try {
$storeId = (int)$input->getArgument('storeId');
@@ -63,6 +63,8 @@ protected function execute(InputInterface $input, OutputInterface $output): void
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
}
+
+ return 0;
}
/**
From 0b10bee836c295f416883c9ba87d4dc3d2030bcf Mon Sep 17 00:00:00 2001
From: dylanteugels <162726340+dylanteugels@users.noreply.github.com>
Date: Fri, 24 May 2024 15:38:02 +0200
Subject: [PATCH 03/10] ODOS-604 return type of command's execute method should
be INT
---
Console/Command/Import.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Console/Command/Import.php b/Console/Command/Import.php
index 7565758..cb97b60 100644
--- a/Console/Command/Import.php
+++ b/Console/Command/Import.php
@@ -55,7 +55,7 @@ protected function configure(): void
* @param InputInterface $input
* @param OutputInterface $output
*/
- protected function execute(InputInterface $input, OutputInterface $output): void
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
try {
$csvFile = $input->getArgument(self::ARGUMENT_CSV_FILE);
@@ -85,5 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
}
+
+ return 0;
}
}
From 5d69fa779147db349b311a857d42ef3d79b21ea9 Mon Sep 17 00:00:00 2001
From: dylanteugels <162726340+dylanteugels@users.noreply.github.com>
Date: Fri, 24 May 2024 15:38:17 +0200
Subject: [PATCH 04/10] ODOS-604 return type of command's execute method should
be INT
---
Console/Command/ImportFull.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Console/Command/ImportFull.php b/Console/Command/ImportFull.php
index 525c913..0b2d5a8 100644
--- a/Console/Command/ImportFull.php
+++ b/Console/Command/ImportFull.php
@@ -53,7 +53,7 @@ protected function configure(): void
* @param InputInterface $input
* @param OutputInterface $output
*/
- protected function execute(InputInterface $input, OutputInterface $output): void
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
try {
$csvFile = $input->getArgument(self::ARGUMENT_CSV_FILE);
@@ -81,5 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
}
+
+ return 0;
}
}
From f89acd64cf82c0abb194da956c7cb0188b7e9e34 Mon Sep 17 00:00:00 2001
From: dylanteugels <162726340+dylanteugels@users.noreply.github.com>
Date: Fri, 24 May 2024 15:38:36 +0200
Subject: [PATCH 05/10] ODOS-604 return type of command's execute method should
be INT
---
Console/Command/PrepareKeysCommand.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Console/Command/PrepareKeysCommand.php b/Console/Command/PrepareKeysCommand.php
index e0bbbda..5ba2213 100644
--- a/Console/Command/PrepareKeysCommand.php
+++ b/Console/Command/PrepareKeysCommand.php
@@ -62,9 +62,9 @@ protected function configure()
* @param InputInterface $input
* @param OutputInterface $output
*
- * @return void
+ * @return int
*/
- protected function execute(InputInterface $input, OutputInterface $output): void
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$phraseCollector = new PhraseCollector(new Tokenizer());
$adapters = [
@@ -85,5 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void
}
$output->writeln('Keys successfully created.');
+
+ return 0;
}
}
From e9bf05b289f885bc05b407093dd5d146dce18b48 Mon Sep 17 00:00:00 2001
From: dylanteugels <162726340+dylanteugels@users.noreply.github.com>
Date: Fri, 24 May 2024 15:40:21 +0200
Subject: [PATCH 06/10] ODOS-604 made module magento 2.4.7 compatible
---
composer.json | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/composer.json b/composer.json
index a607f2e..7a68e4c 100644
--- a/composer.json
+++ b/composer.json
@@ -11,10 +11,10 @@
}
],
"require": {
- "php": "~7.4.0||^8.1",
- "magento/framework": "^102.0|^103.0",
- "magento/module-backend": "^101.0|^102.0",
- "magento/module-ui": "^101.0|^102.0"
+ "php": "^8.2",
+ "magento/framework": "^103.0",
+ "magento/module-backend": "^102.0",
+ "magento/module-ui": "^102.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~3.4.0",
From 1731476352a41abf25dd6de150e337f77754e85d Mon Sep 17 00:00:00 2001
From: dylanteugels <162726340+dylanteugels@users.noreply.github.com>
Date: Fri, 24 May 2024 15:47:01 +0200
Subject: [PATCH 07/10] ODOS-604 revert composer.json changes
---
composer.json | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/composer.json b/composer.json
index 7a68e4c..98bf304 100644
--- a/composer.json
+++ b/composer.json
@@ -11,10 +11,10 @@
}
],
"require": {
- "php": "^8.2",
- "magento/framework": "^103.0",
- "magento/module-backend": "^102.0",
- "magento/module-ui": "^102.0"
+ "php": "^8.1",
+ "magento/framework": "^102.0|^103.0",
+ "magento/module-backend": "^101.0|^102.0",
+ "magento/module-ui": "^101.0|^102.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~3.4.0",
From 12316e5738f6109fe78376b6ab6f60114b544f4c Mon Sep 17 00:00:00 2001
From: Siebe De Celle
Date: Wed, 5 Jun 2024 14:34:22 +0200
Subject: [PATCH 08/10] PHPRO-415 Exit code and locale fixes
---
CHANGELOG.md | 7 ++-
Console/Command/Export.php | 5 +-
.../Command/GenerateFrontendTranslations.php | 5 +-
Console/Command/Import.php | 5 +-
Console/Command/ImportFull.php | 5 +-
Console/Command/PrepareKeysCommand.php | 46 +++++++++++--------
Model/Translation/Source/Locales.php | 33 +++++--------
7 files changed, 61 insertions(+), 45 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a6f2764..3588d25 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,4 +28,9 @@
-
## [1.3.0] - 2024-03-28
### Updated
-- PHP ^8.1 compatibility
\ No newline at end of file
+- PHP ^8.1 compatibility
+
+## [1.4.0] - 2024-06-05
+### Bugfix
+- Fix return types console commands
+- Locales are not found if set in env.php and not in core_config_table
\ No newline at end of file
diff --git a/Console/Command/Export.php b/Console/Command/Export.php
index 2ed1e03..2c951ed 100644
--- a/Console/Command/Export.php
+++ b/Console/Command/Export.php
@@ -44,6 +44,8 @@ protected function configure(): void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
+ $exitCode = 0;
+
try {
$locales = $input->getArgument(self::ARGUMENT_LOCALES);
@@ -61,8 +63,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Done!');
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
+ $exitCode = 1;
}
- return 0;
+ return $exitCode;
}
}
diff --git a/Console/Command/GenerateFrontendTranslations.php b/Console/Command/GenerateFrontendTranslations.php
index dac135d..d48a527 100644
--- a/Console/Command/GenerateFrontendTranslations.php
+++ b/Console/Command/GenerateFrontendTranslations.php
@@ -44,6 +44,8 @@ protected function configure(): void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
+ $exitCode = 0;
+
try {
$storeId = (int)$input->getArgument('storeId');
$statsCollection = $this->generatedTranslations($storeId);
@@ -62,9 +64,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Please clean full_page and block_html caches manually');
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
+ $exitCode = 1;
}
- return 0;
+ return $exitCode;
}
/**
diff --git a/Console/Command/Import.php b/Console/Command/Import.php
index cb97b60..c4dec1c 100644
--- a/Console/Command/Import.php
+++ b/Console/Command/Import.php
@@ -57,6 +57,8 @@ protected function configure(): void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
+ $exitCode = 0;
+
try {
$csvFile = $input->getArgument(self::ARGUMENT_CSV_FILE);
$locale = $input->getArgument(self::ARGUMENT_LOCALE);
@@ -84,8 +86,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Done!');
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
+ $exitCode = 1;
}
- return 0;
+ return $exitCode;
}
}
diff --git a/Console/Command/ImportFull.php b/Console/Command/ImportFull.php
index 0b2d5a8..56e5ff0 100644
--- a/Console/Command/ImportFull.php
+++ b/Console/Command/ImportFull.php
@@ -55,6 +55,8 @@ protected function configure(): void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
+ $exitCode = 0;
+
try {
$csvFile = $input->getArgument(self::ARGUMENT_CSV_FILE);
@@ -80,8 +82,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Done!');
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
+ $exitCode = 1;
}
- return 0;
+ return $exitCode;
}
}
diff --git a/Console/Command/PrepareKeysCommand.php b/Console/Command/PrepareKeysCommand.php
index 5ba2213..8871201 100644
--- a/Console/Command/PrepareKeysCommand.php
+++ b/Console/Command/PrepareKeysCommand.php
@@ -37,6 +37,7 @@ public function __construct(
ResolverFactory $optionResolverFactory,
Parser $parser,
TranslationDataManagementInterface $translationDataManagement,
+ private readonly \Phpro\Translations\Model\Translation\Source\Locales $localeSource,
string $name = null
) {
$this->optionResolverFactory = $optionResolverFactory;
@@ -62,30 +63,37 @@ protected function configure()
* @param InputInterface $input
* @param OutputInterface $output
*
- * @return int
+ * @return void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
- $phraseCollector = new PhraseCollector(new Tokenizer());
- $adapters = [
- 'php' => new Php($phraseCollector),
- 'html' => new Html(),
- 'js' => new Js(),
- 'xml' => new Xml(),
- ];
- $optionResolver = $this->optionResolverFactory->create(BP, false);
- foreach ($adapters as $type => $adapter) {
- $this->parser->addAdapter($type, $adapter);
- }
- $this->parser->parse($optionResolver->getOptions());
- $phraseList = $this->parser->getPhrases();
+ $exitCode = 0;
- foreach ($phraseList as $phrase) {
- $this->translationDataManagement->prepare($phrase->getPhrase(), $phrase->getTranslation());
- }
+ try {
+ $phraseCollector = new PhraseCollector(new Tokenizer());
+ $adapters = [
+ 'php' => new Php($phraseCollector),
+ 'html' => new Html(),
+ 'js' => new Js(),
+ 'xml' => new Xml(),
+ ];
+ $optionResolver = $this->optionResolverFactory->create(BP, false);
+ foreach ($adapters as $type => $adapter) {
+ $this->parser->addAdapter($type, $adapter);
+ }
+ $this->parser->parse($optionResolver->getOptions());
+ $phraseList = $this->parser->getPhrases();
- $output->writeln('Keys successfully created.');
+ foreach ($phraseList as $phrase) {
+ $this->translationDataManagement->prepare($phrase->getPhrase(), $phrase->getTranslation());
+ }
+
+ $output->writeln('Keys successfully created.');
+ } catch (\Exception $e) {
+ $output->writeln('' . $e->getMessage() . '');
+ $exitCode = 1;
+ }
- return 0;
+ return $exitCode;
}
}
diff --git a/Model/Translation/Source/Locales.php b/Model/Translation/Source/Locales.php
index 5d08ac4..b762407 100644
--- a/Model/Translation/Source/Locales.php
+++ b/Model/Translation/Source/Locales.php
@@ -3,40 +3,31 @@
namespace Phpro\Translations\Model\Translation\Source;
-use Magento\Framework\App\ResourceConnection;
+use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Data\OptionSourceInterface;
+use Magento\Store\Model\StoreManager;
class Locales implements OptionSourceInterface
{
private const XML_PATH_LOCALE = 'general/locale/code';
- /**
- * @var ResourceConnection
- */
- private $resourceConnection;
-
- public function __construct(ResourceConnection $resourceConnection)
- {
- $this->resourceConnection = $resourceConnection;
+ public function __construct(
+ private readonly ScopeConfigInterface $scopeConfig,
+ private readonly StoreManager $storeManager,
+ ) {
}
/**
* @inheritDoc
*/
- public function toOptionArray()
+ public function toOptionArray(): array
{
- $result = [];
- $connection = $this->resourceConnection->getConnection();
- $bind = [':config_path' => self::XML_PATH_LOCALE];
- $select = $connection
- ->select()
- ->from($this->resourceConnection->getTableName('core_config_data'), 'value')
- ->distinct(true)
- ->where('path = :config_path');
- $rowSet = $connection->fetchAll($select, $bind);
+ $stores = $this->storeManager->getStores();
- foreach ($rowSet as $row) {
- $result[] = ['value' => $row['value'], 'label' => $row['value']];
+ $result = [];
+ foreach ($stores as $store) {
+ $locale = $this->scopeConfig->getValue(self::XML_PATH_LOCALE, 'stores', $store->getId());
+ $result[] = ['value' => $locale, 'label' => $store->getName()];
}
return $result;
From 5faa0bc72140583b81fcd6f9a2a432c2c03c4380 Mon Sep 17 00:00:00 2001
From: Siebe De Celle
Date: Wed, 5 Jun 2024 14:37:07 +0200
Subject: [PATCH 09/10] PHPRO-415 Updated php version in grumphp.yml
---
.github/workflows/grumphp.yml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.github/workflows/grumphp.yml b/.github/workflows/grumphp.yml
index d540a3d..b5938a6 100644
--- a/.github/workflows/grumphp.yml
+++ b/.github/workflows/grumphp.yml
@@ -8,11 +8,9 @@ jobs:
fail-fast: true
matrix:
php-versions:
- - "7.4"
- "8.1"
dependencies:
- "lowest"
- - "highest"
steps:
- name: Checkout repo
uses: actions/checkout@v2
From 08c61a216f90182756ca9d41fa89e7de5602d265 Mon Sep 17 00:00:00 2001
From: Brent Robert
Date: Mon, 1 Jul 2024 10:14:34 +0200
Subject: [PATCH 10/10] PHPRO-415 Minor changes
---
.github/workflows/grumphp.yml | 4 ++--
Api/Data/TranslationInterface.php | 4 ++--
Api/TranslationRepositoryInterface.php | 10 +++++-----
.../Translation/Edit/GenericButton.php | 2 +-
CHANGELOG.md | 6 ++++--
Console/Command/Export.php | 6 ++----
.../Command/GenerateFrontendTranslations.php | 6 ++----
Console/Command/Import.php | 6 ++----
Console/Command/ImportFull.php | 6 ++----
Console/Command/PrepareKeysCommand.php | 6 ++----
composer.json | 19 ++++++++++---------
registration.php | 4 ++--
12 files changed, 36 insertions(+), 43 deletions(-)
diff --git a/.github/workflows/grumphp.yml b/.github/workflows/grumphp.yml
index b5938a6..33c7ecf 100644
--- a/.github/workflows/grumphp.yml
+++ b/.github/workflows/grumphp.yml
@@ -8,7 +8,7 @@ jobs:
fail-fast: true
matrix:
php-versions:
- - "8.1"
+ - "8.3"
dependencies:
- "lowest"
steps:
@@ -27,4 +27,4 @@ jobs:
run: composer install
- name: GrumPHP
- run: ./vendor/bin/grumphp run
\ No newline at end of file
+ run: ./vendor/bin/grumphp run
diff --git a/Api/Data/TranslationInterface.php b/Api/Data/TranslationInterface.php
index 870a8df..b2e6b16 100644
--- a/Api/Data/TranslationInterface.php
+++ b/Api/Data/TranslationInterface.php
@@ -69,14 +69,14 @@ public function setFrontend($frontend);
/**
* Retrieve existing extension attributes object or create a new one.
*
- * @return \Phpro\Translations\Api\Data\TranslationExtensionInterface|null
+ * @return TranslationExtensionInterface|null
*/
public function getExtensionAttributes();
/**
* Set an extension attributes object.
*
- * @param \Phpro\Translations\Api\Data\TranslationExtensionInterface $extensionAttributes
+ * @param TranslationExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
diff --git a/Api/TranslationRepositoryInterface.php b/Api/TranslationRepositoryInterface.php
index 16159b6..fe0f56d 100644
--- a/Api/TranslationRepositoryInterface.php
+++ b/Api/TranslationRepositoryInterface.php
@@ -11,9 +11,9 @@ interface TranslationRepositoryInterface
/**
* Save Translation
*
- * @param \Phpro\Translations\Api\Data\TranslationInterface $translation
+ * @param Data\TranslationInterface $translation
* @throws \Magento\Framework\Exception\LocalizedException
- * @return \Phpro\Translations\Api\Data\TranslationInterface
+ * @return Data\TranslationInterface
*/
public function save(
Data\TranslationInterface $translation
@@ -24,16 +24,16 @@ public function save(
*
* @param string $translationId
* @throws \Magento\Framework\Exception\LocalizedException
- * @return \Phpro\Translations\Api\Data\TranslationInterface
+ * @return Data\TranslationInterface
*/
public function getById($translationId);
/**
* Retrieve Translation matching the specified criteria.
*
- * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
+ * @param SearchCriteriaInterface $searchCriteria
* @throws \Magento\Framework\Exception\LocalizedException
- * @return \Phpro\Translations\Api\Data\TranslationSearchResultsInterface
+ * @return Data\TranslationSearchResultsInterface
*/
public function getList(
SearchCriteriaInterface $searchCriteria
diff --git a/Block/Adminhtml/Translation/Edit/GenericButton.php b/Block/Adminhtml/Translation/Edit/GenericButton.php
index ab91135..a59406d 100644
--- a/Block/Adminhtml/Translation/Edit/GenericButton.php
+++ b/Block/Adminhtml/Translation/Edit/GenericButton.php
@@ -13,7 +13,7 @@ abstract class GenericButton
protected $context;
/**
- * @param \Magento\Backend\Block\Widget\Context $context
+ * @param Context $context
*/
public function __construct(Context $context)
{
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3588d25..3fb5cc7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,12 +25,14 @@
## [1.2.2] - 2022-10-14
### Added
- Hyva support: remove requirejs from head.additional
--
+
## [1.3.0] - 2024-03-28
### Updated
- PHP ^8.1 compatibility
## [1.4.0] - 2024-06-05
+### Updated
+- Set minimum PHP version to 8.3
### Bugfix
- Fix return types console commands
-- Locales are not found if set in env.php and not in core_config_table
\ No newline at end of file
+- Locales are not found if set in env.php and not in core_config_table
diff --git a/Console/Command/Export.php b/Console/Command/Export.php
index 2c951ed..ba52606 100644
--- a/Console/Command/Export.php
+++ b/Console/Command/Export.php
@@ -44,8 +44,6 @@ protected function configure(): void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
- $exitCode = 0;
-
try {
$locales = $input->getArgument(self::ARGUMENT_LOCALES);
@@ -63,9 +61,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Done!');
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
- $exitCode = 1;
+ return Command::FAILURE;
}
- return $exitCode;
+ return Command::SUCCESS;
}
}
diff --git a/Console/Command/GenerateFrontendTranslations.php b/Console/Command/GenerateFrontendTranslations.php
index d48a527..692d013 100644
--- a/Console/Command/GenerateFrontendTranslations.php
+++ b/Console/Command/GenerateFrontendTranslations.php
@@ -44,8 +44,6 @@ protected function configure(): void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
- $exitCode = 0;
-
try {
$storeId = (int)$input->getArgument('storeId');
$statsCollection = $this->generatedTranslations($storeId);
@@ -64,10 +62,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Please clean full_page and block_html caches manually');
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
- $exitCode = 1;
+ return Command::FAILURE;
}
- return $exitCode;
+ return Command::SUCCESS;
}
/**
diff --git a/Console/Command/Import.php b/Console/Command/Import.php
index c4dec1c..1575281 100644
--- a/Console/Command/Import.php
+++ b/Console/Command/Import.php
@@ -57,8 +57,6 @@ protected function configure(): void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
- $exitCode = 0;
-
try {
$csvFile = $input->getArgument(self::ARGUMENT_CSV_FILE);
$locale = $input->getArgument(self::ARGUMENT_LOCALE);
@@ -86,9 +84,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Done!');
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
- $exitCode = 1;
+ return Command::FAILURE;
}
- return $exitCode;
+ return Command::SUCCESS;
}
}
diff --git a/Console/Command/ImportFull.php b/Console/Command/ImportFull.php
index 56e5ff0..f128f2a 100644
--- a/Console/Command/ImportFull.php
+++ b/Console/Command/ImportFull.php
@@ -55,8 +55,6 @@ protected function configure(): void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
- $exitCode = 0;
-
try {
$csvFile = $input->getArgument(self::ARGUMENT_CSV_FILE);
@@ -82,9 +80,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Done!');
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
- $exitCode = 1;
+ return Command::FAILURE;
}
- return $exitCode;
+ return Command::SUCCESS;
}
}
diff --git a/Console/Command/PrepareKeysCommand.php b/Console/Command/PrepareKeysCommand.php
index 8871201..cccd4c4 100644
--- a/Console/Command/PrepareKeysCommand.php
+++ b/Console/Command/PrepareKeysCommand.php
@@ -67,8 +67,6 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
- $exitCode = 0;
-
try {
$phraseCollector = new PhraseCollector(new Tokenizer());
$adapters = [
@@ -91,9 +89,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Keys successfully created.');
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
- $exitCode = 1;
+ return Command::FAILURE;
}
- return $exitCode;
+ return Command::SUCCESS;
}
}
diff --git a/composer.json b/composer.json
index 98bf304..943ffac 100644
--- a/composer.json
+++ b/composer.json
@@ -11,18 +11,18 @@
}
],
"require": {
- "php": "^8.1",
+ "php": "^8.3",
"magento/framework": "^102.0|^103.0",
"magento/module-backend": "^101.0|^102.0",
"magento/module-ui": "^101.0|^102.0"
},
"require-dev": {
- "friendsofphp/php-cs-fixer": "~3.4.0",
- "magento/magento-coding-standard": "21",
+ "friendsofphp/php-cs-fixer": "~3.59.0",
+ "magento/magento-coding-standard": "^33",
"php-parallel-lint/php-parallel-lint": "^1.3",
- "phpro/grumphp-shim": "^1.5",
- "phpunit/phpunit": "^8.5",
- "squizlabs/php_codesniffer": "~3.4"
+ "phpro/grumphp-shim": "^2.6",
+ "phpunit/phpunit": "^9.5",
+ "squizlabs/php_codesniffer": "~3.7"
},
"autoload": {
"psr-4": {
@@ -42,15 +42,16 @@
"sort-packages": true,
"allow-plugins": {
"phpro/grumphp-shim": true,
- "magento/composer-dependency-version-audit-plugin": true
+ "magento/composer-dependency-version-audit-plugin": true,
+ "dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"post-install-cmd": [
- "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard,../../phpcompatibility/php-compatibility/PHPCompatibility)"
+ "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/,../../magento/php-compatibility-fork)"
],
"post-update-cmd": [
- "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard,../../phpcompatibility/php-compatibility/PHPCompatibility)"
+ "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/,../../magento/php-compatibility-fork)"
]
}
}
diff --git a/registration.php b/registration.php
index 556395e..0ca21ba 100644
--- a/registration.php
+++ b/registration.php
@@ -1,6 +1,6 @@