Skip to content

Commit d23e0e8

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 266bf98 + e99cd42 commit d23e0e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Compiler/CheckTypeDeclarationsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ private function checkType(Definition $checkedDefinition, mixed $value, \Reflect
274274
return;
275275
}
276276

277-
if ('string' === $type && method_exists($class, '__toString')) {
277+
if ('string' === $type && $class instanceof \Stringable) {
278278
return;
279279
}
280280

0 commit comments

Comments
 (0)