Skip to content

Commit

Permalink
Add support for PHP 8.2 (#4)
Browse files Browse the repository at this point in the history
* Add support for PHP 8.2

* Fix Deptrac dependency

* Update rector

* Fix php-cs
  • Loading branch information
alexander-schranz authored May 22, 2023
1 parent d859d47 commit a0e7ec9
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 20 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ jobs:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.1'
coverage: false
dependency-versions: 'highest'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.2'
coverage: true
dependency-versions: 'highest'
env:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "proprietary",
"type": "sulu-bundle",
"require": {
"php": "8.0.* || 8.1.*",
"php": "8.0.* || 8.1.* || 8.2.*",
"doctrine/dbal": "^3.3",
"doctrine/doctrine-bundle": "^2.5",
"doctrine/orm": "^2.11",
Expand Down Expand Up @@ -32,8 +32,8 @@
"phpstan/phpstan-symfony": "^1.1",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^9.5",
"qossmic/deptrac-shim": "^0.23.0",
"rector/rector": "^0.13.10",
"qossmic/deptrac-shim": "^0.24.0 || ^1.0",
"rector/rector": "^0.15.0",
"schranz/test-generator": "^0.4",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/css-selector": "^5.4 || ^6.0",
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

// basic rules
$rectorConfig->importNames();
$rectorConfig->importShortClasses();
$rectorConfig->importShortClasses(false);

$rectorConfig->sets([
SetList::CODE_QUALITY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Sulu\Messenger\Infrastructure\Symfony\HttpKernel;

use RuntimeException;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\FileLocator;
Expand Down Expand Up @@ -53,7 +52,7 @@ public function getConfiguration(array $config, ContainerBuilder $container): Co
public function prepend(ContainerBuilder $container): void
{
if (!$container->hasExtension('framework')) {
throw new RuntimeException(\sprintf('The "%s" bundle requires "framework" bundle.', self::ALIAS));
throw new \RuntimeException(\sprintf('The "%s" bundle requires "framework" bundle.', self::ALIAS));
}

$container->prependExtensionConfig(
Expand Down
8 changes: 3 additions & 5 deletions tests/Traits/PrivatePropertyTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

namespace Sulu\Messenger\Tests\Traits;

use ReflectionClass;
use ReflectionException;
use ReflectionProperty;

trait PrivatePropertyTrait
{
Expand All @@ -15,7 +13,7 @@ trait PrivatePropertyTrait
*/
protected static function getPrivateProperty(object $object, string $propertyName)
{
$reflection = new ReflectionClass($object);
$reflection = new \ReflectionClass($object);
$propertyReflection = $reflection->getProperty($propertyName);
$propertyReflection->setAccessible(true);

Expand All @@ -24,7 +22,7 @@ protected static function getPrivateProperty(object $object, string $propertyNam

protected static function setPrivateProperty(object $object, string $propertyName, mixed $value): void
{
$reflection = new ReflectionClass($object);
$reflection = new \ReflectionClass($object);
try {
$propertyReflection = $reflection->getProperty($propertyName);
self::setValue($propertyReflection, $object, $value);
Expand All @@ -37,7 +35,7 @@ protected static function setPrivateProperty(object $object, string $propertyNam
}
}

private static function setValue(ReflectionProperty $propertyReflection, object $object, mixed $value): void
private static function setValue(\ReflectionProperty $propertyReflection, object $object, mixed $value): void
{
$propertyReflection->setAccessible(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use stdClass;
use Sulu\Messenger\Infrastructure\Symfony\Messenger\FlushMiddleware\DoctrineFlushMiddleware;
use Sulu\Messenger\Infrastructure\Symfony\Messenger\FlushMiddleware\EnableFlushStamp;
use Symfony\Component\DependencyInjection\Container;
Expand Down Expand Up @@ -81,7 +80,7 @@ public function testGetSubscribedServices(): void

private function createEnvelope(): Envelope
{
return new Envelope(new stdClass());
return new Envelope(new \stdClass());
}

private function createStack(): StackMiddleware
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use stdClass;
use Sulu\Messenger\Infrastructure\Symfony\Messenger\LockMiddleware\LockMiddleware;
use Sulu\Messenger\Infrastructure\Symfony\Messenger\LockMiddleware\LockStamp;
use Symfony\Component\DependencyInjection\Container;
Expand Down Expand Up @@ -90,7 +89,7 @@ public function testGetSubscribedServices(): void

private function createEnvelope(): Envelope
{
return new Envelope(new stdClass());
return new Envelope(new \stdClass());
}

private function createStack(): StackMiddleware
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

namespace Sulu\Messenger\Tests\Unit\Common\Infrastructure\Symfony\Messenger\UnpackExceptionMiddleware;

use LogicException;
use PHPUnit\Framework\TestCase;
use stdClass;
use Sulu\Messenger\Infrastructure\Symfony\Messenger\UnpackExceptionMiddleware\UnpackExceptionMiddleware;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Exception\HandlerFailedException;
Expand Down Expand Up @@ -39,12 +37,12 @@ public function testHandleDefault(): void

public function testHandleException(): void
{
$this->expectException(LogicException::class);
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('Specific unpacked exception.');

$envelope = $this->createEnvelope();
$stack = $this->createStack(function () use ($envelope): never {
throw new HandlerFailedException($envelope, [new LogicException('Specific unpacked exception.')]);
throw new HandlerFailedException($envelope, [new \LogicException('Specific unpacked exception.')]);
});

$this->assertSame(
Expand All @@ -55,7 +53,7 @@ public function testHandleException(): void

private function createEnvelope(): Envelope
{
return new Envelope(new stdClass());
return new Envelope(new \stdClass());
}

private function createStack(callable $handler = null): StackMiddleware
Expand Down

0 comments on commit a0e7ec9

Please sign in to comment.