Skip to content

Commit

Permalink
feat: migrate to Laminas
Browse files Browse the repository at this point in the history
Runs the Laminas migration tooling over the project.
  • Loading branch information
weierophinney committed Feb 3, 2020
1 parent 637be3f commit 7bec5c3
Show file tree
Hide file tree
Showing 16 changed files with 87 additions and 86 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ You can enable a write-through cache for all pages served by the

To create cache configuration, create a `phly-simple-page` configuration key in
your configuration, with a `cache` subkey, and configuration suitable for
`Zend\Cache\StorageFactory::factory`. As an example, the following would setup
`Laminas\Cache\StorageFactory::factory`. As an example, the following would setup
filesystem caching:

```php
Expand Down
4 changes: 2 additions & 2 deletions bin/phly-simple-page
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use PackageVersions\Versions;
use RuntimeException;
use Symfony\Component\Console\Application as ConsoleApplication;
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
use Zend\Mvc\Application as MvcApplication;
use Zend\Stdlib\ArrayUtils;
use Laminas\Mvc\Application as MvcApplication;
use Laminas\Stdlib\ArrayUtils;

// Setup/verify autoloading
$cwd = getcwd();
Expand Down
21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@
},
"require": {
"php": "^5.6 || ^7.0",
"zendframework/zend-cache": "^2.9",
"zendframework/zend-console": "^2.8",
"zendframework/zend-eventmanager": "^2.6.4 || ^3.2.1",
"zendframework/zend-http": "^2.9.1",
"zendframework/zend-mvc": "^2.7.9 || ^3.1.1",
"zendframework/zend-stdlib": "^2.7.7 || ^3.2.1",
"zendframework/zend-view": "^2.9.1",
"laminas/laminas-cache": "^2.9",
"laminas/laminas-console": "^2.8",
"laminas/laminas-eventmanager": "^2.6.4 || ^3.2.1",
"laminas/laminas-http": "^2.9.1",
"laminas/laminas-mvc": "^2.7.9 || ^3.1.1",
"laminas/laminas-stdlib": "^2.7.7 || ^3.2.1",
"laminas/laminas-view": "^2.9.1",
"symfony/console": "^3.4 || ^4.0 || ^5.0",
"ocramius/package-versions": "^1.4"
"ocramius/package-versions": "^1.4",
"laminas/laminas-dependency-plugin": "^1.0"
},
"require-dev": {
"zendframework/zend-coding-standard": "~1.0.0",
"laminas/laminas-coding-standard": "~1.0.0",
"phpunit/phpunit": "^5.7.25 || ^6.4.4",
"zendframework/zend-servicemanager": "^2.7.11 || ^3.4.0"
"laminas/laminas-servicemanager": "^2.7.11 || ^3.4.0"
},
"extra": {
"zf": {
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset name="Zend Framework coding standard">
<rule ref="./vendor/zendframework/zend-coding-standard/ruleset.xml"/>
<rule ref="./vendor/laminas/laminas-coding-standard/ruleset.xml"/>

<!-- Paths to check -->
<file>src</file>
Expand Down
12 changes: 6 additions & 6 deletions src/CacheController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
namespace PhlySimplePage;

use RuntimeException;
use Zend\Cache\Storage\Adapter\AbstractAdapter as CacheAdapter;
use Zend\Cache\Storage\FlushableInterface;
use Zend\Console\Adapter\AdapterInterface as Console;
use Zend\Console\ColorInterface as Color;
use Zend\Console\Request as ConsoleRequest;
use Zend\Mvc\Controller\AbstractActionController;
use Laminas\Cache\Storage\Adapter\AbstractAdapter as CacheAdapter;
use Laminas\Cache\Storage\FlushableInterface;
use Laminas\Console\Adapter\AdapterInterface as Console;
use Laminas\Console\ColorInterface as Color;
use Laminas\Console\Request as ConsoleRequest;
use Laminas\Mvc\Controller\AbstractActionController;

/**
* @deprecated Since 1.1.0. To be removed in 2.0.0.
Expand Down
6 changes: 3 additions & 3 deletions src/CacheControllerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace PhlySimplePage;

use Zend\ServiceManager\Exception;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\Exception;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

/**
* Service factory for CacheController
Expand Down
4 changes: 2 additions & 2 deletions src/ClearCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Zend\Cache\Storage\Adapter\AbstractAdapter;
use Zend\Cache\Storage\FlushableInterface;
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
use Laminas\Cache\Storage\FlushableInterface;

class ClearCacheCommand extends Command
{
Expand Down
10 changes: 5 additions & 5 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace PhlySimplePage;

use Zend\Mvc\Application;
use Zend\Stdlib\ResponseInterface;
use Laminas\Mvc\Application;
use Laminas\Stdlib\ResponseInterface;

/**
* Module class for use with ZF2
Expand Down Expand Up @@ -48,7 +48,7 @@ public function getConsoleUsage()
* "PhlySimplePage\PageCacheListener" service and attach it to the
* event manager.
*
* @param \Zend\Mvc\MvcEvent $e
* @param \Laminas\Mvc\MvcEvent $e
*/
public function onBootstrap($e)
{
Expand All @@ -69,7 +69,7 @@ public function onBootstrap($e)
* Registers a post-dispatch listener on the controller if the matched
* controller is the PageController from this module.
*
* @param \Zend\Mvc\MvcEvent $e
* @param \Laminas\Mvc\MvcEvent $e
*/
public function onRoutePost($e)
{
Expand All @@ -95,7 +95,7 @@ public function onRoutePost($e)
* If the controller result is a 404 status, triggers the application
* dispatch.error event.
*
* @param \Zend\Mvc\MvcEvent $e
* @param \Laminas\Mvc\MvcEvent $e
*/
public function onDispatchPost($e)
{
Expand Down
14 changes: 7 additions & 7 deletions src/PageCacheListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace PhlySimplePage;

use Zend\Cache\Storage\Adapter\AbstractAdapter;
use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\ListenerAggregateInterface;
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
use Laminas\EventManager\EventManagerInterface;
use Laminas\EventManager\ListenerAggregateInterface;

/**
* Event listener implementing page level caching for pages provided by the
Expand All @@ -23,7 +23,7 @@ class PageCacheListener implements ListenerAggregateInterface
protected $cache;

/**
* @var \Zend\Stdlib\CallbackHandler[]
* @var \Laminas\Stdlib\CallbackHandler[]
*/
protected $listeners = [];

Expand Down Expand Up @@ -90,8 +90,8 @@ public function detach(EventManagerInterface $events)
* response; if not, we continue, but indicate that we should cache the
* response on completion.
*
* @param \Zend\Mvc\MvcEvent $e
* @return null|\Zend\Stdlib\ResponseInterface
* @param \Laminas\Mvc\MvcEvent $e
* @return null|\Laminas\Stdlib\ResponseInterface
*/
public function onRoutePost($e)
{
Expand Down Expand Up @@ -137,7 +137,7 @@ public function onRoutePost($e)
*
* Checks to see if we should cache the current request; if so, it does.
*
* @param \Zend\Mvc\MvcEvent $e
* @param \Laminas\Mvc\MvcEvent $e
*/
public function onFinishPost($e)
{
Expand Down
4 changes: 2 additions & 2 deletions src/PageCacheListenerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace PhlySimplePage;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

/**
* Service factory for page cache service
Expand Down
10 changes: 5 additions & 5 deletions src/PageCacheService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

namespace PhlySimplePage;

use Zend\Cache\StorageFactory;
use Zend\ServiceManager\Exception;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Laminas\Cache\StorageFactory;
use Laminas\ServiceManager\Exception;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

/**
* Service factory for cache adapter used for page caching
Expand All @@ -21,7 +21,7 @@ class PageCacheService implements FactoryInterface
* Create and return cache storage adapter
*
* @param ServiceLocatorInterface $services
* @return \Zend\Cache\Storage\Adapter\AbstractAdapter
* @return \Laminas\Cache\Storage\Adapter\AbstractAdapter
* @throws Exception\ServiceNotCreatedException
*/
public function createService(ServiceLocatorInterface $services)
Expand Down
34 changes: 17 additions & 17 deletions src/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@

namespace PhlySimplePage;

use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManager;
use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface;
use Zend\Http\Response as HttpResponse;
use Zend\Mvc\Application;
use Zend\Mvc\Exception;
use Zend\Mvc\InjectApplicationEventInterface;
use Zend\Mvc\MvcEvent;
use Zend\Mvc\Router\RouteMatch as LegacyRouteMatch;
use Zend\Router\RouteMatch;
use Zend\Stdlib\DispatchableInterface;
use Zend\Stdlib\RequestInterface;
use Zend\Stdlib\ResponseInterface;
use Zend\View\Model\ViewModel;
use Laminas\EventManager\EventInterface;
use Laminas\EventManager\EventManager;
use Laminas\EventManager\EventManagerAwareInterface;
use Laminas\EventManager\EventManagerInterface;
use Laminas\Http\Response as HttpResponse;
use Laminas\Mvc\Application;
use Laminas\Mvc\Exception;
use Laminas\Mvc\InjectApplicationEventInterface;
use Laminas\Mvc\MvcEvent;
use Laminas\Mvc\Router\RouteMatch as LegacyRouteMatch;
use Laminas\Router\RouteMatch;
use Laminas\Stdlib\DispatchableInterface;
use Laminas\Stdlib\RequestInterface;
use Laminas\Stdlib\ResponseInterface;
use Laminas\View\Model\ViewModel;

/**
* Page controller
Expand Down Expand Up @@ -51,7 +51,7 @@ class PageController implements
*
* - PhlySimplePage\PageController
* - current class name
* - Zend\Stdlib\DispatchableInterface
* - Laminas\Stdlib\DispatchableInterface
*
* It also registers the onDispatch method as the default handler for the
* dispatch event.
Expand All @@ -64,7 +64,7 @@ public function setEventManager(EventManagerInterface $events)
$events->setIdentifiers([
__CLASS__,
get_class($this),
'Zend\Stdlib\DispatchableInterface',
'Laminas\Stdlib\DispatchableInterface',
]);
$events->attach('dispatch', [$this, 'onDispatch']);
$this->events = $events;
Expand Down
16 changes: 8 additions & 8 deletions test/ModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
use PhlySimplePage\PageController;
use PHPUnit\Framework\TestCase;
use stdClass;
use Zend\Cache\Storage\Adapter\AbstractAdapter;
use Zend\EventManager\EventManager;
use Zend\EventManager\SharedEventManager;
use Zend\EventManager\StaticEventManager;
use Zend\EventManager\Test\EventListenerIntrospectionTrait;
use Zend\Mvc\Application;
use Zend\Mvc\MvcEvent;
use Zend\ServiceManager\ServiceLocatorInterface;
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
use Laminas\EventManager\EventManager;
use Laminas\EventManager\SharedEventManager;
use Laminas\EventManager\StaticEventManager;
use Laminas\EventManager\Test\EventListenerIntrospectionTrait;
use Laminas\Mvc\Application;
use Laminas\Mvc\MvcEvent;
use Laminas\ServiceManager\ServiceLocatorInterface;

/**
* Unit tests for PhlySimplePage\Module
Expand Down
20 changes: 10 additions & 10 deletions test/PageControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

use PhlySimplePage\PageController;
use PHPUnit\Framework\TestCase;
use Zend\Http\Response as HttpResponse;
use Zend\Mvc\Application;
use Zend\Mvc\Exception\DomainException;
use Zend\Mvc\MvcEvent;
use Zend\Stdlib\Request;
use Laminas\Http\Response as HttpResponse;
use Laminas\Mvc\Application;
use Laminas\Mvc\Exception\DomainException;
use Laminas\Mvc\MvcEvent;
use Laminas\Stdlib\Request;

/**
* Unit tests for PhlySimplePage\PageController
Expand All @@ -31,17 +31,17 @@ public function setUp()

public function testIsEventManagerAware()
{
$this->assertInstanceOf('Zend\EventManager\EventManagerAwareInterface', $this->controller);
$this->assertInstanceOf('Laminas\EventManager\EventManagerAwareInterface', $this->controller);
}

public function testIsDispatchable()
{
$this->assertInstanceOf('Zend\Stdlib\DispatchableInterface', $this->controller);
$this->assertInstanceOf('Laminas\Stdlib\DispatchableInterface', $this->controller);
}

public function testIsEventInjectable()
{
$this->assertInstanceOf('Zend\Mvc\InjectApplicationEventInterface', $this->controller);
$this->assertInstanceOf('Laminas\Mvc\InjectApplicationEventInterface', $this->controller);
}

public function testRaisesExceptionOnDispatchIfEventDoesNotContainRouteMatch()
Expand Down Expand Up @@ -82,7 +82,7 @@ public function testReturnsViewModelWithTemplateFromRouteMatchOnSuccess()
$request = new Request();
$this->controller->dispatch($request);
$result = $this->event->getResult();
$this->assertInstanceOf('Zend\View\Model\ModelInterface', $result);
$this->assertInstanceOf('Laminas\View\Model\ModelInterface', $result);
$this->assertEquals('this/template', $result->getTemplate());
}

Expand All @@ -93,7 +93,7 @@ public function testSetsLayoutTemplateIfLayoutFromRouteMatchIsSet()
$request = new Request();
$this->controller->dispatch($request);
$layoutViewModel = $this->event->getViewModel();
$this->assertInstanceOf('Zend\View\Model\ModelInterface', $layoutViewModel);
$this->assertInstanceOf('Laminas\View\Model\ModelInterface', $layoutViewModel);
$this->assertEquals('this/layout', $layoutViewModel->getTemplate());
}
}
4 changes: 2 additions & 2 deletions test/RouteMatchCreationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace PhlySimplePageTest;

use Zend\Mvc\Router\RouteMatch as LegacyRouteMatch;
use Zend\Router\RouteMatch;
use Laminas\Mvc\Router\RouteMatch as LegacyRouteMatch;
use Laminas\Router\RouteMatch;

trait RouteMatchCreationTrait
{
Expand Down
10 changes: 5 additions & 5 deletions test/TestAsset/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace PhlySimplePageTest\TestAsset;

use Zend\EventManager\EventManager;
use Zend\EventManager\EventManagerInterface;
use Zend\Mvc\ApplicationInterface;
use Laminas\EventManager\EventManager;
use Laminas\EventManager\EventManagerInterface;
use Laminas\Mvc\ApplicationInterface;

/**
* Application stub for testing purposes
Expand All @@ -24,8 +24,8 @@ public function setEventManager(EventManagerInterface $events)
$events->setIdentifiers([
__CLASS__,
get_class($this),
'Zend\Mvc\Application',
'Zend\Mvc\ApplicationInterface',
'Laminas\Mvc\Application',
'Laminas\Mvc\ApplicationInterface',
]);
$this->events = $events;
return $this;
Expand Down

0 comments on commit 7bec5c3

Please sign in to comment.