Skip to content

Commit

Permalink
Merge pull request #20 from ghostwriter/feature/php-8.2-support
Browse files Browse the repository at this point in the history
Feature: Support PHP 8.2
  • Loading branch information
Ocramius authored Nov 15, 2022
2 parents 0fae039 + ebfcc4f commit 3494a76
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/laminas-mkdoc-theme/
/phpunit.xml
/vendor/
.phpcs-cache
7 changes: 5 additions & 2 deletions .laminas-ci.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extensions": [
"gd"
]
}
],
"ignore_php_platform_requirements": {
"8.2": true
}
}
12 changes: 9 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,24 @@
"forum": "https://discourse.laminas.dev"
},
"config": {
"sort-packages": true
"sort-packages": true,
"platform": {
"php": "8.0.99"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"require": {
"php": "~7.4.0 || ~8.0.0 || ~8.1.0",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"laminas/laminas-servicemanager": "^3.10.0",
"laminas/laminas-stdlib": "^3.6.0",
"laminas/laminas-validator": "^2.15.1"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.3.0",
"laminas/laminas-config": "^3.7.0",
"phpunit/phpunit": "^9.3.7"
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 6 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="laminas-barcode Test Suite">
<directory>./test</directory>
<directory>test</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>

<php>
<!-- Enable this if you have installed ZendPdf on the include_path or
Expand Down
8 changes: 3 additions & 5 deletions src/ObjectPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
use Laminas\ServiceManager\Exception\InvalidServiceException;
use Laminas\ServiceManager\Factory\InvokableFactory;

use function get_class;
use function gettype;
use function is_object;
use function get_debug_type;
use function sprintf;

/**
Expand Down Expand Up @@ -147,7 +145,7 @@ public function validate($plugin)
'%s can only create instances of %s; %s is invalid',
static::class,
$this->instanceOf,
is_object($plugin) ? get_class($plugin) : gettype($plugin)
get_debug_type($plugin)
));
}
}
Expand All @@ -167,7 +165,7 @@ public function validatePlugin($plugin)
} catch (InvalidServiceException $e) {
throw new Exception\InvalidArgumentException(sprintf(
'Plugin of type %s is invalid; must extend %s',
is_object($plugin) ? get_class($plugin) : gettype($plugin),
get_debug_type($plugin),
Object\AbstractObject::class
), $e->getCode(), $e);
}
Expand Down
8 changes: 3 additions & 5 deletions src/RendererPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
use Laminas\ServiceManager\Exception\InvalidServiceException;
use Laminas\ServiceManager\Factory\InvokableFactory;

use function get_class;
use function gettype;
use function is_object;
use function get_debug_type;
use function sprintf;

/**
Expand Down Expand Up @@ -79,7 +77,7 @@ public function validate($plugin)
'%s can only create instances of %s; %s is invalid',
static::class,
$this->instanceOf,
is_object($plugin) ? get_class($plugin) : gettype($plugin)
get_debug_type($plugin)
)
);
}
Expand All @@ -101,7 +99,7 @@ public function validatePlugin($plugin)
throw new Exception\InvalidArgumentException(
sprintf(
'Plugin of type %s is invalid; must extend %s',
is_object($plugin) ? get_class($plugin) : gettype($plugin),
get_debug_type($plugin),
Renderer\AbstractRenderer::class
),
$e->getCode(),
Expand Down
6 changes: 2 additions & 4 deletions test/AssertIsGdImageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use GdImage;
use PHPUnit\Framework\Assert;

use function get_class;
use function get_debug_type;
use function get_resource_type;
use function gettype;
use function is_object;
use function is_resource;
use function sprintf;

Expand All @@ -25,7 +23,7 @@ public static function assertIsGdImage($value, string $message = ''): void
{
$message = $message ?: sprintf(
'Failed asserting that %s is a GD image',
is_object($value) ? get_class($value) : gettype($value)
get_debug_type($value)
);

if (PHP_MAJOR_VERSION === 8) {
Expand Down

0 comments on commit 3494a76

Please sign in to comment.