Skip to content

Conversation

@nxtpge
Copy link

@nxtpge nxtpge commented Nov 19, 2025

Q A
Branch? 1.x
Bug fix? no
New feature? yes
Deprecations? no
Issues
License MIT

This pull request adds the --target option to the make:validator command to speed up the creation and the use of a custom validation constraint.

Usage

php bin/console make:validator FooValidator --target=class
php bin/console make:validator FooValidator --target=method
php bin/console make:validator FooValidator --target=property

Result

Target Constraint class changes
class - Add the #[\Attribute(\Attribute::IS_REPEATABLE)] declaration,
- Add the Constraint::getTargets required method.
method - Add the #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] declaration.
property - Add the #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::IS_REPEATABLE)] declaration.

@nxtpge nxtpge force-pushed the make-validator-target-option branch from e18c63e to 1909f1b Compare November 19, 2025 20:06
…tically where the constraint class can be used
@nxtpge nxtpge force-pushed the make-validator-target-option branch from 1909f1b to 1e52a9a Compare November 19, 2025 20:09
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.

1 participant