Skip to content

Commit 070e14b

Browse files
committed
[ErrorHandler] Improve an error message
1 parent ab3e426 commit 070e14b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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 = [];

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)