Skip to content

Commit

Permalink
Merge pull request #41 from baldwin-agency/php82-support-attempt
Browse files Browse the repository at this point in the history
PHP 8.2 support
  • Loading branch information
hostep authored Mar 1, 2023
2 parents 68e62d4 + f6b111a commit 6b3f9de
Show file tree
Hide file tree
Showing 17 changed files with 5,834 additions and 2,799 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.php-cs-fixer.cache
/auth.json
/Test/.phpunit.result.cache
/vendor-bin/*/vendor
/vendor/
1 change: 1 addition & 0 deletions .php-auto-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
php82
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('vendor')
->exclude('vendor-bin')
;

$config = new PhpCsFixer\Config();
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ check: checkstyle checkquality test

.PHONY: checkstyle
checkstyle:
vendor/bin/php-cs-fixer fix --dry-run --diff --stop-on-violation --allow-risky=yes
vendor/bin/phpcs -s --standard=Magento2 --exclude=Magento2.Security.InsecureFunction,Magento2.Commenting.ClassPropertyPHPDocFormatting,Magento2.Annotation.MethodAnnotationStructure,Magento2.Annotation.MethodArguments,PSR12.Properties.ConstantVisibility --ignore=./vendor/ .
vendor/bin/phpcs -s --standard=PHPCompatibility --runtime-set testVersion 7.0- --ignore=./vendor/,./Test/ .
vendor/bin/phpcs -s --standard=PHPCompatibility --runtime-set testVersion 7.1- ./Test/
PHP_CS_FIXER_IGNORE_ENV=1 vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --diff --stop-on-violation --allow-risky=yes
vendor-bin/phpcs/vendor/bin/phpcs -s --standard=Magento2 --exclude=Magento2.Security.InsecureFunction,Magento2.Commenting.ClassPropertyPHPDocFormatting,Magento2.Annotation.MethodAnnotationStructure,Magento2.Annotation.MethodArguments,PSR12.Properties.ConstantVisibility --ignore=./vendor/,./vendor-bin/ .
vendor-bin/phpcs/vendor/bin/phpcs -s --standard=PHPCompatibility --runtime-set testVersion 7.0- --ignore=./vendor/,./vendor-bin/,./Test/ .
vendor-bin/phpcs/vendor/bin/phpcs -s --standard=PHPCompatibility --runtime-set testVersion 7.1- ./Test/
vendor/bin/composer normalize --dry-run

.PHONY: checkquality
checkquality:
vendor/bin/phpstan analyse
vendor-bin/phpstan/vendor/bin/phpstan analyse

xmllint --noout --schema vendor/magento/module-store/etc/config.xsd etc/config.xml
xmllint --noout --schema vendor/magento/module-backend/etc/menu.xsd etc/adminhtml/menu.xml
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ It should be up to the store owner to figure out how he/she wants to fix these p
This module should be compatible with Magento 2.1.x, 2.2.x, 2.3.x and 2.4.x versions.
Some code in this module is using old ways of doing things. It could have been written in a more modern way (using message queues instead of cronjobs, use newer syntax for UI components, ...). But we wanted this module to be compatible with older versions of Magento, so we've chosen this route for now.

The module should be compatible with PHP 7.0, 7.1, 7.2, 7.3 and 7.4
The module should be compatible with PHP 7.0, 7.1, 7.2, 7.3, 7.4, 8.1 and 8.2

## Installation

Expand Down
7 changes: 0 additions & 7 deletions Test/Checker/Catalog/Product/UrlKey/DuplicateUrlKeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory;
use Magento\Framework\DataObject;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class DuplicateUrlKeyTest extends TestCase
Expand Down Expand Up @@ -48,7 +47,6 @@ function ($productData) use ($storeId) {

$collectionsPerStoreId = array_map(
function ($productsData) {
/** @var MockObject $productCollectionMock */
$productCollectionMock = $this->getMockBuilder(ProductCollection::class)
->disableOriginalConstructor()
->getMock();
Expand All @@ -74,7 +72,6 @@ function ($productsData) {
$dataPerStoreId
);

