From ca98e2a419f1c33d98f9e93ec452e1c227cf95ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Sat, 21 Feb 2015 00:55:25 +0100 Subject: [PATCH] Fixed notice caused by missing key in array Types in lowercase could be missing so it triggered a notice before. --- WebLoader/Nette/Extension.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/WebLoader/Nette/Extension.php b/WebLoader/Nette/Extension.php index 3a3af18..7b8b208 100644 --- a/WebLoader/Nette/Extension.php +++ b/WebLoader/Nette/Extension.php @@ -147,7 +147,12 @@ private function addWebLoader(ContainerBuilder $builder, $name, $config) public function afterCompile(Nette\PhpGenerator\ClassType $class) { $meta = $class->properties['meta']; - $meta->value['types']['webloader\\loaderfactory'] = $meta->value['types']['webloader\\nette\\loaderfactory']; + if (array_key_exists('webloader\\nette\\loaderfactory', $meta->value['types'])) { + $meta->value['types']['webloader\\loaderfactory'] = $meta->value['types']['webloader\\nette\\loaderfactory']; + } + if (array_key_exists('WebLoader\\Nette\\LoaderFactory', $meta->value['types'])) { + $meta->value['types']['WebLoader\\LoaderFactory'] = $meta->value['types']['WebLoader\\Nette\\LoaderFactory']; + } $init = $class->methods['initialize']; $init->addBody('if (!class_exists(?, ?)) class_alias(?, ?);', array('WebLoader\\LoaderFactory', FALSE, 'WebLoader\\Nette\\LoaderFactory', 'WebLoader\\LoaderFactory'));