Skip to content

More return type fixes (bis) #42490

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2021
Merged

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 5.4
Bug fix? no
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

@@ -34,7 +34,7 @@ public function __construct(ManagerRegistry $registry)
/**
* This cache warmer is not optional, without proxies fatal error occurs!
*
* @return false
* @return bool
Copy link
Member Author

Choose a reason for hiding this comment

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

false is not allowed as a standalone type

Copy link
Member

@wouterj wouterj Aug 11, 2021

Choose a reason for hiding this comment

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

But it is allowed as a PHPdoc type: https://docs.phpdoc.org/3.0/guide/references/phpdoc/types.html

And also recognized by static analysis tools as such. Should we keep @return false and detect this as : bool in the class loader? (feel free to ignore if you think it's not worth the effort)

Copy link
Member Author

Choose a reason for hiding this comment

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

false is allowed, but just not as a standalone type: it should always be part of a union

@@ -34,8 +34,10 @@ public function __construct(ServiceProviderInterface $functions)
*/
public function getFunctions()
{
$functions = [];
Copy link
Member Author

Choose a reason for hiding this comment

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

ExpressionFunctionProviderInterface mandates an array

@@ -28,8 +28,6 @@ abstract class AbstractAuthenticator implements AuthenticatorInterface
/**
* Shortcut to create a PostAuthenticationToken for you, if you don't really
* care about which authenticated token you're using.
*
* @return PostAuthenticationToken
Copy link
Member Author

@nicolas-grekas nicolas-grekas Aug 11, 2021

Choose a reason for hiding this comment

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

AbstractAuthenticator cannot force child classes to return an instance of PostAuthenticationToken.

FormLoginAuthenticator doesn't btw.

@@ -35,7 +34,7 @@ public function testUuidCanBeGenerated()

public function testCustomUuidfactory()
{
$uuid = new NilUuid();
$uuid = new UuidV4();
Copy link
Member Author

Choose a reason for hiding this comment

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

/cc @fancyweb FYI, this test was breaking the contracts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants