Skip to content

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

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
Nov 9, 2019

Conversation

shieldo
Copy link
Contributor

@shieldo 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.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

(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
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
@shieldo shieldo deleted the restore_url_generator_return_type branch November 11, 2019 10:17
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.

4 participants