@@ -259,7 +259,7 @@ protected function triggerException($eventName, ArrayObject $args, mixed &$resul
259259 public function hasPlugin (Plugin \PluginInterface $ plugin )
260260 {
261261 $ registry = $ this ->getPluginRegistry ();
262- return $ registry ->contains ($ plugin );
262+ return $ registry ->offsetExists ($ plugin );
263263 }
264264
265265 /**
@@ -268,15 +268,15 @@ public function hasPlugin(Plugin\PluginInterface $plugin)
268268 public function addPlugin (Plugin \PluginInterface $ plugin , $ priority = 1 )
269269 {
270270 $ registry = $ this ->getPluginRegistry ();
271- if ($ registry ->contains ($ plugin )) {
271+ if ($ registry ->offsetExists ($ plugin )) {
272272 throw new Exception \LogicException (sprintf (
273273 'Plugin of type "%s" already registered ' ,
274274 $ plugin ::class
275275 ));
276276 }
277277
278278 $ plugin ->attach ($ this ->getEventManager (), $ priority );
279- $ registry ->attach ($ plugin );
279+ $ registry ->offsetSet ($ plugin );
280280
281281 return $ this ;
282282 }
@@ -287,9 +287,9 @@ public function addPlugin(Plugin\PluginInterface $plugin, $priority = 1)
287287 public function removePlugin (Plugin \PluginInterface $ plugin )
288288 {
289289 $ registry = $ this ->getPluginRegistry ();
290- if ($ registry ->contains ($ plugin )) {
290+ if ($ registry ->offsetExists ($ plugin )) {
291291 $ plugin ->detach ($ this ->getEventManager ());
292- $ registry ->detach ($ plugin );
292+ $ registry ->offsetUnset ($ plugin );
293293 }
294294 return $ this ;
295295 }
0 commit comments