From d8ae694eee9f2107ad84c7b7153fd285bd74a6d9 Mon Sep 17 00:00:00 2001 From: Alessandro Chitolina Date: Wed, 17 Apr 2024 16:22:51 +0200 Subject: [PATCH] fix(cs): fixed code style for 7.4 --- composer.json | 4 ++-- lib/Transport/Dbal/DbalTransport.php | 4 +--- lib/Transport/Dbal/DbalTransportFactory.php | 14 ++++++++------ lib/Transport/Mongo/MongoTransport.php | 4 +--- lib/Transport/Mongo/MongoTransportFactory.php | 2 ++ .../Adapter/Serializer/MessengerSerializerTest.php | 5 +++++ 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 254eeea..c9c9b39 100644 --- a/composer.json +++ b/composer.json @@ -15,8 +15,8 @@ "kcs/serializer": "^2.0 || ^3.0 || ^4.0", "mongodb/mongodb": "^1.4", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^10.0", - "ramsey/uuid": "^4.7", + "phpunit/phpunit": "^9.0 || ^10.0", + "ramsey/uuid": "^4.0", "ramsey/uuid-doctrine": "^2.0", "refugis/doctrine-extra": "^2.2 || ^3.0", "roave/security-advisories": "dev-master", diff --git a/lib/Transport/Dbal/DbalTransport.php b/lib/Transport/Dbal/DbalTransport.php index 1c9d8a3..7211477 100644 --- a/lib/Transport/Dbal/DbalTransport.php +++ b/lib/Transport/Dbal/DbalTransport.php @@ -29,9 +29,7 @@ class DbalTransport implements TransportInterface, ListableReceiverInterface, Me /** @var array $options */ private array $options; - /** - * @param array $options - */ + /** @param array $options */ public function __construct(Connection $connection, ?SerializerInterface $serializer = null, array $options = []) { $this->connection = $connection; diff --git a/lib/Transport/Dbal/DbalTransportFactory.php b/lib/Transport/Dbal/DbalTransportFactory.php index fca58a8..6dc9b55 100644 --- a/lib/Transport/Dbal/DbalTransportFactory.php +++ b/lib/Transport/Dbal/DbalTransportFactory.php @@ -18,8 +18,10 @@ use function array_merge; use function assert; use function explode; +use function get_class; use function gettype; use function in_array; +use function is_array; use function is_file; use function is_object; use function is_string; @@ -28,9 +30,9 @@ use function Safe\parse_url; use function Safe\preg_replace; use function sprintf; -use function substr; use function strpos; use function strrev; +use function substr; use function substr_count; use const PATHINFO_EXTENSION; @@ -56,9 +58,7 @@ class DbalTransportFactory implements TransportFactoryInterface /** @var ManagerRegistryV2|ManagerRegistryV3|null */ private $managerRegistry; - /** - * @param ManagerRegistryV2|ManagerRegistryV3|null $managerRegistry - */ + /** @param ManagerRegistryV2|ManagerRegistryV3|null $managerRegistry */ public function __construct($managerRegistry = null) { if ($managerRegistry !== null && ! $managerRegistry instanceof ManagerRegistryV2 && ! $managerRegistry instanceof ManagerRegistryV3) { @@ -101,10 +101,12 @@ public function createTransport(string $dsn, array $options, SerializerInterface $path = substr($path, 1); } - if ($params['scheme'] === 'sqlite' || + if ( + $params['scheme'] === 'sqlite' || $params['scheme'] === 'sqlite3' || $params['scheme'] === 'pdo-sqlite' || - $params['scheme'] === 'pdo-sqlite3') { + $params['scheme'] === 'pdo-sqlite3' + ) { // SQLite has a little different handling. First we should determine the filename. $databaseName = $path; $tableName = 'messenger'; diff --git a/lib/Transport/Mongo/MongoTransport.php b/lib/Transport/Mongo/MongoTransport.php index cb3968f..ae8826a 100644 --- a/lib/Transport/Mongo/MongoTransport.php +++ b/lib/Transport/Mongo/MongoTransport.php @@ -22,9 +22,7 @@ class MongoTransport implements TransportInterface, ListableReceiverInterface, M private MongoReceiver $receiver; private MongoSender $sender; - /** - * @param array $options - */ + /** @param array $options */ public function __construct(Client $client, ?SerializerInterface $serializer = null, array $options = []) { $this->collection = $client->{$options['database_name']}->{$options['collection_name']}; diff --git a/lib/Transport/Mongo/MongoTransportFactory.php b/lib/Transport/Mongo/MongoTransportFactory.php index f08662c..9de8730 100644 --- a/lib/Transport/Mongo/MongoTransportFactory.php +++ b/lib/Transport/Mongo/MongoTransportFactory.php @@ -11,7 +11,9 @@ use Symfony\Component\Messenger\Transport\TransportInterface; use function array_merge; +use function assert; use function explode; +use function is_array; use function parse_str; use function Safe\parse_url; use function Safe\substr; diff --git a/tests/Adapter/Serializer/MessengerSerializerTest.php b/tests/Adapter/Serializer/MessengerSerializerTest.php index d724694..0fbef71 100644 --- a/tests/Adapter/Serializer/MessengerSerializerTest.php +++ b/tests/Adapter/Serializer/MessengerSerializerTest.php @@ -2,6 +2,7 @@ namespace Kcs\MessengerExtra\Tests\Adapter\Serializer; +use Composer\InstalledVersions; use Kcs\MessengerExtra\Adapter\Serializer\MessengerSerializer; use Kcs\MessengerExtra\Tests\Fixtures\DummyMessage; use Kcs\Serializer\DeserializationContext; @@ -32,6 +33,10 @@ protected function setUp(): void self::markTestSkipped('Kcs serializer is not installed.'); } + if (version_compare(InstalledVersions::getVersion('kcs/serializer'), '4.3.0', '<')) { + self::markTestSkipped('Kcs serializer adapter cannot be tested against the current version.'); + } + $this->serializer = SerializerBuilder::create()->build(); $this->messengerSerializer = new MessengerSerializer($this->serializer); }