Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Validator] IntroduceBackedEnumValue constraint#54226

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
AurelienPillevesse wants to merge5 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromAurelienPillevesse:introduce-enum-constraint
Open
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
fix cs fix
  • Loading branch information
@AurelienPillevesse
AurelienPillevesse committedDec 15, 2024
commitc409057c66dbd46610f8e76fcbd189e6462e42f3
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,12 +47,12 @@ public function __construct(
parent::__construct([], $groups, $payload);

if (!is_a($type, \BackedEnum::class, true)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!is_a($type, \BackedEnum::class,true)) {
if (!is_subclass_of($type, \BackedEnum::class,true)) {

Copy link
Member

Choose a reason for hiding this comment

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

is_a() looks okay to me?

throw new ConstraintDefinitionException(sprintf('The "type" must be a \BackedEnum, got "%s".', get_debug_type($type)));
throw new ConstraintDefinitionException(\sprintf('The "type" must be a \BackedEnum, got "%s".', get_debug_type($type)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
thrownewConstraintDefinitionException(\sprintf('The "type" must be a \BackedEnum, got "%s".',get_debug_type($type)));
thrownewConstraintDefinitionException(\sprintf('The "type" must be a"\BackedEnum", got "%s".',get_debug_type($type)));

}

foreach ($except as $exceptValue) {
if (!is_a($exceptValue, $type)) {
throw new ConstraintDefinitionException(sprintf('The "except" values must be cases of enum "%s", got "%s".', $type, get_debug_type($exceptValue)));
throw new ConstraintDefinitionException(\sprintf('The "except" values must be cases of enum "%s", got "%s".', $type, get_debug_type($exceptValue)));
}
}
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp