Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'cs/zendframework/zendframework#7000-zend-modulemanager-…
Browse files Browse the repository at this point in the history
…psr2-compliance' into develop

Close zendframework/zendframework#7000
Forward port zendframework/zendframework#7000
  • Loading branch information
Ocramius committed Dec 11, 2014
156 parents d0a434a + 1e3d7e8 + 774f1ec + fbd9c42 + 25f7da3 + 9fb11da + c2e87c3 + 62f83fa + cec8933 + d240b5c + 940c8ec + 3f85108 + 2e38381 + 027f505 + 5a2ba91 + 823b2d4 + 05c2a86 + fe05cd7 + 1009849 + e109317 + 4dff7e8 + ce0c75d + 6a82230 + 215e77c + 7e16a91 + 2493ed4 + 7ab2816 + 3d2db08 + 6fea908 + aad063e + 06319a5 + aee1ae3 + 412f870 + 9b0f1d4 + e8236b3 + 3e482af + 84d85f9 + 2edbf66 + 7b83fea + ae75c15 + 56429a2 + 3463608 + a990d75 + ed0260a + 40ce9ee + 540e95d + a1f3efa + b138336 + 0ac8011 + 498f096 + a002c09 + a72d069 + d696070 + 95b016c + f72f2a8 + 63f9aa4 + c62eb22 + 56ff1e4 + 17753e6 + 261ddba + 9c23ce8 + d2ea716 + 8a38d20 + 29c3c53 + 9681f39 + 7dc76e1 + 7e1a689 + f52efc3 + 5400ef9 + 2de31e5 + 5ef1929 + 5d57927 + fb86f9e + a0d3c0d + 754d50b + 9ae8ef7 + 80bb476 + 7a4072e + 1b4e215 + 9e453d7 + 1f0f6c3 + 512d4f8 + 702eefc + 1f67b00 + 7233001 + 4244857 + 163015b + fd694bc + a17a889 + 6aea729 + 1946426 + 0177483 + 27a94da + 8afdcae + 8e4ac91 + d060a98 + 725a039 + 4dc194c + 246b9e4 + 5207d60 + dbe0e62 + 429b268 + d48dc13 + afcf71c + 64397cc + 48ea5ac + b4afa2a + 11643c5 + cd431ca + 51b7c50 + 82247be + d2994aa + eaf4e29 + eeb69a6 + 3e3fff3 + c0a95c9 + 961798f + 57ae4ec + a4fa631 + 259684b + b38977d + 1a640d1 + e064a96 + 3913f14 + fe5e75d + 3085bbe + 8e7f807 + 09e57f8 + fd510c1 + 80c8682 + fc0c293 + 497c115 + 49df818 + d645847 + ee12220 + 9b92152 + 9059103 + a7a5529 + be06b37 + 590c66e + df27e78 + 1e31131 + adb430e + 1c9aa26 + 7abe866 + dfe045d + 1b4822b + ae1f9f3 + 986e6d4 + 6424a7a + 15f1b17 + 8a9ab31 + 3b54f16 + 3cf7727 + 7c7afe3 + c0abb59 commit 7a22a35
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 37 deletions.
29 changes: 20 additions & 9 deletions src/Listener/ConfigListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,14 @@ protected function addConfigPaths($paths, $type)

if (!is_array($paths)) {
throw new Exception\InvalidArgumentException(
sprintf('Argument passed to %::%s() must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
__CLASS__, __METHOD__, gettype($paths))
sprintf(
'Argument passed to %::%s() must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
__CLASS__,
__METHOD__,
gettype($paths)
)
);
}

Expand All @@ -310,8 +314,12 @@ protected function addConfigPath($path, $type)
{
if (!is_string($path)) {
throw new Exception\InvalidArgumentException(
sprintf('Parameter to %s::%s() must be a string; %s given.',
__CLASS__, __METHOD__, gettype($path))
sprintf(
'Parameter to %s::%s() must be a string; %s given.',
__CLASS__,
__METHOD__,
gettype($path)
)
);
}
$this->paths[] = array('type' => $type, 'path' => $path);
Expand All @@ -332,9 +340,12 @@ protected function addConfig($key, $config)

if (!is_array($config)) {
throw new Exception\InvalidArgumentException(
sprintf('Config being merged must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.', gettype($config))
sprintf(
'Config being merged must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
gettype($config)
)
);
}

Expand Down
48 changes: 32 additions & 16 deletions src/Listener/ListenerOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ public function setModulePaths($modulePaths)
{
if (!is_array($modulePaths) && !$modulePaths instanceof Traversable) {
throw new Exception\InvalidArgumentException(
sprintf('Argument passed to %s::%s() must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
__CLASS__, __METHOD__, gettype($modulePaths))
sprintf(
'Argument passed to %s::%s() must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
__CLASS__,
__METHOD__,
gettype($modulePaths)
)
);
}

Expand Down Expand Up @@ -130,10 +134,14 @@ public function setConfigGlobPaths($configGlobPaths)
{
if (!is_array($configGlobPaths) && !$configGlobPaths instanceof Traversable) {
throw new Exception\InvalidArgumentException(
sprintf('Argument passed to %s::%s() must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
__CLASS__, __METHOD__, gettype($configGlobPaths))
sprintf(
'Argument passed to %s::%s() must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
__CLASS__,
__METHOD__,
gettype($configGlobPaths)
)
);
}

Expand All @@ -152,10 +160,14 @@ public function setConfigStaticPaths($configStaticPaths)
{
if (!is_array($configStaticPaths) && !$configStaticPaths instanceof Traversable) {
throw new Exception\InvalidArgumentException(
sprintf('Argument passed to %s::%s() must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
__CLASS__, __METHOD__, gettype($configStaticPaths))
sprintf(
'Argument passed to %s::%s() must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
__CLASS__,
__METHOD__,
gettype($configStaticPaths)
)
);
}

Expand Down Expand Up @@ -185,10 +197,14 @@ public function setExtraConfig($extraConfig)
{
if (!is_array($extraConfig) && !$extraConfig instanceof Traversable) {
throw new Exception\InvalidArgumentException(
sprintf('Argument passed to %s::%s() must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
__CLASS__, __METHOD__, gettype($extraConfig))
sprintf(
'Argument passed to %s::%s() must be an array, '
. 'implement the Traversable interface, or be an '
. 'instance of Zend\Config\Config. %s given.',
__CLASS__,
__METHOD__,
gettype($extraConfig)
)
);
}

Expand Down
22 changes: 14 additions & 8 deletions src/ModuleEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ public function getModuleName()
public function setModuleName($moduleName)
{
if (!is_string($moduleName)) {
throw new Exception\InvalidArgumentException(sprintf(
'%s expects a string as an argument; %s provided'
,__METHOD__, gettype($moduleName)
));
throw new Exception\InvalidArgumentException(
sprintf(
'%s expects a string as an argument; %s provided',
__METHOD__,
gettype($moduleName)
)
);
}
// Performance tweak, don't add it as param.
$this->moduleName = $moduleName;
Expand Down Expand Up @@ -92,10 +95,13 @@ public function getModule()
public function setModule($module)
{
if (!is_object($module)) {
throw new Exception\InvalidArgumentException(sprintf(
'%s expects a module object as an argument; %s provided'
,__METHOD__, gettype($module)
));
throw new Exception\InvalidArgumentException(
sprintf(
'%s expects a module object as an argument; %s provided',
__METHOD__,
gettype($module)
)
);
}
// Performance tweak, don't add it as param.
$this->module = $module;
Expand Down
11 changes: 7 additions & 4 deletions src/ModuleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,13 @@ public function setModules($modules)
if (is_array($modules) || $modules instanceof Traversable) {
$this->modules = $modules;
} else {
throw new Exception\InvalidArgumentException(sprintf(
'Parameter to %s\'s %s method must be an array or implement the Traversable interface',
__CLASS__, __METHOD__
));
throw new Exception\InvalidArgumentException(
sprintf(
'Parameter to %s\'s %s method must be an array or implement the Traversable interface',
__CLASS__,
__METHOD__
)
);
}
return $this;
}
Expand Down

0 comments on commit 7a22a35

Please sign in to comment.