Skip to content

Replace Zend_Validation #4612

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

Closed
wants to merge 48 commits into from
Closed

Replace Zend_Validation #4612

wants to merge 48 commits into from

Conversation

sreichel
Copy link
Contributor

@sreichel sreichel commented Feb 7, 2025

Description (*)

WIP (90%), but ready to review.

This attempts to replace another Zend_ library.

I did not choose laminas (as earlier suggested in #3199), nor symfony. No framework, straight-forward validation.

See https://github.com/Respect/Validation

Related Pull Requests

@github-actions github-actions bot added Component: Core Relates to Mage_Core Component: Catalog Relates to Mage_Catalog Component: Checkout Relates to Mage_Checkout Component: Customer Relates to Mage_Customer Component: Eav Relates to Mage_Eav Component: Adminhtml Relates to Mage_Adminhtml Component: Api PageRelates to Mage_Api Component: Contacts Relates to Mage_Contacts Component: Admin Relates to Mage_Admin Component: Wishlist Relates to Mage_Wishlist Component: Review Relates to Mage_Review Component: Newsletter Relates to Mage_Newsletter Component: ImportExport Relates to Mage_ImportExport composer Relates to composer.json phpunit labels Feb 7, 2025
Copy link

sonarqubecloud bot commented Feb 7, 2025

@sreichel sreichel marked this pull request as draft February 7, 2025 01:26
@Hanmac
Copy link
Contributor

Hanmac commented Feb 7, 2025

sad no symfony noises xD

Also, you might need to look at this:

@deprecated Calling `validate()` directly from rules is deprecated. Please use {@see \Respect\Validation\Validator::isValid()} instead.

@sreichel
Copy link
Contributor Author

sreichel commented Feb 7, 2025

sad no symfony noises xD

I tried, but writing rules is more intuitive with that ... imho.

Also, you might need to look at this:

@deprecated Calling `validate()` directly from rules is deprecated. Please use {@see \Respect\Validation\Validator::isValid()} instead.

I am aware of it, but latest version requies php 8.1.

@Hanmac
Copy link
Contributor

Hanmac commented Feb 7, 2025

for the current changes in this MR, Symfony Validator might be easy too.

the bigger use would be that we could validate entire objects like Customer Address at once

Also the Intl/Translation support is nice, so we could have the errors already translated by the System

@mattdavenport
Copy link
Contributor

I would be in favor of switching this to Symfony validation. Looking at this from a bigger picture, it would be best if we picked a library of components (e.g. Symfony/Laminas/etc.) and stuck to those throughout the project when replacing outdated libraries. IMO not doing this will increase the maintenance burden long term with differing packages/conventions to keep track of.

# Conflicts:
#	composer.json
#	composer.lock
@sreichel sreichel marked this pull request as draft April 14, 2025 06:04
@github-actions github-actions bot added the Component: Reports Relates to Mage_Reports label Apr 14, 2025
@sreichel sreichel marked this pull request as ready for review April 15, 2025 05:13
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@sreichel sreichel marked this pull request as draft April 15, 2025 09:02
@sreichel
Copy link
Contributor Author

sreichel commented Apr 20, 2025

I would be in favor of switching this to Symfony validation

Did it. Looks good, but found some issues ... wait for #4758.

@sreichel sreichel closed this Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Admin Relates to Mage_Admin Component: Adminhtml Relates to Mage_Adminhtml Component: Api PageRelates to Mage_Api Component: Catalog Relates to Mage_Catalog Component: Checkout Relates to Mage_Checkout Component: Contacts Relates to Mage_Contacts Component: Core Relates to Mage_Core Component: Customer Relates to Mage_Customer Component: Eav Relates to Mage_Eav Component: ImportExport Relates to Mage_ImportExport Component: Newsletter Relates to Mage_Newsletter Component: Reports Relates to Mage_Reports Component: Review Relates to Mage_Review Component: Widget Relates to Mage_Widget Component: Wishlist Relates to Mage_Wishlist composer Relates to composer.json environment git new feature php-cs-fixer phpstan phpunit rector
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants