Skip to content

Commit 8b00851

Browse files
committed
minor symfony#59899 [ErrorHandler] Improve an error message (fabpot)
This PR was merged into the 7.3 branch. Discussion ---------- [ErrorHandler] Improve an error message | Q | A | ------------- | --- | Branch? | 7.3 | 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 I got this error message this morning and I was confused. Commits ------- 126f556 [ErrorHandler] Improve an error message
2 parents 3590ca3 + 126f556 commit 8b00851

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Symfony/Component/ErrorHandler/ErrorEnhancer/UndefinedFunctionErrorEnhancer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ public function enhance(\Throwable $error): ?\Throwable
4747
if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
4848
$functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
4949
$namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
50-
$message = \sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
50+
$message = \sprintf('Attempted to call undefined function "%s" from namespace "%s".', $functionName, $namespacePrefix);
5151
} else {
5252
$functionName = $fullyQualifiedFunctionName;
53-
$message = \sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
53+
$message = \sprintf('Attempted to call undefined function "%s" from the global namespace.', $functionName);
5454
}
5555

5656
$candidates = [];

src/Symfony/Component/ErrorHandler/Tests/ErrorEnhancer/UndefinedFunctionErrorEnhancerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ public static function provideUndefinedFunctionData()
3939
return [
4040
[
4141
'Call to undefined function test_namespaced_function()',
42-
"Attempted to call function \"test_namespaced_function\" from the global namespace.\nDid you mean to call \"\\symfony\\component\\errorhandler\\tests\\errorenhancer\\test_namespaced_function\"?",
42+
"Attempted to call undefined function \"test_namespaced_function\" from the global namespace.\nDid you mean to call \"\\symfony\\component\\errorhandler\\tests\\errorenhancer\\test_namespaced_function\"?",
4343
],
4444
[
4545
'Call to undefined function Foo\\Bar\\Baz\\test_namespaced_function()',
46-
"Attempted to call function \"test_namespaced_function\" from namespace \"Foo\\Bar\\Baz\".\nDid you mean to call \"\\symfony\\component\\errorhandler\\tests\\errorenhancer\\test_namespaced_function\"?",
46+
"Attempted to call undefined function \"test_namespaced_function\" from namespace \"Foo\\Bar\\Baz\".\nDid you mean to call \"\\symfony\\component\\errorhandler\\tests\\errorenhancer\\test_namespaced_function\"?",
4747
],
4848
[
4949
'Call to undefined function foo()',
50-
'Attempted to call function "foo" from the global namespace.',
50+
'Attempted to call undefined function "foo" from the global namespace.',
5151
],
5252
[
5353
'Call to undefined function Foo\\Bar\\Baz\\foo()',
54-
'Attempted to call function "foo" from namespace "Foo\Bar\Baz".',
54+
'Attempted to call undefined function "foo" from namespace "Foo\Bar\Baz".',
5555
],
5656
];
5757
}

0 commit comments

Comments
 (0)