Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4463791

Browse files
committed
minor #34299 [Routing] revert the return type for UrlGeneratorInterface::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
2 parents 98e9fc8 + 9f853f3 commit 4463791

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface
7575
* @param mixed[] $parameters An array of parameters
7676
* @param int $referenceType The type of reference to be generated (one of the constants)
7777
*
78-
* @return string|null The generated URL
78+
* @return string The generated URL
7979
*
8080
* @throws RouteNotFoundException If the named route doesn't exist
8181
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route

0 commit comments

Comments
 (0)