Skip to content

Commit ca21ee5

Browse files
committed
Merge branch 'v1-develop' into v1
2 parents 6ab3448 + c3a41a1 commit ca21ee5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4454
-2668
lines changed

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/.gitattributes export-ignore
2+
/.gitignore export-ignore
3+
/.php-auto-version export-ignore
4+
/.php-cs-fixer.php export-ignore
5+
/composer.lock export-ignore
6+
/Makefile export-ignore
7+
/phpstan-baseline.neon export-ignore
8+
/phpstan.neon export-ignore
9+
/Test export-ignore
10+
/vendor-bin export-ignore

.php-cs-fixer.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
<?php
22

3-
$finder = PhpCsFixer\Finder::create()
3+
use PhpCsFixer\Finder as PhpCsFixerFinder;
4+
use PhpCsFixer\Config as PhpCsFixerConfig;
5+
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
6+
7+
$finder = PhpCsFixerFinder::create()
48
->in(__DIR__)
59
->exclude('vendor')
610
->exclude('vendor-bin')
711
;
812

9-
$config = new PhpCsFixer\Config();
13+
$config = new PhpCsFixerConfig();
1014
return $config
15+
->setParallelConfig(ParallelConfigFactory::detect())
1116
->setRules([
1217
'@PER-CS' => true,
1318
'binary_operator_spaces' => ['default' => 'at_least_single_space', 'operators' => ['=>' => 'align']],
1419
'declare_strict_types' => true,
1520
'no_alias_functions' => true,
21+
'no_unused_imports' => true,
1622
'no_useless_sprintf' => true,
17-
'nullable_type_declaration_for_default_null_value' => false, // should be 'true' when we drop support for PHP 7.0 which didn't support nullable types yet
23+
'nullable_type_declaration_for_default_null_value' => true,
1824
'ordered_imports' => ['sort_algorithm' => 'alpha'],
1925
'phpdoc_align' => ['align' => 'vertical'],
2026
'phpdoc_separation' => ['skip_unlisted_annotations' => true],
2127
'self_accessor' => true,
22-
'visibility_required' => ['elements' => ['property', 'method']], // removed 'const' since we still support PHP 7.0 for now
28+
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays']], // remove this line when we drop support for PHP < 8.0
2329
])
2430
->setFinder($finder)
2531
;

Block/Adminhtml/Metadata.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function getMetadata()
3535
if ($storageIdentifier === null || $storageIdentifier === '') {
3636
throw new MissingConfigurationException(__('No storage identifier was setup for this block!'));
3737
}
38+
assert(is_string($storageIdentifier));
3839

3940
$metaData = $this->metaStorage->getData($storageIdentifier);
4041
$metaData = $this->format($metaData);

