-
-
src/Lunr/Core/ConfigServiceLocator.php (Diff revision 1) var_export()
can produce multi-line output. I'm not sure that's what we want to use here.Conceptually we already have a backtrace attached to the exception, we should be able to read or at least discern the value from that.
-
src/Lunr/Core/ConfigServiceLocator.php (Diff revision 1) Failed to locate object for identifier '$id'!
seems a bit nicer -
src/Lunr/Core/ConfigServiceLocator.php (Diff revision 1) We can be more strict here I think. We're allowed to add the
string
typehint in child classes, we just can't remove it.Same for the
get()
method. -
src/Lunr/Core/ConfigServiceLocator.php (Diff revision 1) No ContainerException here? Seems inconsistent
-
src/Lunr/Core/ConfigServiceLocator.php (Diff revision 1) I'm not sure we need the redirect.
locate()
is a protected method, so we can just inline it here. The only thing I'm not sure about is how potential strict typing would affectget_parameters()
. -
src/Lunr/Core/ConfigServiceLocator.php (Diff revision 1) Not possible to instantiate '{$reflection->name}'
is a bit clearer I think. -
-
-
-
-
-
-
-
-
src/Lunr/Core/ConfigServiceLocator.php (Diff revision 2) We already did the registry check when we enter the method. Executing
has()
does it again. I prefer the old version of the code. -
src/Lunr/Core/ConfigServiceLocator.php (Diff revision 2) Similar here.
has()
andget()
do redundant checks . Outside the class this may be acceptable, but inside we want a more optimized version and don't execute useless code.
-
-
src/Lunr/Core/ConfigServiceLocator.php (Diff revision 3) I think we can just replace this with a call to
load_recipe()
, and then check the cache.But also have to check the cache before calling
load_recipe()
-
-
composer.lock (Diff revision 4) composer.lock probably shouldn't be changed, considering there's no change to composer.json either
-
src/Lunr/Core/ConfigServiceLocator.php (Diff revision 4) We also need a cache check before
load_recipe()
, then we have the same logic asget()
, just without actually trying to instantiate anything.
Diff: |
Revision 5 (+250 -153)
|
---|