Skip to content

Commit 1945c66

Browse files
authored
Merge pull request #229 from andrew-demb/symfony-7
[Major release] Symfony 7. GraphQLite 8
2 parents f5c3805 + ae4511a commit 1945c66

40 files changed

+182
-290
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
install-args: ['']
15-
php-version: ['8.1']
15+
php-version: ['8.2']
1616
fail-fast: false
1717
steps:
1818
# Cancel previous runs of the same branch

Tests/Fixtures/Entities/BadClass.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

composer.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818
"require" : {
1919
"php" : ">=8.1",
2020
"ext-json": "*",
21-
"thecodingmachine/graphqlite" : "^6.0",
22-
"thecodingmachine/graphqlite-symfony-validator-bridge" : "^6.0",
21+
"thecodingmachine/graphqlite" : "^8",
22+
"thecodingmachine/graphqlite-symfony-validator-bridge": "^7.1.1",
2323
"symfony/config": "^6.4 || ^7",
2424
"symfony/console": "^6.4 || ^7",
2525
"symfony/framework-bundle": "^6.4 || ^7",
2626
"symfony/validator": "^6.4 || ^7",
2727
"symfony/translation": "^6.4 || ^7",
28-
"doctrine/annotations": "^1.13 || ^2.0.1",
2928
"symfony/psr-http-message-bridge": "^2.0 || ^7.0",
3029
"nyholm/psr7": "^1.1",
3130
"laminas/laminas-diactoros": "^2.2.2 || ^3",
@@ -42,21 +41,25 @@
4241
"composer/semver": "^3.4"
4342
},
4443
"conflict": {
45-
"mouf/classname-mapper": "<1.0.2",
4644
"symfony/event-dispatcher": "<4.3",
4745
"symfony/security-core": "<4.3",
4846
"symfony/routing": "<4.3",
4947
"phpdocumentor/type-resolver": "<1.4"
5048
},
5149
"scripts": {
52-
"phpstan": "phpstan analyse GraphQLiteBundle.php DependencyInjection/ Controller/ Resources/ Security/ -c phpstan.neon --level=7 --no-progress"
50+
"phpstan": "phpstan analyse -c phpstan.neon --level=7 --no-progress"
5351
},
5452
"suggest": {
55-
"symfony/security-bundle": "To use @Logged or @Right annotations"
53+
"symfony/security-bundle": "To use #[Logged] or #[Right] attributes"
5654
},
5755
"autoload" : {
5856
"psr-4" : {
59-
"TheCodingMachine\\GraphQLite\\Bundle\\" : ""
57+
"TheCodingMachine\\GraphQLite\\Bundle\\" : "src"
58+
}
59+
},
60+
"autoload-dev" : {
61+
"psr-4" : {
62+
"TheCodingMachine\\GraphQLite\\Bundle\\Tests\\" : "tests"
6063
}
6164
},
6265
"extra": {

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ parameters:
88
- vendor
99
- cache
1010
- .phpstan-cache
11-
- Tests
11+
- tests
1212
level: max
1313
polluteScopeWithLoopInitialAssignments: false
1414
polluteScopeWithAlwaysIterableForeach: false

phpunit.xml.dist

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,17 @@
1616
</php>
1717

1818
<testsuites>
19-
<testsuite name="Graphql controllers bundle Test Suite">
20-
<directory>./Tests/</directory>
19+
<testsuite name="GraphQLite Bundle Test Suite">
20+
<directory>./tests/</directory>
2121
</testsuite>
2222
</testsuites>
2323

2424

2525
<filter>
2626
<whitelist>
27-
<directory>./</directory>
27+
<directory>./src/</directory>
2828
<exclude>
29-
<directory>cache</directory>
30-
<directory>build</directory>
31-
<directory>./Resources</directory>
32-
<directory>./Tests</directory>
33-
<directory>./vendor</directory>
34-
<directory>./var</directory>
29+
<directory>./src/Resources</directory>
3530
</exclude>
3631
</whitelist>
3732
</filter>
File renamed without changes.

Controller/GraphQL/InvalidUserPasswordException.php renamed to src/Controller/GraphQL/InvalidUserPasswordException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ class InvalidUserPasswordException extends GraphQLException
1010
{
1111
public static function create(Exception $previous = null): self
1212
{
13-
return new self('The provided user / password is incorrect.', 401, $previous, 'Security');
13+
return new self('The provided user / password is incorrect.', 401, $previous, ['category' => 'Security']);
1414
}
1515
}

Controller/GraphQL/LoginController.php renamed to src/Controller/GraphQL/LoginController.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ public function __construct(UserProviderInterface $userProvider, UserPasswordHas
5454
$this->eventDispatcher = $eventDispatcher;
5555
}
5656

57-
/**
58-
* @Mutation()
59-
*
60-
* @phpstan-return TUser
61-
*/
57+
#[Mutation]
6258
public function login(string $userName, string $password, Request $request): UserInterface
6359
{
6460
try {
@@ -95,9 +91,7 @@ public function login(string $userName, string $password, Request $request): Use
9591
return $user;
9692
}
9793

98-
/**
99-
* @Mutation()
100-
*/
94+
#[Mutation]
10195
public function logout(Request $request): bool
10296
{
10397
$this->tokenStorage->setToken(null);

Controller/GraphQL/MeController.php renamed to src/Controller/GraphQL/MeController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ public function __construct(TokenStorageInterface $tokenStorage)
1818
$this->tokenStorage = $tokenStorage;
1919
}
2020

21-
/**
22-
* @Query()
23-
*/
21+
#[Query]
2422
public function me(): ?UserInterface
2523
{
2624
$token = $this->tokenStorage->getToken();

Controller/GraphQLiteController.php renamed to src/Controller/GraphQLiteController.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@
44
namespace TheCodingMachine\GraphQLite\Bundle\Controller;
55

66

7-
use Laminas\Diactoros\ResponseFactory;
8-
use Laminas\Diactoros\ServerRequestFactory;
9-
use Laminas\Diactoros\StreamFactory;
10-
use Laminas\Diactoros\UploadedFileFactory;
11-
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
12-
use TheCodingMachine\GraphQLite\Http\HttpCodeDecider;
13-
use TheCodingMachine\GraphQLite\Http\HttpCodeDeciderInterface;
14-
use function array_map;
157
use GraphQL\Executor\ExecutionResult;
168
use GraphQL\Server\ServerConfig;
179
use GraphQL\Server\StandardServer;
1810
use GraphQL\Upload\UploadMiddleware;
19-
use function class_exists;
20-
use function json_decode;
11+
use Laminas\Diactoros\ResponseFactory;
12+
use Laminas\Diactoros\ServerRequestFactory;
13+
use Laminas\Diactoros\StreamFactory;
14+
use Laminas\Diactoros\UploadedFileFactory;
2115
use Psr\Http\Message\ServerRequestInterface;
2216
use RuntimeException;
17+
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
2318
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
2419
use Symfony\Component\HttpFoundation\JsonResponse;
2520
use Symfony\Component\HttpFoundation\Request;
2621
use Symfony\Component\HttpFoundation\Response;
2722
use Symfony\Component\Routing\Route;
2823
use Symfony\Component\Routing\RouteCollection;
2924
use TheCodingMachine\GraphQLite\Bundle\Context\SymfonyGraphQLContext;
25+
use TheCodingMachine\GraphQLite\Http\HttpCodeDecider;
26+
use TheCodingMachine\GraphQLite\Http\HttpCodeDeciderInterface;
27+
use function array_map;
28+
use function class_exists;
29+
use function json_decode;
3030

3131
/**
3232
* Listens to every single request and forward Graphql requests to Graphql Webonix standardServer.

0 commit comments

Comments
 (0)