/** @var StoresUtil&MockObject */
$storesUtilMock = $this
->getMockBuilder(StoresUtil::class)
->disableOriginalConstructor()
Expand All @@ -83,13 +80,11 @@ function ($productsData) {
->method('getAllStoreIds')
->willReturn($storeIds);

/** @var Progress&MockObject */
$progressMock = $this
->getMockBuilder(Progress::class)
->disableOriginalConstructor()
->getMock();

/** @var ProductCollectionFactory&MockObject */
$productCollectionFactoryMock = $this
->getMockBuilder(ProductCollectionFactory::class)
->disableOriginalConstructor()
Expand All @@ -110,7 +105,6 @@ function ($productsData) {
->method('containsValue')
->willReturn(true);

/** @var AttributeScopeOverriddenValueFactory&MockObject */
$attributeScopeOverriddenValueFactoryMock = $this
->getMockBuilder(AttributeScopeOverriddenValueFactory::class)
->disableOriginalConstructor()
Expand All @@ -120,7 +114,6 @@ function ($productsData) {
->method('create')
->willReturn($attributeScopeOverriddenValueMock);

/** @var ConfigUtil&MockObject */
$configUtilMock = $this
->getMockBuilder(ConfigUtil::class)
->disableOriginalConstructor()
Expand Down
4 changes: 0 additions & 4 deletions Test/Storage/CacheStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Baldwin\UrlDataIntegrityChecker\Storage\CacheStorage;
use Magento\Framework\App\Cache as AppCache;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class CacheStorageTest extends TestCase
Expand All @@ -19,7 +18,6 @@ public function testUpdatingNonExisting()
'key2' => 'value2',
];

/** @var AppCache&MockObject */
$cacheMock = $this
->getMockBuilder(AppCache::class)
->disableOriginalConstructor()
Expand Down Expand Up @@ -57,7 +55,6 @@ public function testUpdatingExisting()
'key3' => 'value3',
];

/** @var AppCache&MockObject */
$cacheMock = $this
->getMockBuilder(AppCache::class)
->disableOriginalConstructor()
Expand Down Expand Up @@ -95,7 +92,6 @@ public function testClear()

$expectedData = [];

/** @var AppCache&MockObject */
$cacheMock = $this
->getMockBuilder(AppCache::class)
->disableOriginalConstructor()
Expand Down
2 changes: 1 addition & 1 deletion Ui/Component/Listing/Column/EditAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function prepareDataSource(array $dataSource)

$item[$this->getData('name')] = [
'edit' => [
'href' => $this->urlBuilder->getUrl(
'href' => $this->urlBuilder->getUrl(
$editUrlPath,
[
'id' => $entityId,
Expand Down
26 changes: 9 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": "~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.1.0",
"php": "~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.1.0 || ~8.2.0",
"magento/framework": "^100.1 || ^101.0 || ^102.0 || ^103.0",
"magento/module-backend": "^100.1 || ^101.0 || ^102.0",
"magento/module-catalog": "^101.0 || ^102.0 || ^103.0 || ^104.0",
Expand All @@ -23,15 +23,9 @@
"symfony/console": "^2.5 || ^3.0 || ^4.0 || ^5.0"
},
"require-dev": {
"bitexpert/phpstan-magento": "^0.23.0",
"bamarni/composer-bin-plugin": "^1.7",
"ergebnis/composer-normalize": "^2.17",
"friendsofphp/php-cs-fixer": "^3.0",
"magento/magento-coding-standard": ">=6",
"mikey179/vfsstream": "^1.6",
"phpcompatibility/php-compatibility": "^9.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpunit/phpunit": "^9.0"
},
"repositories": [
Expand All @@ -50,18 +44,16 @@
},
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"ergebnis/composer-normalize": true,
"magento/composer-dependency-version-audit-plugin": true,
"phpstan/extension-installer": true
"magento/composer-dependency-version-audit-plugin": true
},
"sort-packages": true
},
"scripts": {
"post-install-cmd": [
"([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths vendor/magento/magento-coding-standard,vendor/phpcompatibility/php-compatibility)"
],
"post-update-cmd": [
"([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths vendor/magento/magento-coding-standard,vendor/phpcompatibility/php-compatibility)"
]
"extra": {
"bamarni-bin": {
"bin-links": false,
"forward-command": true
}
}
}
Loading

0 comments on commit 6b3f9de

Please sign in to comment.