Skip to content

Commit

Permalink
Merge pull request #31 from weierophinney/feature/php-8.2-support
Browse files Browse the repository at this point in the history
Drop PHP 7 support, add PHP 8.1 and 8.2 support
  • Loading branch information
weierophinney authored Jul 11, 2023
2 parents bb7b532 + 048d542 commit e0ea083
Show file tree
Hide file tree
Showing 9 changed files with 896 additions and 917 deletions.
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,27 @@
}
},
"require": {
"php": "^7.3 || ~8.0.0 || ~8.1.0",
"laminas-api-tools/api-tools-api-problem": "^1.4.0",
"laminas-api-tools/api-tools-content-negotiation": "^1.5.0",
"laminas-api-tools/api-tools-hal": "^1.4",
"laminas-api-tools/api-tools-mvc-auth": "^1.6",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"laminas-api-tools/api-tools-api-problem": "^1.6.0",
"laminas-api-tools/api-tools-content-negotiation": "^1.8.0",
"laminas-api-tools/api-tools-hal": "^1.7",
"laminas-api-tools/api-tools-mvc-auth": "^1.8",
"laminas/laminas-eventmanager": "^3.2",
"laminas/laminas-mvc": "^2.7.14 || ^3.0.2",
"laminas/laminas-paginator": "^2.7",
"laminas/laminas-stdlib": "^2.7.8 || ^3.3",
"laminas/laminas-zendframework-bridge": "^1.0"
"laminas/laminas-stdlib": "^2.7.8 || ^3.3"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.3.0",
"laminas/laminas-escaper": "^2.5.2",
"laminas/laminas-http": "^2.5.4",
"laminas/laminas-inputfilter": "^2.7.2",
"laminas/laminas-servicemanager": "^2.7.6 || ^3.1",
"laminas/laminas-servicemanager": "^3.11",
"laminas/laminas-uri": "^2.5.2",
"laminas/laminas-validator": "^2.8.1",
"laminas/laminas-view": "^2.11.3",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.3"
"phpunit/phpunit": "^9.5.10"
},
"autoload": {
"psr-4": {
Expand Down
1,773 changes: 878 additions & 895 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Factory/OptionsListenerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Laminas\ApiTools\Rest\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ApiTools\Rest\Listener\OptionsListener;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Psr\Container\ContainerInterface;

use function array_key_exists;
use function is_array;
Expand Down
7 changes: 3 additions & 4 deletions src/Factory/RestControllerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Laminas\ApiTools\Rest\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ApiTools\Hal\Collection;
use Laminas\ApiTools\Rest\Resource;
use Laminas\ApiTools\Rest\RestController;
Expand All @@ -15,13 +14,13 @@
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Laminas\Stdlib\Parameters;
use Psr\Container\ContainerInterface;

use function array_key_exists;
use function array_keys;
use function array_merge;
use function array_unique;
use function class_exists;
use function get_class;
use function gettype;
use function in_array;
use function is_array;
Expand Down Expand Up @@ -135,11 +134,11 @@ public function __invoke(ContainerInterface $container, $requestedName, ?array $
'%s expects that the "listener" reference a service that implements '
. 'Laminas\EventManager\ListenerAggregateInterface; received %s',
__METHOD__,
is_object($listener) ? get_class($listener) : gettype($listener)
is_object($listener) ? $listener::class : gettype($listener)
));
}

$resourceIdentifiers = [get_class($listener)];
$resourceIdentifiers = [$listener::class];
if (isset($config['resource_identifiers'])) {
if (! is_array($config['resource_identifiers'])) {
$config['resource_identifiers'] = (array) $config['resource_identifiers'];
Expand Down
3 changes: 1 addition & 2 deletions src/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use function array_merge;
use function array_walk;
use function func_get_args;
use function get_class;
use function gettype;
use function is_array;
use function is_bool;
Expand Down Expand Up @@ -138,7 +137,7 @@ public function setRouteMatch($matches)
__METHOD__,
RouteMatch::class,
V2RouteMatch::class,
is_object($matches) ? get_class($matches) : gettype($matches)
is_object($matches) ? $matches::class : gettype($matches)
));
}
$this->routeMatch = $matches;
Expand Down
3 changes: 1 addition & 2 deletions src/ResourceEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Laminas\Stdlib\Parameters;
use Laminas\Stdlib\RequestInterface;

use function get_class;
use function gettype;
use function is_array;
use function is_object;
Expand Down Expand Up @@ -163,7 +162,7 @@ public function setRouteMatch($matches = null)
__METHOD__,
RouteMatch::class,
V2RouteMatch::class,
is_object($matches) ? get_class($matches) : gettype($matches)
is_object($matches) ? $matches::class : gettype($matches)
));
}
$this->routeMatch = $matches;
Expand Down
2 changes: 1 addition & 1 deletion test/ChildResourcesIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace LaminasTest\ApiTools\Rest;

use Interop\Container\ContainerInterface;
use Laminas\ApiTools\ApiProblem\View\ApiProblemRenderer;
use Laminas\ApiTools\Hal\Collection;
use Laminas\ApiTools\Hal\Collection as HalCollection;
Expand All @@ -28,6 +27,7 @@
use Laminas\View\HelperPluginManager;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Container\ContainerInterface;
use ReflectionObject;
use stdClass;

Expand Down
2 changes: 1 addition & 1 deletion test/CollectionIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace LaminasTest\ApiTools\Rest;

use Interop\Container\ContainerInterface;
use Laminas\ApiTools\ApiProblem\View\ApiProblemRenderer;
use Laminas\ApiTools\ContentNegotiation\AcceptListener;
use Laminas\ApiTools\Hal\Extractor\LinkCollectionExtractor;
Expand Down Expand Up @@ -41,6 +40,7 @@
use Laminas\View\HelperPluginManager;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Container\ContainerInterface;

use function json_decode;
use function method_exists;
Expand Down
4 changes: 2 additions & 2 deletions test/RestControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace LaminasTest\ApiTools\Rest;

use Error;
use Interop\Container\ContainerInterface;
use Laminas\ApiTools\ApiProblem\ApiProblem;
use Laminas\ApiTools\ApiProblem\ApiProblemResponse;
use Laminas\ApiTools\ApiProblem\Exception\DomainException;
Expand Down Expand Up @@ -45,6 +44,7 @@
use Laminas\View\Model\ModelInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Container\ContainerInterface;
use ReflectionMethod;
use ReflectionObject;
use stdClass;
Expand Down Expand Up @@ -981,7 +981,7 @@ public function testGetListTriggersPreAndPostEvents()
$this->assertSame(
$collection,
$test->collection,
'Expected ' . get_class($collection) . ', received ' . get_class($test->collection)
'Expected ' . $collection::class . ', received ' . get_class($test->collection)
);
}

Expand Down

0 comments on commit e0ea083

Please sign in to comment.