From 2b0f6c45d5fc0937fff1aeab908bdb468290a8e6 Mon Sep 17 00:00:00 2001 From: Andrew Caya Date: Thu, 26 May 2016 00:47:44 -0400 Subject: [PATCH 1/7] Updated all references to the deprecated Zend\Stdlib\Hydrator classes. --- Module.php | 3 +-- .../classes/PhlyRestfully.Metadata.html | 8 +++---- .../PhlyRestfully.Plugin.HalLinks.html | 12 +++++----- docs/api/phpdoc/structure.xml | 24 +++++++++---------- docs/ref/metadata-map.rst | 2 +- src/PhlyRestfully/Metadata.php | 4 ++-- src/PhlyRestfully/MetadataMap.php | 2 +- src/PhlyRestfully/Plugin/HalLinks.php | 4 ++-- .../View/RestfulJsonRenderer.php | 2 +- 9 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Module.php b/Module.php index 34c0996a..713cb5f4 100644 --- a/Module.php +++ b/Module.php @@ -8,8 +8,7 @@ namespace PhlyRestfully; -use Zend\Stdlib\Hydrator\HydratorInterface; -use Zend\Stdlib\Hydrator\HydratorPluginManager; +use Zend\Hydrator\HydratorPluginManager; /** * ZF2 module diff --git a/docs/api/phpdoc/classes/PhlyRestfully.Metadata.html b/docs/api/phpdoc/classes/PhlyRestfully.Metadata.html index 6dbca9cc..e32b39ff 100644 --- a/docs/api/phpdoc/classes/PhlyRestfully.Metadata.html +++ b/docs/api/phpdoc/classes/PhlyRestfully.Metadata.html @@ -135,13 +135,13 @@

Returns

Retrieve the hydrator to associate with this class, if any

-
getHydrator() : null | \Zend\Stdlib\Hydrator\HydratorInterface
+
getHydrator() : null | \Zend\Hydrator\HydratorInterface

Returns

-null\Zend\Stdlib\Hydrator\HydratorInterface +null\Zend\Hydrator\HydratorInterface
@@ -253,7 +253,7 @@

Returns

Set the hydrator to use with this class

-
setHydrator(string | \Zend\Stdlib\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Metadata
+
setHydrator(string | \Zend\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Metadata
@@ -264,7 +264,7 @@

Set the hydrator to use with this class

Parameters

$hydrator

-string\Zend\Stdlib\Hydrator\HydratorInterface +string\Zend\Hydrator\HydratorInterface

Exceptions

diff --git a/docs/api/phpdoc/classes/PhlyRestfully.Plugin.HalLinks.html b/docs/api/phpdoc/classes/PhlyRestfully.Plugin.HalLinks.html index b0df9e79..f4fc32ea 100644 --- a/docs/api/phpdoc/classes/PhlyRestfully.Plugin.HalLinks.html +++ b/docs/api/phpdoc/classes/PhlyRestfully.Plugin.HalLinks.html @@ -110,7 +110,7 @@

 Methods

Map a resource class to a specific hydrator instance

-
addHydrator(string $class, \Zend\Stdlib\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Plugin\RestfulJsonRenderer
+
addHydrator(string $class, \Zend\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Plugin\RestfulJsonRenderer
@@ -121,7 +121,7 @@

$class

$hydrator

-\Zend\Stdlib\Hydrator\HydratorInterface +\Zend\Hydrator\HydratorInterface

Returns

\PhlyRestfully\Plugin\RestfulJsonRenderer
@@ -288,7 +288,7 @@

Returns

Retrieve a hydrator for a given resource

-
getHydratorForResource(object $resource) : \Zend\Stdlib\Hydrator\HydratorInterface | false
+
getHydratorForResource(object $resource) : \Zend\Hydrator\HydratorInterface | false

If the resource has a mapped hydrator, returns that hydrator. If not, and @@ -301,7 +301,7 @@

$resource

Returns

-\Zend\Stdlib\Hydrator\HydratorInterfacefalse +\Zend\Hydrator\HydratorInterfacefalse
@@ -410,14 +410,14 @@

$controller

Set the default hydrator to use if none specified for a class.

-
setDefaultHydrator(\Zend\Stdlib\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Plugin\RestfulJsonRenderer
+
setDefaultHydrator(\Zend\Hydrator\HydratorInterface $hydrator) : \PhlyRestfully\Plugin\RestfulJsonRenderer

Parameters

$hydrator

-\Zend\Stdlib\Hydrator\HydratorInterface +\Zend\Hydrator\HydratorInterface

Returns

\PhlyRestfully\Plugin\RestfulJsonRenderer
diff --git a/docs/api/phpdoc/structure.xml b/docs/api/phpdoc/structure.xml index ab64133b..d7c752a7 100644 --- a/docs/api/phpdoc/structure.xml +++ b/docs/api/phpdoc/structure.xml @@ -1327,9 +1327,9 @@ underscores.</p> Retrieve the hydrator to associate with this class, if any - + null - \Zend\Stdlib\Hydrator\HydratorInterface + \Zend\Hydrator\HydratorInterface @@ -1452,9 +1452,9 @@ underscores.</p> Set the hydrator to use with this class - + string - \Zend\Stdlib\Hydrator\HydratorInterface + \Zend\Hydrator\HydratorInterface self @@ -3691,8 +3691,8 @@ replaced with a RestfulJsonModel containing an API-Problem payload.</p> string - - \Zend\Stdlib\Hydrator\HydratorInterface + + \Zend\Hydrator\HydratorInterface \PhlyRestfully\Plugin\RestfulJsonRenderer @@ -3706,7 +3706,7 @@ replaced with a RestfulJsonModel containing an API-Problem payload.</p> $hydrator - \Zend\Stdlib\Hydrator\HydratorInterface + \Zend\Hydrator\HydratorInterface @@ -3715,8 +3715,8 @@ replaced with a RestfulJsonModel containing an API-Problem payload.</p> Set the default hydrator to use if none specified for a class. - - \Zend\Stdlib\Hydrator\HydratorInterface + + \Zend\Hydrator\HydratorInterface \PhlyRestfully\Plugin\RestfulJsonRenderer @@ -3725,7 +3725,7 @@ replaced with a RestfulJsonModel containing an API-Problem payload.</p> $hydrator - \Zend\Stdlib\Hydrator\HydratorInterface + \Zend\Hydrator\HydratorInterface @@ -3739,8 +3739,8 @@ Otherwise, a boolean false is returned.</p> object - - \Zend\Stdlib\Hydrator\HydratorInterface + + \Zend\Hydrator\HydratorInterface false diff --git a/docs/ref/metadata-map.rst b/docs/ref/metadata-map.rst index 74b30d30..da400e02 100644 --- a/docs/ref/metadata-map.rst +++ b/docs/ref/metadata-map.rst @@ -59,7 +59,7 @@ Metadata options The following options are available for metadata maps: - **hydrator**: the fully qualified class name of a hydrator, or a service name - ``Zend\Stdlib\Hydrator\HydratorPluginManager`` recognizes, to use to extract + ``Zend\Hydrator\HydratorPluginManager`` recognizes, to use to extract the resource. (**OPTIONAL**) - **identifier_name**: the resource parameter corresponding to the identifier; defaults to "id". (**OPTIONAL**) diff --git a/src/PhlyRestfully/Metadata.php b/src/PhlyRestfully/Metadata.php index ef77f8e5..0a7e8853 100644 --- a/src/PhlyRestfully/Metadata.php +++ b/src/PhlyRestfully/Metadata.php @@ -8,8 +8,8 @@ namespace PhlyRestfully; -use Zend\Stdlib\Hydrator\HydratorInterface; -use Zend\Stdlib\Hydrator\HydratorPluginManager; +use Zend\Hydrator\HydratorInterface; +use Zend\Hydrator\HydratorPluginManager; class Metadata { diff --git a/src/PhlyRestfully/MetadataMap.php b/src/PhlyRestfully/MetadataMap.php index 7f9e8e36..321cc82b 100644 --- a/src/PhlyRestfully/MetadataMap.php +++ b/src/PhlyRestfully/MetadataMap.php @@ -8,7 +8,7 @@ namespace PhlyRestfully; -use Zend\Stdlib\Hydrator\HydratorPluginManager; +use Zend\Hydrator\HydratorPluginManager; class MetadataMap { diff --git a/src/PhlyRestfully/Plugin/HalLinks.php b/src/PhlyRestfully/Plugin/HalLinks.php index 2b191f0a..2a72e73a 100644 --- a/src/PhlyRestfully/Plugin/HalLinks.php +++ b/src/PhlyRestfully/Plugin/HalLinks.php @@ -25,8 +25,8 @@ use Zend\Paginator\Paginator; use Zend\Stdlib\ArrayUtils; use Zend\Stdlib\DispatchableInterface; -use Zend\Stdlib\Hydrator\HydratorInterface; -use Zend\Stdlib\Hydrator\HydratorPluginManager; +use Zend\Hydrator\HydratorInterface; +use Zend\Hydrator\HydratorPluginManager; use Zend\View\Helper\AbstractHelper; use Zend\View\Helper\ServerUrl; use Zend\View\Helper\Url; diff --git a/src/PhlyRestfully/View/RestfulJsonRenderer.php b/src/PhlyRestfully/View/RestfulJsonRenderer.php index b91d839d..17e5e06c 100644 --- a/src/PhlyRestfully/View/RestfulJsonRenderer.php +++ b/src/PhlyRestfully/View/RestfulJsonRenderer.php @@ -15,7 +15,7 @@ use PhlyRestfully\LinkCollection; use PhlyRestfully\Plugin\HalLinks; use Zend\Paginator\Paginator; -use Zend\Stdlib\Hydrator\HydratorInterface; +use Zend\Hydrator\HydratorInterface; use Zend\View\HelperPluginManager; use Zend\View\Renderer\JsonRenderer; From 2da2c666dc44149b80b5a5ec80fb2dc9142ae66d Mon Sep 17 00:00:00 2001 From: Andrew Caya Date: Thu, 26 May 2016 00:48:58 -0400 Subject: [PATCH 2/7] Modified a method declaration for consistency. --- src/PhlyRestfully/ResourceController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhlyRestfully/ResourceController.php b/src/PhlyRestfully/ResourceController.php index bc8498ce..f8167e48 100644 --- a/src/PhlyRestfully/ResourceController.php +++ b/src/PhlyRestfully/ResourceController.php @@ -389,7 +389,7 @@ public function delete($id) return $response; } - public function deleteList() + public function deleteList($data = []) { if (!$this->isMethodAllowedForCollection()) { return $this->createMethodNotAllowedResponse($this->collectionHttpOptions); From 99d11c9b783320e8ccbbb2bccaa8c97f755048f7 Mon Sep 17 00:00:00 2001 From: Andrew Caya Date: Thu, 26 May 2016 00:51:35 -0400 Subject: [PATCH 3/7] Replaced all occurrences of the EventManager's triggerUntil method (deprecated) with its triggerEventUntil method (forwards compatible). --- src/PhlyRestfully/Resource.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/PhlyRestfully/Resource.php b/src/PhlyRestfully/Resource.php index 9a35d6be..2adc91f1 100644 --- a/src/PhlyRestfully/Resource.php +++ b/src/PhlyRestfully/Resource.php @@ -188,9 +188,9 @@ public function create($data) $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, array('data' => $data)); - $results = $events->triggerUntil($event, function($result) { + $results = $events->triggerEventUntil(function($result) { return $result instanceof ApiProblem; - }); + }, $event); $last = $results->last(); if (!is_array($last) && !is_object($last)) { return $data; @@ -229,9 +229,9 @@ public function update($id, $data) $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, compact('id', 'data')); - $results = $events->triggerUntil($event, function($result) { + $results = $events->triggerEventUntil(function($result) { return $result instanceof ApiProblem; - }); + }, $event); $last = $results->last(); if (!is_array($last) && !is_object($last)) { return $data; @@ -278,9 +278,9 @@ public function replaceList($data) }); $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, array('data' => $data)); - $results = $events->triggerUntil($event, function($result) { + $results = $events->triggerEventUntil(function($result) { return $result instanceof ApiProblem; - }); + }, $event); $last = $results->last(); if (!is_array($last) && !is_object($last)) { return $data; @@ -320,9 +320,9 @@ public function patch($id, $data) $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, compact('id', 'data')); - $results = $events->triggerUntil($event, function($result) { + $results = $events->triggerEventUntil(function($result) { return $result instanceof ApiProblem; - }); + }, $event); $last = $results->last(); if (!is_array($last) && !is_object($last)) { return $data; @@ -344,9 +344,9 @@ public function delete($id) { $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, array('id' => $id)); - $results = $events->triggerUntil($event, function($result) { + $results = $events->triggerEventUntil(function($result) { return $result instanceof ApiProblem; - }); + }, $event); $last = $results->last(); if (!is_bool($last) && !$last instanceof ApiProblem) { return false; @@ -373,9 +373,9 @@ public function deleteList($data = null) } $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, array('data' => $data)); - $results = $events->triggerUntil($event, function($result) { + $results = $events->triggerEventUntil(function($result) { return $result instanceof ApiProblem; - }); + }, $event); $last = $results->last(); if (!is_bool($last) && !$last instanceof ApiProblem) { return false; @@ -398,9 +398,9 @@ public function fetch($id) { $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, array('id' => $id)); - $results = $events->triggerUntil($event, function($result) { + $results = $events->triggerEventUntil(function($result) { return $result instanceof ApiProblem; - }); + }, $event); $last = $results->last(); if (!is_array($last) && !is_object($last)) { return false; @@ -426,9 +426,9 @@ public function fetchAll() $events = $this->getEventManager(); $params = func_get_args(); $event = $this->prepareEvent(__FUNCTION__, $params); - $results = $events->triggerUntil($event, function($result) { + $results = $events->triggerEventUntil(function($result) { return $result instanceof ApiProblem; - }); + }, $event); $last = $results->last(); if (!is_array($last) && !$last instanceof HalCollection From d96e6797100fcc707b36b250b70eb050dab73546 Mon Sep 17 00:00:00 2001 From: Andrew Caya Date: Thu, 26 May 2016 00:52:53 -0400 Subject: [PATCH 4/7] Updated the version numbers of the module's required components and added a requirement for the Zend Hydrator component. --- composer.json | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index e5b0e217..5ee62890 100644 --- a/composer.json +++ b/composer.json @@ -24,22 +24,23 @@ } ], "require": { - "php": ">=5.3.3", - "zendframework/zend-eventmanager": ">=2.2.0", - "zendframework/zend-json": ">=2.2.0", - "zendframework/zend-loader": ">=2.2.0", - "zendframework/zend-mvc": ">=2.2.0", - "zendframework/zend-paginator": ">=2.2.0", - "zendframework/zend-uri": ">=2.2.0", - "zendframework/zend-view": ">=2.2.0", - "zendframework/zend-stdlib": ">=2.2.0" + "php": "^5.5 || ^7.0", + "zendframework/zend-eventmanager": "^2.5", + "zendframework/zend-json": "^2.5", + "zendframework/zend-loader": "^2.5", + "zendframework/zend-mvc": "^2.5", + "zendframework/zend-paginator": "^2.5", + "zendframework/zend-uri": "^2.5", + "zendframework/zend-view": "^2.5", + "zendframework/zend-stdlib": "^2.5", + "zendframework/zend-hydrator": "^1.1" }, "require-dev": { - "phpunit/PHPUnit": "3.7.*", - "zendframework/zend-console": ">=2.2.0", - "zendframework/zend-http": ">=2.2.0", - "zendframework/zend-navigation": ">=2.2.0", - "zendframework/zend-servicemanager": ">=2.2.0" + "phpunit/PHPUnit": "^4.8", + "zendframework/zend-console": "^2.5", + "zendframework/zend-http": "^2.5", + "zendframework/zend-navigation": "^2.5", + "zendframework/zend-servicemanager": "^2.5" }, "autoload": { "psr-0": { From bce1022c22f9d2be033a382e386051d591de8b49 Mon Sep 17 00:00:00 2001 From: Andrew Caya Date: Thu, 26 May 2016 00:54:02 -0400 Subject: [PATCH 5/7] Added PHP 5.5, 5.6 and 7.0 as supported versions and removed PHP 5.3 and 5.4 from the support matrix. --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc7a0970..0f142153 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ language: php php: - - "5.3" - - "5.4" + - "5.5" + - "5.6" + - "7.0" before_install: - wget http://cs.sensiolabs.org/get/php-cs-fixer.phar From f7e25b14bac38ea6062018268c8026c9ef497420 Mon Sep 17 00:00:00 2001 From: Andrew Caya Date: Thu, 26 May 2016 00:57:10 -0400 Subject: [PATCH 6/7] Modified a few unit tests in order to correct a failed test (new namespace for the Zend Hydrator classes) and a couple of errors concerning a missing argument to the ControllerManager's constructor. --- test/PhlyRestfullyTest/CollectionIntegrationTest.php | 3 ++- .../Factory/ResourceControllerFactoryTest.php | 3 ++- test/PhlyRestfullyTest/ModuleTest.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/PhlyRestfullyTest/CollectionIntegrationTest.php b/test/PhlyRestfullyTest/CollectionIntegrationTest.php index 2f18989e..94a1f0a5 100644 --- a/test/PhlyRestfullyTest/CollectionIntegrationTest.php +++ b/test/PhlyRestfullyTest/CollectionIntegrationTest.php @@ -29,6 +29,7 @@ use Zend\View\HelperPluginManager; use Zend\View\Helper\ServerUrl as ServerUrlHelper; use Zend\View\Helper\Url as UrlHelper; +use Zend\ServiceManager\Config; /** * @subpackage UnitTest @@ -220,7 +221,7 @@ public function testCollectionLinksIncludeFullQueryString() public function getServiceManager() { - $controllers = new ControllerManager(); + $controllers = new ControllerManager(new Config()); $controllers->addAbstractFactory('PhlyRestfully\Factory\ResourceControllerFactory'); $services = new ServiceManager(); diff --git a/test/PhlyRestfullyTest/Factory/ResourceControllerFactoryTest.php b/test/PhlyRestfullyTest/Factory/ResourceControllerFactoryTest.php index 9b55e97d..5611cdc7 100644 --- a/test/PhlyRestfullyTest/Factory/ResourceControllerFactoryTest.php +++ b/test/PhlyRestfullyTest/Factory/ResourceControllerFactoryTest.php @@ -12,13 +12,14 @@ use PHPUnit_Framework_TestCase as TestCase; use Zend\Mvc\Controller\ControllerManager; use Zend\ServiceManager\ServiceManager; +use Zend\ServiceManager\Config; class ResourceControllerFactoryTest extends TestCase { public function setUp() { $this->services = $services = new ServiceManager(); - $this->controllers = $controllers = new ControllerManager(); + $this->controllers = $controllers = new ControllerManager(new Config()); $this->factory = $factory = new ResourceControllerFactory(); $controllers->addAbstractFactory($factory); diff --git a/test/PhlyRestfullyTest/ModuleTest.php b/test/PhlyRestfullyTest/ModuleTest.php index a951c297..8180f0e5 100644 --- a/test/PhlyRestfullyTest/ModuleTest.php +++ b/test/PhlyRestfullyTest/ModuleTest.php @@ -84,7 +84,7 @@ public function testJsonRendererFactoryInjectsDefaultHydratorIfPresentInConfig() $helpers = $services->get('ViewHelperManager'); $plugin = $helpers->get('HalLinks'); - $this->assertAttributeInstanceOf('Zend\Stdlib\Hydrator\ObjectProperty', 'defaultHydrator', $plugin); + $this->assertAttributeInstanceOf('Zend\Hydrator\ObjectProperty', 'defaultHydrator', $plugin); } public function testJsonRendererFactoryInjectsHydratorMappingsIfPresentInConfig() From fb87697c68eb93cdb5169172c64c1092c3bbed1b Mon Sep 17 00:00:00 2001 From: Andrew Caya Date: Thu, 26 May 2016 01:44:01 -0400 Subject: [PATCH 7/7] Corrected a few code styling issues. --- Module.php | 2 +- src/PhlyRestfully/Resource.php | 18 +++++++++--------- test/Bootstrap.php | 2 +- test/PhlyRestfullyTest/ResourceTest.php | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Module.php b/Module.php index 713cb5f4..d2b0a687 100644 --- a/Module.php +++ b/Module.php @@ -196,7 +196,7 @@ public function onBootstrap($e) $events = $app->getEventManager(); $events->attach('render', array($this, 'onRender'), 100); $sharedEvents = $events->getSharedManager(); - $sharedEvents->attach('PhlyRestfully\ResourceController', 'dispatch', function($e) use ($services) { + $sharedEvents->attach('PhlyRestfully\ResourceController', 'dispatch', function ($e) use ($services) { $eventManager = $e->getApplication()->getEventManager(); $eventManager->attach($services->get('PhlyRestfully\ApiProblemListener')); }, 300); diff --git a/src/PhlyRestfully/Resource.php b/src/PhlyRestfully/Resource.php index 2adc91f1..70477c31 100644 --- a/src/PhlyRestfully/Resource.php +++ b/src/PhlyRestfully/Resource.php @@ -188,7 +188,7 @@ public function create($data) $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, array('data' => $data)); - $results = $events->triggerEventUntil(function($result) { + $results = $events->triggerEventUntil(function ($result) { return $result instanceof ApiProblem; }, $event); $last = $results->last(); @@ -229,7 +229,7 @@ public function update($id, $data) $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, compact('id', 'data')); - $results = $events->triggerEventUntil(function($result) { + $results = $events->triggerEventUntil(function ($result) { return $result instanceof ApiProblem; }, $event); $last = $results->last(); @@ -263,7 +263,7 @@ public function replaceList($data) gettype($data) )); } - array_walk($data, function($value, $key) use(&$data) { + array_walk($data, function ($value, $key) use (&$data) { if (is_array($value)) { $data[$key] = (object) $value; return; @@ -278,7 +278,7 @@ public function replaceList($data) }); $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, array('data' => $data)); - $results = $events->triggerEventUntil(function($result) { + $results = $events->triggerEventUntil(function ($result) { return $result instanceof ApiProblem; }, $event); $last = $results->last(); @@ -320,7 +320,7 @@ public function patch($id, $data) $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, compact('id', 'data')); - $results = $events->triggerEventUntil(function($result) { + $results = $events->triggerEventUntil(function ($result) { return $result instanceof ApiProblem; }, $event); $last = $results->last(); @@ -344,7 +344,7 @@ public function delete($id) { $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, array('id' => $id)); - $results = $events->triggerEventUntil(function($result) { + $results = $events->triggerEventUntil(function ($result) { return $result instanceof ApiProblem; }, $event); $last = $results->last(); @@ -373,7 +373,7 @@ public function deleteList($data = null) } $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, array('data' => $data)); - $results = $events->triggerEventUntil(function($result) { + $results = $events->triggerEventUntil(function ($result) { return $result instanceof ApiProblem; }, $event); $last = $results->last(); @@ -398,7 +398,7 @@ public function fetch($id) { $events = $this->getEventManager(); $event = $this->prepareEvent(__FUNCTION__, array('id' => $id)); - $results = $events->triggerEventUntil(function($result) { + $results = $events->triggerEventUntil(function ($result) { return $result instanceof ApiProblem; }, $event); $last = $results->last(); @@ -426,7 +426,7 @@ public function fetchAll() $events = $this->getEventManager(); $params = func_get_args(); $event = $this->prepareEvent(__FUNCTION__, $params); - $results = $events->triggerEventUntil(function($result) { + $results = $events->triggerEventUntil(function ($result) { return $result instanceof ApiProblem; }, $event); $last = $results->last(); diff --git a/test/Bootstrap.php b/test/Bootstrap.php index 78338d0a..a7b8cb35 100644 --- a/test/Bootstrap.php +++ b/test/Bootstrap.php @@ -6,7 +6,7 @@ * @package PhlyRestfully */ -namespace PhlyRestfullyTest; +namespace PhlyRestfullytest; use Zend\Loader\AutoloaderFactory; use RuntimeException; diff --git a/test/PhlyRestfullyTest/ResourceTest.php b/test/PhlyRestfullyTest/ResourceTest.php index a37e492e..764ac45e 100644 --- a/test/PhlyRestfullyTest/ResourceTest.php +++ b/test/PhlyRestfullyTest/ResourceTest.php @@ -395,11 +395,11 @@ public function testEventTerminateIfApiProblemIsReturned($eventName, $args, $idI { $called = false; - $this->events->attach($eventName, function() { + $this->events->attach($eventName, function () { return new ApiProblem(400, 'Random error'); }, 10); - $this->events->attach($eventName, function() use (&$called) { + $this->events->attach($eventName, function () use (&$called) { $called = true; }, 0);