Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to allow Symfony 7 and test on PHP 8.3 #180

Merged
merged 6 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ jobs:
symfony-version: '6.*'
composer-flags: ''
es-version: '8.2.0'
# PHP 8.3, latest SF 7, ES 8
- php-version: '8.3'
symfony-version: '7.*'
composer-flags: ''
es-version: '8.2.0'
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -120,16 +125,21 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: '8.1'
- php-version: '8.3'
symfony-version: '6.*'
composer-flags: ''
os-version: 1.3.6
os-image: opensearchproject/opensearch:1.3.6
- php-version: '8.1'
- php-version: '8.3'
symfony-version: '6.*'
composer-flags: ''
os-version: 2.3.0
os-image: opensearchproject/opensearch:2.3.0
- php-version: '8.3'
symfony-version: '7.*'
composer-flags: ''
os-version: 2.3.0
os-image: opensearchproject/opensearch:2.3.0
services:
search-server:
image: ${{ matrix.os-image }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Main features:
- Symfony HttpClient compatible transport (**optional**);
- Symfony support (**optional**):
- See dedicated [chapter](#usage-in-symfony);
- Tested with Symfony 5.4 to 6;
- Tested with Symfony 5.4 to 7;
- Symfony Messenger Handler support (with or without spool);

> [!IMPORTANT]
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
"phpdocumentor/reflection-docblock": "^4.4|^5.0",
"ruflin/elastica": "^7.0",
"symfony/deprecation-contracts": "^2.4 || ^3.0",
"symfony/property-access": "^5.4 || ^6.0",
"symfony/property-info": "^5.4 || ^6.0",
"symfony/serializer": "^5.4 || ^6.0",
"symfony/yaml": "^5.4 || ^6.0"
"symfony/property-access": "^5.4 || ^6.0 || ^7.0",
"symfony/property-info": "^5.4 || ^6.0 || ^7.0",
"symfony/serializer": "^5.4 || ^6.0 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.17.0",
"jane-php/json-schema": "^7.4",
"jane-php/json-schema-runtime": "^7.4",
"phpstan/phpstan": "^1.9",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/framework-bundle": "^5.4.17 || ^6.0",
"symfony/http-client": "^5.4 || ^6.0",
"symfony/http-foundation": "^5.4 || ^6.0",
"symfony/messenger": "^5.4 || ^6.0",
"symfony/phpunit-bridge": "^6.2.3"
"symfony/framework-bundle": "^5.4.17 || ^6.0 || ^7.0",
"symfony/http-client": "^5.4 || ^6.0 || ^7.0",
"symfony/http-foundation": "^5.4 || ^6.0 || ^7.0",
"symfony/messenger": "^5.4 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^6.2.3 || ^7.0"
},
"conflict": {
"nikic/php-parser": "<4.7"
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<server name="SHELL_VERBOSITY" value="-1" />
<server name="KERNEL_CLASS" value="JoliCode\Elastically\Tests\Symfony\TestKernel"/>
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=11"/> <!-- @see https://github.com/janephp/janephp/issues/727 -->
<server name="SYMFONY_PHPUNIT_REQUIRE" value="nikic/php-parser:^4" />
</php>

<listeners>
Expand Down
4 changes: 3 additions & 1 deletion src/Bridge/Symfony/ElasticallyBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ElasticallyBundle extends Bundle {}
class ElasticallyBundle extends Bundle
{
}
4 changes: 3 additions & 1 deletion src/Messenger/IndexationRequestInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@

namespace JoliCode\Elastically\Messenger;

interface IndexationRequestInterface {}
interface IndexationRequestInterface
{
}
8 changes: 4 additions & 4 deletions tests/Messenger/MemoryQueuingFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use JoliCode\Elastically\Messenger\IndexationRequest;
use JoliCode\Elastically\Messenger\MultipleIndexationRequest;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -60,7 +60,7 @@ public function testFrameworkKernelTerminateResend(): void

// Simulate Kernel Response
$dispatcher->dispatch(
new ResponseEvent(self::$kernel, new Request(), Kernel::MASTER_REQUEST, new Response()),
new ResponseEvent(self::$kernel, new Request(), Kernel::MAIN_REQUEST, new Response()),
KernelEvents::RESPONSE
);

Expand Down Expand Up @@ -94,7 +94,7 @@ public function testFrameworkKernelTerminateWithNoMessage(): void

// Simulate Kernel Response
$dispatcher->dispatch(
new ResponseEvent(self::$kernel, new Request(), Kernel::MASTER_REQUEST, new Response()),
new ResponseEvent(self::$kernel, new Request(), Kernel::MAIN_REQUEST, new Response()),
KernelEvents::RESPONSE
);

Expand All @@ -105,7 +105,7 @@ public function testFrameworkKernelTerminateWithNoMessage(): void
$this->assertCount(0, $transportBulk->getSent());
}

protected static function getContainer(): ContainerInterface
protected static function getContainer(): Container
{
if (method_exists(KernelTestCase::class, 'getContainer')) {
return parent::getContainer();
Expand Down
4 changes: 2 additions & 2 deletions tests/Messenger/TestControllerFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Messenger\Transport\InMemoryTransport;

final class TestControllerFunctionalTest extends WebTestCase
Expand Down Expand Up @@ -53,7 +53,7 @@ public function testControllerWithResponse(): void
$this->assertSame(200, $client->getResponse()->getStatusCode());
}

protected static function getContainer(): ContainerInterface
protected static function getContainer(): Container
{
if (method_exists(KernelTestCase::class, 'getContainer')) {
return parent::getContainer();
Expand Down
20 changes: 16 additions & 4 deletions tests/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,25 @@ public function testMyOwnSerializer(): void

class SearchTestDummySerializer implements SerializerInterface, DenormalizerInterface
{
public function denormalize($data, $class, $format = null, array $context = []): mixed {}
public function denormalize($data, $class, $format = null, array $context = []): mixed
{
}

public function supportsDenormalization($data, $type, $format = null, array $context = []): bool {}
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
{
}

public function serialize(mixed $data, string $format, array $context = []): string {}
public function serialize(mixed $data, string $format, array $context = []): string
{
}

public function deserialize(mixed $data, string $type, string $format, array $context = []): mixed {}
public function deserialize(mixed $data, string $type, string $format, array $context = []): mixed
{
}

public function getSupportedTypes(?string $format): array
{
}
}

class SearchTestDto
Expand Down
Loading