Skip to content

Fix for deprecations from Symfony Validator 7.4#49

Open
robjenman wants to merge 4 commits into
chiiya:masterfrom
robjenman:master
Open

Fix for deprecations from Symfony Validator 7.4#49
robjenman wants to merge 4 commits into
chiiya:masterfrom
robjenman:master

Conversation

@robjenman
Copy link
Copy Markdown

No description provided.

Copilot AI and others added 4 commits April 15, 2026 10:36
Replace positional argument with named argument 'choices:' in all
Choice constraint usages to fix Symfony 7.4 deprecation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: robjenman <767666+robjenman@users.noreply.github.com>
…-validator

Use named `choices` argument in Choice constraint for Symfony 7.4 compat
Copilot AI review requested due to automatic review settings April 28, 2026 09:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Symfony Validator constraint attributes to address deprecations surfaced by Symfony Validator 7.4, primarily by switching Choice usages to the named choices: argument and by explicitly setting the Url constraint’s requireTld option.

Changes:

  • Replace #[Choice([...])] / new Choice([...]) with #[Choice(choices: [...])] / new Choice(choices: [...]) across Google/Apple pass DTOs.
  • Update #[Url] usages to #[Url(requireTld: true)] to avoid Symfony 7.4 deprecation warnings.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Google/Passes/TransitObject.php Update Choice attribute to use choices: named argument.
src/Google/Passes/TransitClass.php Update Choice attribute to use choices: named argument.
src/Google/Passes/OfferClass.php Update Choice attribute to use choices: named argument.
src/Google/Passes/GenericObject.php Update Choice attribute to use choices: named argument.
src/Google/Passes/FlightClass.php Update Choice attribute to use choices: named argument.
src/Google/Passes/EventTicketClass.php Update multiple Choice attributes to use choices: named argument.
src/Google/Passes/BaseClass.php Update Choice attribute to use choices: named argument.
src/Google/Passes/AbstractObject.php Update Choice attribute to use choices: named argument.
src/Google/Passes/AbstractClass.php Update Choice attributes to use choices: named argument.
src/Google/Components/Transit/TicketSeat.php Update Choice attribute to use choices: named argument.
src/Google/Components/Loyalty/DiscoverableProgramMerchantSignupInfo.php Update Choice attribute to use choices: named argument.
src/Google/Components/Loyalty/DiscoverableProgram.php Update Choice attribute to use choices: named argument.
src/Google/Components/Flight/BoardingAndSeatingPolicy.php Update Choice attributes to use choices: named argument.
src/Google/Components/Flight/BoardingAndSeatingInfo.php Update Choice attribute to use choices: named argument.
src/Google/Components/EventTicket/EventDateTime.php Update Choice attribute to use choices: named argument.
src/Google/Components/Common/TotpDetails.php Update Choice attribute to use choices: named argument.
src/Google/Components/Common/SecurityAnimation.php Update Choice attribute to use choices: named argument.
src/Google/Components/Common/RotatingBarcode.php Update Choice attributes to use choices: named argument.
src/Google/Components/Common/Message.php Update Choice attribute to use choices: named argument.
src/Google/Components/Common/ClassTemplate/TemplateItem.php Update Choice attribute to use choices: named argument.
src/Google/Components/Common/ClassTemplate/FirstRowOption.php Update Choice attribute to use choices: named argument.
src/Google/Components/Common/ClassTemplate/FieldReference.php Update Choice attribute to use choices: named argument.
src/Google/Components/Common/CallbackOptions.php Set Url(requireTld: true) explicitly on callback URLs.
src/Google/Components/Common/Barcode.php Update Choice attributes to use choices: named argument.
src/Apple/Passes/Pass.php Set Url(requireTld: true) explicitly on webServiceURL.
src/Apple/Passes/BoardingPass.php Update Choice attribute to use choices: named argument.
src/Apple/Components/Semantics.php Update Choice attribute to use choices: named argument.
src/Apple/Components/SecondaryField.php Update Choice attribute to use choices: named argument.
src/Apple/Components/Field.php Update Choice (and nested new Choice) to use choices: named argument.
src/Apple/Components/Barcode.php Update Choice attribute to use choices: named argument.
src/Apple/Components/AuxiliaryField.php Update Choice attribute to use choices: named argument.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 17 to 20
#[NotBlank]
#[Url]
#[Url(requireTld: true)]
public string $url,
/**
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting requireTld: true changes validation semantics vs the default (it will reject hosts like localhost or internal DNS names). If this change is only to silence the Symfony 7.4 deprecation, consider explicitly choosing the value that preserves existing behavior (or document the breaking change). Also, the docblock says the URL must be HTTPS, but Url without protocols: ['https'] still accepts http://.

Copilot uses AI. Check for mistakes.
Comment on lines 24 to 26
*/
#[Url]
#[Url(requireTld: true)]
public ?string $updateRequestUrl = null,
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same concern as url: requireTld: true may be a breaking validation change (e.g., rejects https://localhost/...). If keeping prior behavior is important, set requireTld explicitly to the intended value and consider adding a focused test to lock that behavior in.

Copilot uses AI. Check for mistakes.
Comment thread src/Apple/Passes/Pass.php
* @see https://developer.apple.com/library/archive/documentation/PassKit/Reference/PassKit_WebService/WebService.html#//apple_ref/doc/uid/TP40011988
*/
#[Url]
#[Url(requireTld: true)]
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requireTld: true is a behavior change for URL validation (it rejects localhost/intranet hosts). If this is only meant to address the Symfony 7.4 deprecation, consider setting requireTld to the value that matches previous releases (or document the stricter validation and add a test for it).

Suggested change
#[Url(requireTld: true)]
#[Url(requireTld: false)]

Copilot uses AI. Check for mistakes.
@kov-lucas
Copy link
Copy Markdown

This PR should also update to symfony validator 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants