Skip to content

Commit

Permalink
CompilerExtension: configuration can also be an object in addition to…
Browse files Browse the repository at this point in the history
… the array
  • Loading branch information
dg committed Mar 17, 2019
1 parent 9bd3ebb commit 02ef205
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/DI/CompilerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract class CompilerExtension
/** @var string */
protected $name;

/** @var array */
/** @var array|object */
protected $config = [];


Expand All @@ -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;
}
Expand Down

0 comments on commit 02ef205

Please sign in to comment.