Skip to content

[Routing] add replace string to constant route requirements for 6.1/6.2/7.3 - #1036

Closed
JohJohan wants to merge 1 commit into
rectorphp:mainfrom
JohJohan:Routing
Closed

[Routing] add replace string to constant route requirements for 6.1/6.2/7.3#1036
JohJohan wants to merge 1 commit into
rectorphp:mainfrom
JohJohan:Routing

Conversation

@JohJohan

Copy link
Copy Markdown
Contributor

For example it will transform:

+use Symfony\Component\Routing\Requirement\Requirement;

#[Route(
    '/zoekopdracht/afmelden/{profileId}/{subscriptionId}',
    requirements: [
-        'profileId' => '[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}',
-        'subscriptionId' => '[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}',
+        'profileId' => Requirement::UUID_V4,
+        'subscriptionId' => Requirement::UUID_V4,
    ],
)]

@TomasVotruba

Copy link
Copy Markdown
Member

Thanks for the PR 👍

The string to const fetch rule was deprecated, as doing too much with wide blast radius.
So I made a custom rule to handle these using available Requirements constants: #1037

@TomasVotruba

Copy link
Copy Markdown
Member

Surpassed by #1037

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants