[Debug] made order of suggestions predictable in error messages
This commit is contained in:
parent
7affb71196
commit
23acc24015
@ -80,6 +80,7 @@ class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
|
||||
}
|
||||
|
||||
if ($candidates) {
|
||||
sort($candidates);
|
||||
$message .= ' Did you mean to call: '.implode(', ', array_map(function ($val) {
|
||||
return '"'.$val.'"';
|
||||
}, $candidates)).'?';
|
||||
|
@ -45,6 +45,7 @@ class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
|
||||
}
|
||||
|
||||
if ($candidates) {
|
||||
sort($candidates);
|
||||
$message .= sprintf(' Did you mean to call: "%s"?', implode('", "', $candidates));
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ class UndefinedMethodFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
'file' => 'foo.php',
|
||||
'message' => 'Call to undefined method SplObjectStorage::offsetFet()',
|
||||
),
|
||||
'Attempted to call method "offsetFet" on class "SplObjectStorage" in foo.php line 12. Did you mean to call: "offsetSet", "offsetUnset", "offsetGet"?',
|
||||
'Attempted to call method "offsetFet" on class "SplObjectStorage" in foo.php line 12. Did you mean to call: "offsetGet", "offsetSet", "offsetUnset"?',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user