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;

0 commit comments

Comments
 (0)