Skip to content

Commit

Permalink
removed usage of magic methods and properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 5, 2015
1 parent 78e780b commit 379bd41
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"php": ">=5.3.1",
"nette/neon": "~2.3",
"nette/reflection": "~2.3",
"nette/php-generator": "~2.2",
"nette/php-generator": "~2.3",
"nette/utils": "~2.3"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions src/DI/ContainerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ private function generateService($name)
}

$factoryClass = $this->generatedClasses[] = new Nette\PhpGenerator\ClassType;
$factoryClass->setName(str_replace(array('\\', '.'), '_', "{$this->generatedClasses[0]->name}_{$def->getImplement()}Impl_{$name}"))
$factoryClass->setName(str_replace(array('\\', '.'), '_', "{$this->generatedClasses[0]->getName()}_{$def->getImplement()}Impl_{$name}"))
->addImplement($def->getImplement())
->setFinal(TRUE);

Expand All @@ -598,7 +598,7 @@ private function generateService($name)
->setParameters($this->convertParameters($def->parameters))
->setBody(str_replace('$this', '$this->container', $code));

return "return new {$factoryClass->name}(\$this);";
return "return new {$factoryClass->getName()}(\$this);";
}


Expand Down
2 changes: 1 addition & 1 deletion src/DI/Extensions/ConstantsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ConstantsExtension extends Nette\DI\CompilerExtension
public function afterCompile(Nette\PhpGenerator\ClassType $class)
{
foreach ($this->getConfig() as $name => $value) {
$class->methods['initialize']->addBody('define(?, ?);', array($name, $value));
$class->getMethod('initialize')->addBody('define(?, ?);', array($name, $value));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/DI/Extensions/DIExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function loadConfiguration()

public function afterCompile(Nette\PhpGenerator\ClassType $class)
{
$initialize = $class->methods['initialize'];
$initialize = $class->getMethod('initialize');
$container = $this->getContainerBuilder();

if ($this->debugMode && $this->config['debugger']) {
Expand Down
2 changes: 1 addition & 1 deletion src/DI/Extensions/PhpExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PhpExtension extends Nette\DI\CompilerExtension

public function afterCompile(Nette\PhpGenerator\ClassType $class)
{
$initialize = $class->methods['initialize'];
$initialize = $class->getMethod('initialize');
foreach ($this->getConfig() as $name => $value) {
if (!is_scalar($value)) {
throw new Nette\InvalidStateException("Configuration value for directive '$name' is not scalar.");
Expand Down
1 change: 0 additions & 1 deletion src/DI/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,4 @@ public static function getInjectProperties(Nette\Reflection\ClassType $class, $c
return $res;
}


}

0 comments on commit 379bd41

Please sign in to comment.