This behaver happens in javascript too, under certain conditions.
De: Alan <[email protected]>
Enviada: 5 de abril de 2020 19:38
Para: [email protected]
Assunto: PHP Navigator breaks on small valid file.
This one is interesting (NB 11.3 Win 10). The navigator breaks on the code
below, but only under a very strange set of conditions that appear to be
related to the alternate use of ${service} rather than {$service} in the throw
message.
Sometimes the navigation window works, but if I change the name of the argument
to Example::example in the function declaration, navigation goes blank.
If I change the key "Access" in the declaration of Example::$exampleStatic,
navigation comes back, unless I change the argument again.
Other than the blank navigation I'm getting no indication of errors. I've seen
this in two projects, the original and in a scratch project I used to isolate
the problem. Can anyone reproduce this?
<?php
namespace Example;
class Example
{
private static $exampleStatic = [
'Access' => Access\NullAccess::class,
];
protected static function example(string $service)
{
if (!array_key_exists($service, self::$exampleStatic)) {
throw new \RuntimeException(
"Service ${service} must be one of "
. implode(', ', array_keys(self::$exampleStatic))
);
}
}
}