Skip to content
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

[Routing] revert the return type for UrlGeneratorInterface::generate to remove null #34299

Merged
merged 1 commit into from Nov 9, 2019

Conversation

@shieldo
Copy link
Contributor

shieldo commented Nov 8, 2019

…to remove null

Q A
Branch? 3.4 (only)
Bug fix? yes
New feature? no
Deprecations? no
License MIT

Bit of a casualty of commit tennis this:

A change to add null here as an option for how UrlGeneratorInterface::generate() (rather than the concrete UrlGenerator) was merged in #28321, but then reverted for the reason that this could be seen as a BC break, as the null return had not previously been documented (and is still not as part of the interface method docs).

However, in a subsequent change (#33252) with a wider scope, this doc change was added back in order to reflect the underlying implementation as a result of a PHPStorm plugin complaining. There's no indication though of what a null return here though would mean, and for the same reason as the first revert (that this should be seen as a BC break), I'd like to submit this to be reverted for the 3.4 branch. (In 4.4 the null has already been removed.)

Having the interface indicating that this method can return null necessitates introducing a lot of actually redundant null checks in code that is covered by static analysis tools such as PHPStan.

…to remove null
Copy link
Member

nicolas-grekas left a comment

(it's not in 4.3+ anyway)

@nicolas-grekas nicolas-grekas changed the title [Routing] revert the return type for UrlGeneratorInterface::generate … [Routing] revert the return type for UrlGeneratorInterface::generate to remove null Nov 8, 2019
@fabpot
fabpot approved these changes Nov 9, 2019
@fabpot

This comment has been minimized.

Copy link
Member

fabpot commented Nov 9, 2019

Thank you @shieldo.

fabpot added a commit that referenced this pull request Nov 9, 2019
…ce::generate to remove null (shieldo)

This PR was merged into the 3.4 branch.

Discussion
----------

[Routing] revert the return type for UrlGeneratorInterface::generate to remove null

…to remove null

| Q             | A
| ------------- | ---
| Branch?       | 3.4 (only)
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| License       | MIT

Bit of a casualty of commit tennis this:

A change to add `null` here as an option for how `UrlGeneratorInterface::generate()` (rather than the concrete `UrlGenerator`) was merged in #28321, but then [reverted](90494c2) for the reason [that this could be seen as a BC break](#28321 (comment)), as the `null` return had not previously been documented (and is still not as part of the interface method docs).

However, in a subsequent change (#33252) with a wider scope, this doc change was added _back_ in order to reflect the underlying implementation as a result of a PHPStorm plugin complaining. There's no indication though of what a `null` return here though would mean, and for the same reason as the first revert (that this should be seen as a BC break), I'd like to submit this to be reverted for the 3.4 branch. (In 4.4 the `null` has already been removed.)

Having the interface indicating that this method can return `null` necessitates introducing a lot of actually redundant null checks in code that is covered by static analysis tools such as PHPStan.

Commits
-------

9f853f3 [Routing] revert the return type for UrlGeneratorInterface::generate to remove null
@fabpot fabpot merged commit 9f853f3 into symfony:3.4 Nov 9, 2019
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details
@shieldo shieldo deleted the shieldo:restore_url_generator_return_type branch Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.