fix ImageType NotBlank constraint#237
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideReplaces deprecated array-based NotBlank constraint options with named argument syntax to fix a deprecation in ImageType. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/Form/Type/ImageType.php" line_range="52" />
<code_context>
$fileFieldOptions['constraints'] = [
new NotBlank(
- ['message' => $options['required_image_error']]
+ message: $options['required_image_error']
),
];
</code_context>
<issue_to_address>
**issue (bug_risk):** Using a named argument here does not match NotBlank's constructor signature and will break at runtime.
`NotBlank`’s constructor takes an options array as its first (and only) argument, so `['message' => $options['required_image_error']]` was correct. Using `message:` as a named parameter does not match the constructor and will cause a named-parameter runtime error. Please either revert to the array form or change this to `new NotBlank(['message' => $options['required_image_error']])` to keep the behavior intact.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| $fileFieldOptions['constraints'] = [ | ||
| new NotBlank( | ||
| ['message' => $options['required_image_error']] | ||
| message: $options['required_image_error'] |
There was a problem hiding this comment.
issue (bug_risk): Using a named argument here does not match NotBlank's constructor signature and will break at runtime.
NotBlank’s constructor takes an options array as its first (and only) argument, so ['message' => $options['required_image_error']] was correct. Using message: as a named parameter does not match the constructor and will cause a named-parameter runtime error. Please either revert to the array form or change this to new NotBlank(['message' => $options['required_image_error']]) to keep the behavior intact.
|
@ilaria-orlando fix het bij FileType ook maar |
Bug fix
Passing an array of options to a Constraint is deprecated
Summary by Sourcery
Bug Fixes: