Skip to content

Commit f022045

Browse files
committed
minor #58094 Use Stringable whenever possible (fabpot)
This PR was merged into the 7.2 branch. Discussion ---------- Use Stringable whenever possible | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | n/a | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Commits ------- 06b49968a5 Use Stringable whenever possible
2 parents 10517c1 + 4250a77 commit f022045

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Generator/UrlGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ protected function doGenerate(array $variables, array $defaults, array $requirem
266266
if ($vars = get_object_vars($v)) {
267267
array_walk_recursive($vars, $caster);
268268
$v = $vars;
269-
} elseif (method_exists($v, '__toString')) {
269+
} elseif ($v instanceof \Stringable) {
270270
$v = (string) $v;
271271
}
272272
}

0 commit comments

Comments
 (0)