diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9c2cd56e..af5296d4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,6 +18,7 @@ jobs: - 8.1 - 8.2 - 8.3 + - 8.4 steps: - name: Checkout uses: actions/checkout@v4 @@ -93,6 +94,8 @@ jobs: typo3-version: '^12.4' - php-version: '8.3' typo3-version: '^12.4' + - php-version: '8.4' + typo3-version: '^12.4' steps: - uses: actions/checkout@v4 @@ -130,6 +133,9 @@ jobs: - name: Run Unit Tests PHP8.3 run: nix-shell --arg phpVersion \"php83\" --pure --run project-test-unit + - name: Run Unit Tests PHP8.4 + run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-unit + - name: Run Functional Tests PHP8.1 run: nix-shell --pure --run project-test-functional @@ -139,3 +145,6 @@ jobs: - name: Run Functional Tests PHP8.3 run: nix-shell --arg phpVersion \"php83\" --pure --run project-test-functional + - name: Run Functional Tests PHP8.4 + run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-functional + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c4d214b2..42a11c83 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -71,6 +71,11 @@ lint:php83: variables: CONTAINER_IMAGE: php:8.3-alpine +lint:php84: + <<: *lint_php + variables: + CONTAINER_IMAGE: php:8.4-alpine + phpstan:analyse: image: $CI_REGISTRY/containers/phpunit-with-php-8.1:main stage: lint @@ -119,6 +124,13 @@ test:php83:typo3_12: CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.3:main TYPO3_VERSION: ^12.4 +# Build in PHP 8.4 and TYPO3 12.4 +test:php84:typo3_12: + <<: *test_php + variables: + CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.4:main + TYPO3_VERSION: ^12.4 + documentation: stage: documentation image: diff --git a/Build/phpstan-baseline.neon b/Build/phpstan-baseline.neon index 2c4057f4..e244ca64 100644 --- a/Build/phpstan-baseline.neon +++ b/Build/phpstan-baseline.neon @@ -5,6 +5,26 @@ parameters: count: 1 path: ../Classes/Controller/Cart/OrderController.php + - + message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$price follows optional parameter \\$beVariant\\.$#" + count: 1 + path: ../Classes/Domain/Model/Cart/BeVariant.php + + - + message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$priceCalcMethod follows optional parameter \\$beVariant\\.$#" + count: 1 + path: ../Classes/Domain/Model/Cart/BeVariant.php + + - + message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$sku follows optional parameter \\$beVariant\\.$#" + count: 1 + path: ../Classes/Domain/Model/Cart/BeVariant.php + + - + message: "#^Deprecated in PHP 8\\.1\\: Required parameter \\$title follows optional parameter \\$beVariant\\.$#" + count: 1 + path: ../Classes/Domain/Model/Cart/BeVariant.php + - message: "#^Call to an undefined method Extcode\\\\Cart\\\\Domain\\\\Model\\\\Cart\\\\CartCouponInterface\\:\\:getTaxClass\\(\\)\\.$#" count: 2 diff --git a/Classes/Controller/Cart/CartController.php b/Classes/Controller/Cart/CartController.php index bb20df28..5aaff98c 100755 --- a/Classes/Controller/Cart/CartController.php +++ b/Classes/Controller/Cart/CartController.php @@ -61,9 +61,9 @@ protected function initializeView(CartTemplateView $view): void } public function showAction( - Item $orderItem = null, - BillingAddress $billingAddress = null, - ShippingAddress $shippingAddress = null + ?Item $orderItem = null, + ?BillingAddress $billingAddress = null, + ?ShippingAddress $shippingAddress = null ): ResponseInterface { $this->restoreSession(); diff --git a/Classes/Controller/Cart/OrderController.php b/Classes/Controller/Cart/OrderController.php index 77a3effc..2fc22847 100644 --- a/Classes/Controller/Cart/OrderController.php +++ b/Classes/Controller/Cart/OrderController.php @@ -57,9 +57,9 @@ public function initializeCreateAction(): void #[IgnoreValidation(['value' => 'shippingAddress'])] public function createAction( - Item $orderItem = null, - BillingAddress $billingAddress = null, - ShippingAddress $shippingAddress = null + ?Item $orderItem = null, + ?BillingAddress $billingAddress = null, + ?ShippingAddress $shippingAddress = null ): ResponseInterface { $this->restoreSession(); diff --git a/Classes/Controller/Cart/ProductController.php b/Classes/Controller/Cart/ProductController.php index f3eca424..2950a1d6 100644 --- a/Classes/Controller/Cart/ProductController.php +++ b/Classes/Controller/Cart/ProductController.php @@ -14,7 +14,6 @@ use Extcode\Cart\Domain\Model\Cart\Product; use Extcode\Cart\Event\CheckProductAvailabilityEvent; use Extcode\Cart\Event\RetrieveProductsFromRequestEvent; -use Psr\EventDispatcher\EventDispatcherInterface; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Messaging\AbstractMessage; use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; @@ -24,14 +23,6 @@ class ProductController extends ActionController { public const AJAX_CART_TYPE_NUM = '2278001'; - public function __construct( - EventDispatcherInterface $eventDispatcher = null - ) { - if ($eventDispatcher !== null) { - $this->eventDispatcher = $eventDispatcher; - } - } - public function addAction(): ResponseInterface { if (!$this->request->hasArgument('productType')) { diff --git a/Classes/Domain/Model/Cart/BeVariant.php b/Classes/Domain/Model/Cart/BeVariant.php index 43fd6300..a1f47162 100644 --- a/Classes/Domain/Model/Cart/BeVariant.php +++ b/Classes/Domain/Model/Cart/BeVariant.php @@ -45,8 +45,8 @@ class BeVariant public function __construct( protected string $id, - Product $product = null, - self $beVariant = null, + ?Product $product = null, + ?self $beVariant = null, protected string $title, protected string $sku, protected int $priceCalcMethod, diff --git a/Classes/Domain/Model/Cart/Cart.php b/Classes/Domain/Model/Cart/Cart.php index 915929ab..3fe4589f 100644 --- a/Classes/Domain/Model/Cart/Cart.php +++ b/Classes/Domain/Model/Cart/Cart.php @@ -1111,7 +1111,7 @@ public function setCurrencySign(string $currencySign): void $this->currencySign = $currencySign; } - public function translatePrice(float $price = null): ?float + public function translatePrice(?float $price = null): ?float { if ($price !== null) { $price /= $this->getCurrencyTranslation(); diff --git a/Classes/Domain/Model/Cart/Extra.php b/Classes/Domain/Model/Cart/Extra.php index 25756c12..7fd67f37 100644 --- a/Classes/Domain/Model/Cart/Extra.php +++ b/Classes/Domain/Model/Cart/Extra.php @@ -31,7 +31,7 @@ public function __construct( protected TaxClass $taxClass, protected bool $isNetPrice = false, protected string $extraType = '', - Service $service = null + ?Service $service = null ) { $this->service = $service; diff --git a/Classes/Domain/Model/Cart/Product.php b/Classes/Domain/Model/Cart/Product.php index 5095ac41..cc389135 100644 --- a/Classes/Domain/Model/Cart/Product.php +++ b/Classes/Domain/Model/Cart/Product.php @@ -69,7 +69,7 @@ public function __construct( protected TaxClass $taxClass, protected int $quantity, protected bool $isNetPrice = false, - FeVariant $feVariant = null + ?FeVariant $feVariant = null ) { if ($feVariant) { $this->feVariant = $feVariant; @@ -275,7 +275,7 @@ public function getQuantityDiscounts(): array return $this->quantityDiscounts; } - public function getQuantityDiscountPrice(int $quantity = null): float + public function getQuantityDiscountPrice(?int $quantity = null): float { $price = $this->getTranslatedPrice(); @@ -300,7 +300,7 @@ public function setQuantityDiscounts(array $quantityDiscounts): void /** * Returns Best Price (min of Price and Special Price) */ - public function getBestPrice(int $quantity = null): ?float + public function getBestPrice(?int $quantity = null): ?float { $bestPrice = $this->getQuantityDiscountPrice($quantity); diff --git a/Classes/EventListener/Order/Create/PersistOrder/Products.php b/Classes/EventListener/Order/Create/PersistOrder/Products.php index cbd3536b..bb0f06ac 100644 --- a/Classes/EventListener/Order/Create/PersistOrder/Products.php +++ b/Classes/EventListener/Order/Create/PersistOrder/Products.php @@ -95,7 +95,7 @@ protected function addProductVariants(Product $product): void protected function addFeVariants( \Extcode\Cart\Domain\Model\Order\Product $product, - FeVariant $feVariant = null + ?FeVariant $feVariant = null ): void { if ($feVariant) { $feVariantsData = $feVariant->getVariantData(); diff --git a/Classes/Service/TaxClassService.php b/Classes/Service/TaxClassService.php index 3a54beac..d44279d4 100644 --- a/Classes/Service/TaxClassService.php +++ b/Classes/Service/TaxClassService.php @@ -33,7 +33,7 @@ public function __construct( /** * @return TaxClass[] */ - public function getTaxClasses(string $countryCode = null): array + public function getTaxClasses(?string $countryCode = null): array { $taxClasses = []; $taxClassSettings = $this->settings['taxClasses']; diff --git a/Classes/Service/TaxClassServiceInterface.php b/Classes/Service/TaxClassServiceInterface.php index e1c20143..beb280c6 100644 --- a/Classes/Service/TaxClassServiceInterface.php +++ b/Classes/Service/TaxClassServiceInterface.php @@ -18,5 +18,5 @@ interface TaxClassServiceInterface /** * @return TaxClass[] */ - public function getTaxClasses(string $countryCode = null): array; + public function getTaxClasses(?string $countryCode = null): array; } diff --git a/Documentation/Changelog/9.3/Breaking-611-ChangePhpDependency.rst b/Documentation/Changelog/9.3/Breaking-611-ChangePhpDependency.rst new file mode 100644 index 00000000..fb7896f0 --- /dev/null +++ b/Documentation/Changelog/9.3/Breaking-611-ChangePhpDependency.rst @@ -0,0 +1,30 @@ +.. include:: ../../Includes.rst.txt + +====================================== +Breaking: #611 - Change PHP Dependency +====================================== + +See `Issue 611 `__ + +Description +=========== + +Tests with newer versions of phpstan under newer php versions showed that the +constructor method `\Extcode\Cart\Domain\Model\Cart\BeVariant::__construct()` uses +required method parameters after optional parameters. This is deprecated since. +PHP 8.0. (see https://php.watch/versions/8.0/deprecate-required-param-after-optional) + +As this may lead to an error in a later PHP version, compatibility is restricted +to PHP 8.1-8.4. + +Affected Installations +====================== + +All installations. + +Migration +========= + +This restriction currently has no effect. No migration is necessary. + +.. index:: API diff --git a/Documentation/Changelog/9.3/Index.rst b/Documentation/Changelog/9.3/Index.rst new file mode 100644 index 00000000..5c3b1691 --- /dev/null +++ b/Documentation/Changelog/9.3/Index.rst @@ -0,0 +1,20 @@ +.. include:: ../../Includes.rst.txt + +9.3 Changes +=========== + +**Table of contents** + +.. contents:: + :local: + :depth: 1 + +Breaking +-------- + +.. toctree:: + :maxdepth: 1 + :titlesonly: + :glob: + + Breaking-* diff --git a/Documentation/Changelog/Index.rst b/Documentation/Changelog/Index.rst index 256f5ffe..3cc03d24 100644 --- a/Documentation/Changelog/Index.rst +++ b/Documentation/Changelog/Index.rst @@ -10,6 +10,7 @@ ChangeLog :maxdepth: 5 :titlesonly: + 9.3/Index 9.1/Index 9.0/Index 8.5/Index diff --git a/Documentation/guides.xml b/Documentation/guides.xml index cfffed28..cd9077d7 100644 --- a/Documentation/guides.xml +++ b/Documentation/guides.xml @@ -11,8 +11,8 @@ interlink-shortcode="extcode/cart" /> diff --git a/README.md b/README.md index 69836caf..4e45ee32 100644 --- a/README.md +++ b/README.md @@ -45,17 +45,17 @@ Sometimes minor versions also result in minor adjustments to own templates or co ## 3.1 Compatibility and supported Versions -| Cart | TYPO3 | PHP | Support/Development | -|-------|------------|-----------|--------------------------------------| -| 9.x.x | 12.0 | 8.1+ | Features, Bugfixes, Security Updates | -| 8.x.x | 10.4, 11.5 | 7.2+ | Features, Bugfixes, Security Updates | -| 7.x.x | 10.4 | 7.2 - 7.4 | Security Updates | -| 6.x.x | 9.5 | 7.2 - 7.4 | | -| 5.x.x | 8.7 | 7.0 - 7.4 | | -| 4.x.x | 7.6 - 8.7 | 5.6 - 7.2 | | -| 3.x.x | 6.2 - 8.7 | 5.6 - 7.0 | | -| 2.x.x | | | | -| 1.x.x | | | | +| Cart | TYPO3 | PHP | Support/Development | +|--------|------------|-----------|--------------------------------------| +| 9.x.x | 12.4 | 8.1 - 8.4 | Features, Bugfixes, Security Updates | +| 8.x.x | 10.4, 11.5 | 7.2+ | Features, Bugfixes, Security Updates | +| 7.x.x | 10.4 | 7.2 - 7.4 | Security Updates | +| 6.x.x | 9.5 | 7.2 - 7.4 | | +| 5.x.x | 8.7 | 7.0 - 7.4 | | +| 4.x.x | 7.6 - 8.7 | 5.6 - 7.2 | | +| 3.x.x | 6.2 - 8.7 | 5.6 - 7.0 | | +| 2.x.x | | | | +| 1.x.x | | | | If you need extended support for features and bug fixes outside of the currently supported versions, we are happy to offer paid services. diff --git a/Tests/Unit/Service/AbstractConfigurationFromTypoScriptServiceTest.php b/Tests/Unit/Service/AbstractConfigurationFromTypoScriptServiceTest.php index 8b92cf09..25a0c5eb 100644 --- a/Tests/Unit/Service/AbstractConfigurationFromTypoScriptServiceTest.php +++ b/Tests/Unit/Service/AbstractConfigurationFromTypoScriptServiceTest.php @@ -180,7 +180,7 @@ public function getTypeZonePluginSettingsReturnsTypeZoneSettings(): void private function createSubject(array $configurations) { - $configurationManager = $this->createStub(ConfigurationManagerInterface::class); + $configurationManager = self::createStub(ConfigurationManagerInterface::class); $configurationManager->method('getConfiguration')->willReturn($configurations); return new class ($configurationManager, new ServiceFactory()) extends AbstractConfigurationFromTypoScriptService {}; diff --git a/Tests/Unit/Service/TaxClassServiceTest.php b/Tests/Unit/Service/TaxClassServiceTest.php index 1b9bcf48..80996f99 100644 --- a/Tests/Unit/Service/TaxClassServiceTest.php +++ b/Tests/Unit/Service/TaxClassServiceTest.php @@ -243,13 +243,13 @@ public function parsingTaxClassesFromTypoScriptWithIntegerZeroAsCalcIsValid(): v private function createSubject(array $settings): TaxClassService { - $configurationManager = $this->createStub(ConfigurationManagerInterface::class); + $configurationManager = self::createStub(ConfigurationManagerInterface::class); $configurationManager->method('getConfiguration')->willReturn($settings); return new TaxClassService( $configurationManager, new TaxClassFactory( - $this->createStub(LoggerInterface::class) + self::createStub(LoggerInterface::class) ) ); } diff --git a/composer.json b/composer.json index 71b6fa67..b32acfe5 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ } }, "require": { - "php": "^8.1", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", "ext-json": "*", "ext-openssl": "*", "typo3/cms-core": "^12.4", diff --git a/ext_emconf.php b/ext_emconf.php index bd28084b..6c647375 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -4,14 +4,17 @@ 'title' => 'Cart', 'description' => 'Shopping Cart(s) for TYPO3', 'category' => 'plugin', - 'version' => '9.2.0', + 'version' => '9.3.0', 'state' => 'stable', 'author' => 'Daniel Gohlke', 'author_email' => 'ext@extco.de', 'author_company' => 'extco.de UG (haftungsbeschränkt)', 'constraints' => [ 'depends' => [ + 'php' => '8.1.0-8.4.99', 'typo3' => '12.4.0-12.4.99', + 'extbase' => '12.4.0-12.4.99', + 'fluid' => '12.4.0-12.4.99', ], 'conflicts' => [], 'suggests' => [], diff --git a/rector.php b/rector.php index b4f7afcf..4b7557eb 100644 --- a/rector.php +++ b/rector.php @@ -40,7 +40,7 @@ ConvertImplicitVariablesToExplicitGlobalsRector::class, ]) ->withConfiguredRule(ExtEmConfRector::class, [ - ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.1.0-8.3.99', + ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.1.0-8.4.99', ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '12.4.0-12.4.99', ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [], ])