Skip to content
Permalink
Browse files

CompilerExtension: configuration can also be an object in addition to…

… the array
  • Loading branch information...
dg committed Mar 15, 2019
1 parent 9bd3ebb commit 3f1cadd9d821db3e8e1928a3897339f88eaeeda6
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/DI/CompilerExtension.php
@@ -25,7 +25,7 @@ abstract class CompilerExtension
/** @var string */
protected $name;
/** @var array */
/** @var array|\stdClass */
protected $config = [];
@@ -41,19 +41,24 @@ public function setCompiler(Compiler $compiler, string $name)
/**
* @param array|object $config
* @return static
*/
public function setConfig(array $config)
public function setConfig($config)
{
if (!is_array($config) && !is_object($config)) {
throw new Nette\InvalidArgumentException;
}
$this->config = $config;
return $this;
}
/**
* Returns extension configuration.
* @return array|object
*/
public function getConfig(): array
public function getConfig()
{
return $this->config;
}

0 comments on commit 3f1cadd

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.