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

[Cache] Implement psr/cache 3#41290

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

@derrabus
Copy link
Member

QA
Branch?6.0
Bug fix?no
New feature?yes
Deprecations?no
TicketsN/A
LicenseMIT
Doc PRN/A

This PR adds the necessary return types to support version 3 of thepsr/cache interfaces. I did not add parameter types in order to maintain v1 compatibility, but we could as well decide to drop v1 if we want.

@carsonbot

This comment has been minimized.

@carsonbotcarsonbot added this to the6.0 milestoneMay 19, 2021
@derrabusderrabusforce-pushed theimprovement/psr-cache-3 branch from186e22f to76ce5bdCompareMay 19, 2021 18:07
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

I'm fine dropping support for v1 and adding types to parameters!

Before merging, and as much as I want this to be merged, let's take this PR as an opportunity to put our plan in practice: adding any return types in 6.0 must first issue a deprecation notice in 5.4.

This can be done by settingDebugClassLoader indeprecation mode by default:
https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/ErrorHandler/DebugClassLoader.php#L39

There is a direct link withhttps://wiki.php.net/rfc/internal_method_return_types also, which we should account for/rely on by eg reusing the attribute.

derrabus reacted with thumbs up emoji
}

privatefunctiongenerateItems(array$keys,$now,$f)
privatefunctiongenerateItems(array$keys,$now,$f):\Generator

Choose a reason for hiding this comment

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

all additions to private (and final if any) methods should be split on a lower branch

@derrabus
Copy link
MemberAuthor

Before merging, and as much as I want this to be merged, let's take this PR as an opportunity to put our plan in practice: adding any return types in 6.0 must first issue a deprecation notice in 5.4.

Indeed. Shall we resurrect#33228?

There is a direct link withhttps://wiki.php.net/rfc/internal_method_return_types also, which we should account for/rely on by eg reusing the attribute.

Is there a list of methods anywhere that are affected by the RFC? We should make sure thatif we override/polyfill any of those they should have the correct return type in 6.0

@nicolas-grekas
Copy link
Member

Indeed. Shall we resurrect#33228?

why not, if you think we need an issue for that :)
to me the plan is clear and is very similar tohttps://wiki.php.net/rfc/internal_method_return_types

Is there a list of methods anywhere that are affected by the RFC

not really, that maybe:https://github.com/php/php-src/pull/6548/files?file-filters%5B%5D=.h

@stof
Copy link
Member

to me the plan is clear and is very similar tohttps://wiki.php.net/rfc/internal_method_return_types

I think the DebugClassLoader should be improved to require an opt-in from the class to decide that its next major version will add a return type instead of just relying on the presence of@return. Adding a@return in a phpdoc does not automatically mean that the next major version will turn it into a native return type.
And supporting theReturnTypeWillChange attribute as a way for the child class to opt-out from the warning would be great (as that would reuse the PHP feature doing the opt out)

The ideal solution would of course be that PHP exposes the tentative return type to userland instead of reserving it for internal classes.

but anyway, this discussion probably deserves its own issue

sstok reacted with rocket emoji

@stof
Copy link
Member

btw, the explicit opt-in for parent classes would allow us to activate that behavior by default in DebugClassLoader. As long as it requires projects to run the DebugClassLoader in a special mode, wedon't have a graceful migration path for our users, as they won't get the warnings (because they won't even know that this special mode exists).

derrabus and apfelbox reacted with thumbs up emoji

@derrabus
Copy link
MemberAuthor

derrabus commentedMay 20, 2021
edited
Loading

Adding the parameter types is lot more fun because the integration tests are not ready for that. 🙈 Will do that in a separate PR.

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedJun 8, 2021
edited
Loading

Should be updated with argument types, taking some changes from#41424

@derrabusderrabusforce-pushed theimprovement/psr-cache-3 branch from76ce5bd to14c4ff9CompareJune 8, 2021 21:40
@derrabusderrabusforce-pushed theimprovement/psr-cache-3 branch from14c4ff9 to4330526CompareJune 29, 2021 12:58
@nicolas-grekasnicolas-grekas mentioned this pull requestJul 6, 2021
57 tasks
Signed-off-by: Alexander M. Turek <me@derrabus.de>
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

(I'm merging to move this forward, we'll handle the deprecation path for all components at once anyway.)

@nicolas-grekas
Copy link
Member

Thank you@derrabus.

@derrabus
Copy link
MemberAuthor

Thank you for completing this PR,@nicolas-grekas!

@derrabusderrabus deleted the improvement/psr-cache-3 branchJuly 7, 2021 09:59
@fabpotfabpot mentioned this pull requestNov 5, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@NyholmNyholmNyholm left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.0

Development

Successfully merging this pull request may close these issues.

5 participants

@derrabus@carsonbot@nicolas-grekas@stof@Nyholm

[8]ページ先頭

©2009-2025 Movatter.jp