Checker/Catalog/Category/UrlKey.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
class UrlKey
1111
{
12-
const URL_KEY_ATTRIBUTE = 'url_key';
13-
const STORAGE_IDENTIFIER = 'category-url-key';
12+
public const URL_KEY_ATTRIBUTE = 'url_key';
13+
public const STORAGE_IDENTIFIER = 'category-url-key';
1414

1515
private $duplicateUrlKeyChecker;
1616
private $emptyUrlKeyChecker;

Checker/Catalog/Category/UrlKey/DuplicateUrlKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class DuplicateUrlKey
1212
{
13-
const DUPLICATED_PROBLEM_DESCRIPTION =
13+
public const DUPLICATED_PROBLEM_DESCRIPTION =
1414
'%s categories were found which have a duplicated url_key value: "%s" within the same parent.'
1515
. ' Please fix because this will cause problems.';
1616

Checker/Catalog/Category/UrlKey/EmptyUrlKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class EmptyUrlKey
1717
{
18-
const EMPTY_PROBLEM_DESCRIPTION = 'Category has an empty url_key value. This needs to be fixed.';
18+
public const EMPTY_PROBLEM_DESCRIPTION = 'Category has an empty url_key value. This needs to be fixed.';
1919

2020
private $storesUtil;
2121
private $categoryCollectionFactory;

Checker/Catalog/Category/UrlPath.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
class UrlPath
1717
{
18-
const URL_PATH_ATTRIBUTE = 'url_path';
19-
const URL_PATH_SEPARATOR = '/';
20-
const PROBLEM_DESCRIPTION =
18+
public const URL_PATH_ATTRIBUTE = 'url_path';
19+
public const URL_PATH_SEPARATOR = '/';
20+
public const PROBLEM_DESCRIPTION =
2121
'Category has an incorrect url_path value "%s". It should be "%s".'
2222
. ' Unfortunately this is not easily fixable using the backend of Magento.';
23-
const STORAGE_IDENTIFIER = 'category-url-path';
23+
public const STORAGE_IDENTIFIER = 'category-url-path';
2424

2525
private $storesUtil;
2626
private $categoryCollectionFactory;
@@ -70,6 +70,7 @@ public function checkForIncorrectUrlPathAttributeValues(): array
7070
$correctUrlPath = $this->getCalculatedUrlPathForCategory($category, $storeId);
7171

7272
assert(is_numeric($category->getId()));
73+
assert(is_string($category->getUrlPath()));
7374

7475
$problems[] = [
7576
'catId' => (int) $category->getId(),
@@ -164,7 +165,7 @@ public function getCalculatedUrlPathForCategory(Category $category, int $storeId
164165
));
165166
}
166167

167-
private function fetchAllCategoriesWithUrlPathCalculatedByUrlKey()
168+
private function fetchAllCategoriesWithUrlPathCalculatedByUrlKey(): void
168169
{
169170
$this->calculatedUrlPathPerCategoryAndStoreId = [];
170171

Checker/Catalog/Product/UrlKey.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
class UrlKey
1111
{
12-
const URL_KEY_ATTRIBUTE = 'url_key';
13-
const STORAGE_IDENTIFIER = 'product-url-key';
12+
public const URL_KEY_ATTRIBUTE = 'url_key';
13+
public const STORAGE_IDENTIFIER = 'product-url-key';
1414

1515
private $duplicateUrlKeyChecker;
1616
private $emptyUrlKeyChecker;

Checker/Catalog/Product/UrlKey/DuplicateUrlKey.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class DuplicateUrlKey
2020
{
21-
const DUPLICATED_PROBLEM_DESCRIPTION =
21+
public const DUPLICATED_PROBLEM_DESCRIPTION =
2222
'Product has a duplicated url_key value (%s). It\'s the same as another product (ID: %s, Store: %s).'
2323
. ' Please fix because this will cause problems.';
2424

@@ -118,10 +118,11 @@ private function checkForDuplicatedUrlKeyAttributeValues(): array
118118
/**
119119
* @param ProductCollection<ProductModel> $collection
120120
*/
121-
private function storeProductUrlKeyData(int $storeId, ProductCollection $collection)
121+
private function storeProductUrlKeyData(int $storeId, ProductCollection $collection): void
122122
{
123123
foreach ($collection as $product) {
124124
assert(is_numeric($product->getEntityId()));
125+
assert(is_string($product->getUrlKey()));
125126

126127
$productId = $product->getEntityId();
127128
$productSku = $product->getSku();

Checker/Catalog/Product/UrlKey/EmptyUrlKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class EmptyUrlKey
2020
{
21-
const EMPTY_PROBLEM_DESCRIPTION = 'Product has an empty url_key value. This needs to be fixed.';
21+
public const EMPTY_PROBLEM_DESCRIPTION = 'Product has an empty url_key value. This needs to be fixed.';
2222

2323
private $storesUtil;
2424
private $progress;

Checker/Catalog/Product/UrlPath.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
class UrlPath
1818
{
19-
const URL_PATH_ATTRIBUTE = 'url_path';
20-
const PROBLEM_DESCRIPTION =
19+
public const URL_PATH_ATTRIBUTE = 'url_path';
20+
public const PROBLEM_DESCRIPTION =
2121
'Product has a non-null url_path attribute, this is known to cause problems with url rewrites in Magento.'
2222
. ' It\'s advised to remove this value from the database.';
23-
const STORAGE_IDENTIFIER = 'product-url-path';
23+
public const STORAGE_IDENTIFIER = 'product-url-path';
2424

2525
private $storesUtil;
2626
private $productCollectionFactory;

Console/Command/CheckCategoryUrlKeys.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(
3737
parent::__construct();
3838
}
3939

40-
protected function configure()
40+
protected function configure(): void
4141
{
4242
$this->setName('catalog:category:integrity:urlkey');
4343
$this->setDescription('Checks data integrity of the values of the url_key category attribute.');

Console/Command/CheckCategoryUrlPaths.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(
3737
parent::__construct();
3838
}
3939

40-
protected function configure()
40+
protected function configure(): void
4141
{
4242
$this->setName('catalog:category:integrity:urlpath');
4343
$this->setDescription('Checks data integrity of the values of the url_path category attribute.');

Console/Command/CheckProductUrlKeys.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
parent::__construct();
4242
}
4343

44-
protected function configure()
44+
protected function configure(): void
4545
{
4646
$this->setName('catalog:product:integrity:urlkey');
4747
$this->setDescription('Checks data integrity of the values of the url_key product attribute.');

Console/Command/CheckProductUrlPaths.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(
3737
parent::__construct();
3838
}
3939

40-
protected function configure()
40+
protected function configure(): void
4141
{
4242
$this->setName('catalog:product:integrity:urlpath');
4343
$this->setDescription('Checks data integrity of the values of the url_path product attribute.');

Console/Progress.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public function __construct()
2424
$this->format = '';
2525
}
2626

27-
public function setOutput(OutputInterface $output)
27+
public function setOutput(OutputInterface $output): void
2828
{
2929
$this->output = $output;
3030
}
3131

32-
public function initProgressBar(int $redrawFequency, string $format, string $message)
32+
public function initProgressBar(int $redrawFequency, string $format, string $message): void
3333
{
3434
if ($this->canOutput()) {
3535
$this->progressBar = new ProgressBar($this->output);
@@ -42,35 +42,35 @@ public function initProgressBar(int $redrawFequency, string $format, string $mes
4242
}
4343
}
4444

45-
public function setGuestimatedSize(int $nrOfIndexes, int $sizePerIndex)
45+
public function setGuestimatedSize(int $nrOfIndexes, int $sizePerIndex): void
4646
{
4747
for ($i = 0; $i < $nrOfIndexes; ++$i) {
4848
$this->sizeByIndex[$i] = $sizePerIndex;
4949
}
5050
$this->updateMaxSteps();
5151
}
5252

53-
public function updateExpectedSize(int $index, int $size)
53+
public function updateExpectedSize(int $index, int $size): void
5454
{
5555
$this->sizeByIndex[$index] = $size;
5656
$this->updateMaxSteps();
5757
}
5858

59-
public function advance()
59+
public function advance(): void
6060
{
6161
if ($this->canOutput()) {
6262
$this->progressBar->advance();
6363
}
6464
}
6565

66-
public function setMessage(string $message)
66+
public function setMessage(string $message): void
6767
{
6868
if ($this->canOutput()) {
6969
$this->progressBar->setMessage($message);
7070
}
7171
}
7272

73-
public function finish()
73+
public function finish(): void
7474
{
7575
if ($this->canOutput()) {
7676
$this->progressBar->finish();
@@ -82,7 +82,7 @@ private function canOutput(): bool
8282
return $this->output !== null;
8383
}
8484

85-
private function updateMaxSteps()
85+
private function updateMaxSteps(): void
8686
{
8787
if ($this->canOutput()) {
8888
$newMaxStepsValue = (int) array_sum($this->sizeByIndex);

Controller/Adminhtml/Catalog/Category/UrlKey/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class Index extends BackendAction
1313
{
14-
const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
14+
public const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
1515

1616
private $resultPageFactory;
1717

Controller/Adminhtml/Catalog/Category/UrlKey/Refresh.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class Refresh extends BackendAction
1616
{
17-
const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
17+
public const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
1818

1919
private $scheduleJob;
2020
private $metaStorage;

Controller/Adminhtml/Catalog/Category/UrlPath/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class Index extends BackendAction
1313
{
14-
const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
14+
public const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
1515

1616
private $resultPageFactory;
1717

Controller/Adminhtml/Catalog/Category/UrlPath/Refresh.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class Refresh extends BackendAction
1616
{
17-
const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
17+
public const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
1818

1919
private $scheduleJob;
2020
private $metaStorage;

Controller/Adminhtml/Catalog/Product/UrlKey/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class Index extends BackendAction
1313
{
14-
const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
14+
public const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
1515

1616
private $resultPageFactory;
1717

Controller/Adminhtml/Catalog/Product/UrlKey/Refresh.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class Refresh extends BackendAction
1616
{
17-
const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
17+
public const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
1818

1919
private $scheduleJob;
2020
private $metaStorage;

Controller/Adminhtml/Catalog/Product/UrlPath/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class Index extends BackendAction
1313
{
14-
const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
14+
public const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
1515

1616
private $resultPageFactory;
1717

Controller/Adminhtml/Catalog/Product/UrlPath/Refresh.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class Refresh extends BackendAction
1616
{
17-
const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
17+
public const ADMIN_RESOURCE = 'Baldwin_UrlDataIntegrityChecker::catalog_data_integrity';
1818

1919
private $scheduleJob;
2020
private $metaStorage;

Cron/CheckCategoryUrlKey.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class CheckCategoryUrlKey
1111
{
12-
const JOB_NAME = 'baldwin_urldataintegritychecker_cron_checkcategoryurlkey';
12+
public const JOB_NAME = 'baldwin_urldataintegritychecker_cron_checkcategoryurlkey';
1313

1414
private $urlKeyUpdater;
1515

@@ -19,7 +19,7 @@ public function __construct(
1919
$this->urlKeyUpdater = $urlKeyUpdater;
2020
}
2121

22-
public function execute()
22+
public function execute(): void
2323
{
2424
$this->urlKeyUpdater->refresh(MetaStorage::INITIATOR_CRON);
2525
}

Cron/CheckCategoryUrlPath.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class CheckCategoryUrlPath
1111
{
12-
const JOB_NAME = 'baldwin_urldataintegritychecker_cron_checkcategoryurlpath';
12+
public const JOB_NAME = 'baldwin_urldataintegritychecker_cron_checkcategoryurlpath';
1313

1414
private $urlPathUpdater;
1515

@@ -19,7 +19,7 @@ public function __construct(
1919
$this->urlPathUpdater = $urlPathUpdater;
2020
}
2121

22-
public function execute()
22+
public function execute(): void
2323
{
2424
$this->urlPathUpdater->refresh(MetaStorage::INITIATOR_CRON);
2525
}

0 commit comments

Comments
 (0)