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] allow passing a validator to Validation::createCallable()#36859

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

Merged
nicolas-grekas merged 1 commit intosymfony:5.1fromnicolas-grekas:v-cb
May 19, 2020

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?5.1
Bug fix?yes
New feature?no
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

As spotted by@stof in#31466 (comment)

@xabbuh
Copy link
Member

I think we should also throw aTypeError if one calls the method withnull as the first argument followed by some constraints.

@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedMay 19, 2020
edited
Loading

If we don't allow null, it means the signature cannot be expressed using regular PHP types and we must trick it using func_num_args(). I think we'd better avoid such things.

$constraints =\func_get_args();
$validator =null;
}elseif (null !==$constraintOrValidator && !$constraintOrValidatorinstanceof ValidatorInterface) {
thrownew \TypeError(sprintf('Argument 1 passed to "%s()" must be a "%s" or a "%s" object, "%s" given.',__METHOD__, Constraint::class, ValidatorInterface::class,get_debug_type($constraintOrValidator)));
Copy link
Member

Choose a reason for hiding this comment

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

The error message should sayor "null" too.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

no need to advertise this case IMHO

@nicolas-grekasnicolas-grekas merged commit0fd5b95 intosymfony:5.1May 19, 2020
@nicolas-grekasnicolas-grekas deleted the v-cb branchMay 26, 2020 06:59
@fabpotfabpot mentioned this pull requestMay 26, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof approved these changes

@xabbuhxabbuhxabbuh approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

5.1

Development

Successfully merging this pull request may close these issues.

5 participants

@nicolas-grekas@xabbuh@stof@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp