Skip to content

Fixed the nullable support for php 7.1 and below (2.7, 2.8, 3.0) #19811

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
Sep 14, 2016
Merged

Fixed the nullable support for php 7.1 and below (2.7, 2.8, 3.0) #19811

merged 1 commit into from
Sep 14, 2016

Conversation

linaori
Copy link
Contributor

@linaori linaori commented Sep 1, 2016

Q A
Branch? 2.7, 2.8, 3.0
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #19784 (comment)
License MIT
Doc PR ~

Fixes the nullable support for 2.7, 2.8 and 3.0, can probably be partially merged into 3.1 but not 100% sure.

/ping @fabpot

* @param callable $controller
* @param \ReflectionParameter[] $parameters
*
* @return mixed[]
Copy link
Member

Choose a reason for hiding this comment

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

@return array The values to use when calling the controller

Copy link
Contributor Author

@linaori linaori Sep 1, 2016

Choose a reason for hiding this comment

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

Sounds good to me, is there any reason array is preferred over mixed[]?

edit: The arguments to use instead of The values to use, WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

more common to me :)

@linaori
Copy link
Contributor Author

linaori commented Sep 1, 2016

@dunglas https://3v4l.org/3Vb4g if this is how you would expect it to work, I'd say it's nullable as default as long as it doesn't have a default value.

@dunglas
Copy link
Member

dunglas commented Sep 1, 2016

@iltar looks good: https://3v4l.org/rn5gR

@linaori
Copy link
Contributor Author

linaori commented Sep 1, 2016

@dunglas the problem is that it's not really nullable anymore. For the old 2.7, 2.8 and 3.0 it's fine, but for the new variant (argument value resolver) this is not a good solution imo. If I ask if something is nullable, I refer to the ?string feature, while right now with allows null without type, $foo = '' is also nullable, e.g. it won't crash when called with null.

@dunglas
Copy link
Member

dunglas commented Sep 1, 2016

@iltar but it will never happen because of https://github.com/symfony/symfony/pull/19811/files#diff-8518ab757bc9acd6d5a874a2e2737502R133 or am I missing something?

@linaori
Copy link
Contributor Author

linaori commented Sep 1, 2016

@dunglas no, for this case it's fine, I'm referring to https://github.com/symfony/symfony/pull/19784/files#diff-d298199ac90f557ade8fffe47ab3f755R98

While not directly related to this PR, it's a small detail difference.

$controller = array(new NullableController(), 'action');
$this->assertEquals(array('foo', new \stdClass(), 'value', 'mandatory'), $resolver->getArguments($request, $controller));
}
/**
Copy link
Member

Choose a reason for hiding this comment

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

missing blank line before

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is fabbot.io skipping test files?

@fabpot
Copy link
Member

fabpot commented Sep 7, 2016

👍

@fabpot
Copy link
Member

fabpot commented Sep 14, 2016

Thank you @iltar.

@fabpot fabpot merged commit 9c48756 into symfony:2.7 Sep 14, 2016
fabpot added a commit that referenced this pull request Sep 14, 2016
…, 3.0) (iltar)

This PR was merged into the 2.7 branch.

Discussion
----------

Fixed the nullable support for php 7.1 and below (2.7, 2.8, 3.0)

| Q             | A
| ------------- | ---
| Branch?       | 2.7, 2.8, 3.0
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19784 (comment)
| License       | MIT
| Doc PR        | ~

Fixes the nullable support for 2.7, 2.8 and 3.0, can probably be partially merged into 3.1 but not 100% sure.

/ping @fabpot

Commits
-------

9c48756 Fixed the nullable support for php 7.1 and below
This was referenced Oct 3, 2016
@linaori linaori deleted the fix/nullable-2-7 branch February 8, 2019 13:38
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.

6 participants