Skip to content

Commit

Permalink
Support php 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mischabraam committed Jun 28, 2024
1 parent f41c177 commit b3ba00b
Show file tree
Hide file tree
Showing 24 changed files with 36 additions and 23 deletions.
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.DS_Store
.idea
composer.lock
vendor
*
!/src
!/src/**
!.gitignore
!composer.json
!grumphp.yml
!phpcs.xml
!README.md
19 changes: 7 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
"name": "iodigital-com/magento2-core",
"description": "iO core module for Magento 2",
"type": "magento2-module",
"version": "1.1.0",
"license": "MIT",
"license": "proprietary",
"authors": [
{
"email": "[email protected]",
"name": "Sander Merks"
},
{
"email": "[email protected]",
"name": "Sander Hartman"
Expand All @@ -19,23 +14,24 @@
}
],
"require": {
"php": ">=7.1 <8.2",
"php": ">=8.1",
"magento/framework": ">=102.0"
},
"require-dev": {
"iodigital-com/php-code-sniffer-standard": ">=29",
"magento/magento-coding-standard": "*",
"phpro/grumphp-shim": "^1.15"
"phpcompatibility/php-compatibility": "*",
"phpro/grumphp-shim": "^2.6"
},
"replace": {
"iodigital/magento2-core": "*"
},
"autoload": {
"psr-4": {
"IODigital\\Core\\": ""
"IODigital\\Core\\": "src/"
},
"files": [
"registration.php"
"src/registration.php"
]
},
"repositories": [
Expand All @@ -53,11 +49,10 @@
},
"scripts": {
"coding-standard": [
"./vendor/bin/phpcs --standard=./phpcs.xml"
"./vendor/bin/phpcs --standard=./phpcs.xml --extensions=php,phtml"
],
"test": [
"@coding-standard"
]
}

}
11 changes: 9 additions & 2 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
<exclude name="Magento2.Annotation.MethodArguments.ParamMissing"/>
<exclude name="Magento2.Annotation.MethodArguments.ArgumentMissing"/>
<exclude name="Magento2.Commenting.ClassPropertyPHPDocFormatting.Missing"/>
<exclude name="Magento2.Commenting.ClassPropertyPHPDocFormatting.MissingVar"/>

<!-- This rule does not work properly with the array<string, string> notation and will give false positives. -->
<exclude name="Magento2.Annotation.MethodArguments.DuplicateParam"/>

<!-- Exclude this rule because PSR12's version of this rule is already included and is compatible with multi-line conditionals -->
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
</rule>

<rule ref="iO">
Expand All @@ -24,10 +31,10 @@

<!-- Fully referenced used names is required for Magento API interfaces. -->
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName">
<exclude-pattern>app/code/*/Api</exclude-pattern>
<exclude-pattern>Api</exclude-pattern>
</rule>
<!-- Interfaces do need the 'Interface' suffix in Magento. -->
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming">
<exclude-pattern>app/code/*/Api</exclude-pattern>
<exclude-pattern>Api</exclude-pattern>
</rule>
</ruleset>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Magento\Store\Model\StoreManagerInterface;
use Psr\Log\LoggerInterface;

use function array_key_exists;
use function array_search;
use function count;
use function current;
Expand Down Expand Up @@ -62,7 +63,10 @@ protected function performAfterLoad(string $tableName, ?string $linkField): void

foreach ($this as $item) {
$linkedId = $item->getData($this->getIdFieldName());
$storeIds = $storesData[$linkedId] ?? [Store::DEFAULT_STORE_ID];
$storeIds = [Store::DEFAULT_STORE_ID];
if (array_key_exists($linkedId, $storesData) && $storesData[$linkedId] !== null) {
$storeIds = $storesData[$linkedId];
}

$storeIdKey = array_search(Store::DEFAULT_STORE_ID, $storeIds, true);
if ($storeIdKey !== false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct(
Context $context,
protected EntityManager $entityManager,
protected MetadataPool $metadataPool,
$resourcePrefix = null
?string $resourcePrefix = null
) {
parent::__construct($context, $resourcePrefix);
}
Expand Down Expand Up @@ -86,7 +86,9 @@ public function load(AbstractModel $object, $value, $field = null): self
{
if ($field !== null && $field !== $this->getIdFieldName()) {
parent::load($object, $value, $field);
$value = $object->getId() ?? $value;
if ($object->getId() !== null) {
$value = $object->getId();
}
}

$object = $this->entityManager->load($object, $value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ public function __construct(
}

/**
* @param $entity
* @param $arguments
* @@param object $entity
* @param array $arguments
* @return bool|object
* @throws LocalizedException
*/
// phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint
public function execute($entity, $arguments = [])
{
$connection = $this->resourceModel->getConnection();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added src/view/.DS_Store
Binary file not shown.
Binary file added src/view/adminhtml/.DS_Store
Binary file not shown.
File renamed without changes.
Binary file added src/view/adminhtml/web/.DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes
File renamed without changes

0 comments on commit b3ba00b

Please sign in to comment.