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

[HttpKernel] In DateTimeValueResolver, convert previously defined date attribute to the expected class#48346

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

Conversation

@GromNaN
Copy link
Member

@GromNaNGromNaN commentedNov 26, 2022
edited
Loading

QA
Branch?6.1
Bug fix?yes
New feature?no
Deprecations?no
TicketsFixhttps://github.com/symfony/symfony/pull/48098/files#r1013997729
LicenseMIT

Convert an instance ofDateTimeInterface to the expected class if the value was predefined in the request attributes.

# in a request listener$request->attributes->set('date',new \DateTimeImmutable());
class MyController{publicfunctionindex(\DateTime$date)    {// Use the $date    }}
Uncaught TypeError: MyController::index(): Argument #1 ($date) must be of type DateTime, DateTimeImmutable given

class DateTimeValueResolverTestextends TestCase
{
private$defaultTimezone;
privatereadonlystring$defaultTimezone;
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This class was introduced in 6.1, I took this PR as an opportunity to improve type definition and make data providers static.

@GromNaNGromNaN requested a review fromstofNovember 28, 2022 13:03
@nicolas-grekas
Copy link
Member

Thank you@GromNaN.

@nicolas-grekasnicolas-grekas merged commit972926c intosymfony:6.1Dec 4, 2022
@GromNaNGromNaN deleted the 6.1-fix-datetime-class branchDecember 4, 2022 16:55
@fabpotfabpot mentioned this pull requestDec 6, 2022
@fabpotfabpot mentioned this pull requestDec 28, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.1

Development

Successfully merging this pull request may close these issues.

4 participants

@GromNaN@nicolas-grekas@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp