-
Notifications
You must be signed in to change notification settings - Fork 19
Code refactor with the new zend-servicemanager of ZF3 #2
Code refactor with the new zend-servicemanager of ZF3 #2
Conversation
@@ -45,7 +58,7 @@ class AdapterPluginManager extends AbstractPluginManager | |||
* @return void | |||
* @throws Exception\RuntimeException if invalid | |||
*/ | |||
public function validatePlugin($plugin) | |||
public function validate($plugin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you define the protected class property $instanceOf
and assign it the value of Adapter\AdapterInterface::class
, you can get rid of this method entirely. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but in this way we are going to change the exception from Zend\Serializer\Exception\RuntimeException
to Zend\ServiceManager\Exception\InvalidServiceException
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's okay, and intended; it ensures that the exceptions thrown from plugin managers are consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it ensures we're throwing container-interop exceptions, which we should be doing from plugin managers and factories and whatnot at this point; makes it easier for implementations to catch such exceptions and report them.
Code refactor with the new zend-servicemanager of ZF3
This PR contains the code refactor using the new zend-servicemanager of ZF3.