Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeVariant throws a PHP Runtime Deprecation Notice #626

Open
knusperpixel opened this issue Jan 22, 2025 · 4 comments
Open

BeVariant throws a PHP Runtime Deprecation Notice #626

knusperpixel opened this issue Jan 22, 2025 · 4 comments
Assignees
Labels
10.x related to TYPO3 v12

Comments

@knusperpixel
Copy link

Bug Report

Current Behavior
The class Classes/Domain/Model/Cart/BeVariant.php throws a PHP Runtime Deprecation Notice: Optional parameter $product declared before required parameter $price is implicitly treated as a required parameter in /var/www/vendor/extcode/cart/Clas
ses/Domain/Model/Cart/BeVariant.php line 46

Expected behavior/output
Run the extension without deprecation warnings.

Environment

  • TYPO3 version(s): 12.4.26
  • cart version: >=9.3.0
  • Is your TYPO3 installation set up with Composer (Composer Mode): yes
  • PHP: 8.3

Possible Solution
In this commit you changed the constructor parameters $productand $beVariant to be optional - maybe undo this?

@extcode extcode self-assigned this Jan 22, 2025
@extcode
Copy link
Owner

extcode commented Jan 22, 2025

The function parameters were already optional before. With the support of PHP 8.4 and the addition of tests, the parameter type was also declared as nullable. (see: https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated)

However, fixing this bug as implemented in the TYPO3 v13 version is a breaking change as it fundamentally changes the API of this method. This change would not only affect cart, but would also have to be taken into account in cart_products and all other product extensions.
The best approach would probably be to stop developing version 9.x and move the changes to version 10 with a breaking change. The current version 10 for TYPO3 v13 would then have to continue to run as version 11.

I'm not sure how best to communicate this, as the major version is rarely updated in (third-party) projects. I cannot guarantee that 9.x and 10.x will continue to be developed in parallel for TYPO3 v12.

I will think about the whole thing again and assess the effort involved.

@extcode
Copy link
Owner

extcode commented Jan 31, 2025

I have decided to bring out a new major release for TYPO3 v12. This is prepared so far. I will now adapt the product extensions to this major release.

@extcode extcode added the 10.x related to TYPO3 v12 label Jan 31, 2025
@extcode
Copy link
Owner

extcode commented Jan 31, 2025

@knusperpixel Can you have a look at extcode/cart-products v6.0.0 and extcode/cart v10.0.0. This should fix the PHP Runtime Deprecation Notice.

@seirerman
Copy link

Can confirm, the error is gone with the new versions. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.x related to TYPO3 v12
Projects
None yet
Development

No branches or pull requests

3 participants