Skip to content

Commit

Permalink
Merge pull request #229 from andrew-demb/symfony-7
Browse files Browse the repository at this point in the history
[Major release] Symfony 7. GraphQLite 8
  • Loading branch information
andrew-demb authored Jan 3, 2025
2 parents f5c3805 + ae4511a commit 1945c66
Show file tree
Hide file tree
Showing 40 changed files with 182 additions and 290 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
install-args: ['']
php-version: ['8.1']
php-version: ['8.2']
fail-fast: false
steps:
# Cancel previous runs of the same branch
Expand Down
8 changes: 0 additions & 8 deletions Tests/Fixtures/Entities/BadClass.php

This file was deleted.

17 changes: 10 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
"require" : {
"php" : ">=8.1",
"ext-json": "*",
"thecodingmachine/graphqlite" : "^6.0",
"thecodingmachine/graphqlite-symfony-validator-bridge" : "^6.0",
"thecodingmachine/graphqlite" : "^8",
"thecodingmachine/graphqlite-symfony-validator-bridge": "^7.1.1",
"symfony/config": "^6.4 || ^7",
"symfony/console": "^6.4 || ^7",
"symfony/framework-bundle": "^6.4 || ^7",
"symfony/validator": "^6.4 || ^7",
"symfony/translation": "^6.4 || ^7",
"doctrine/annotations": "^1.13 || ^2.0.1",
"symfony/psr-http-message-bridge": "^2.0 || ^7.0",
"nyholm/psr7": "^1.1",
"laminas/laminas-diactoros": "^2.2.2 || ^3",
Expand All @@ -42,21 +41,25 @@
"composer/semver": "^3.4"
},
"conflict": {
"mouf/classname-mapper": "<1.0.2",
"symfony/event-dispatcher": "<4.3",
"symfony/security-core": "<4.3",
"symfony/routing": "<4.3",
"phpdocumentor/type-resolver": "<1.4"
},
"scripts": {
"phpstan": "phpstan analyse GraphQLiteBundle.php DependencyInjection/ Controller/ Resources/ Security/ -c phpstan.neon --level=7 --no-progress"
"phpstan": "phpstan analyse -c phpstan.neon --level=7 --no-progress"
},
"suggest": {
"symfony/security-bundle": "To use @Logged or @Right annotations"
"symfony/security-bundle": "To use #[Logged] or #[Right] attributes"
},
"autoload" : {
"psr-4" : {
"TheCodingMachine\\GraphQLite\\Bundle\\" : ""
"TheCodingMachine\\GraphQLite\\Bundle\\" : "src"
}
},
"autoload-dev" : {
"psr-4" : {
"TheCodingMachine\\GraphQLite\\Bundle\\Tests\\" : "tests"
}
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ parameters:
- vendor
- cache
- .phpstan-cache
- Tests
- tests
level: max
polluteScopeWithLoopInitialAssignments: false
polluteScopeWithAlwaysIterableForeach: false
Expand Down
13 changes: 4 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,17 @@
</php>

<testsuites>
<testsuite name="Graphql controllers bundle Test Suite">
<directory>./Tests/</directory>
<testsuite name="GraphQLite Bundle Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>


<filter>
<whitelist>
<directory>./</directory>
<directory>./src/</directory>
<exclude>
<directory>cache</directory>
<directory>build</directory>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
<directory>./var</directory>
<directory>./src/Resources</directory>
</exclude>
</whitelist>
</filter>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ class InvalidUserPasswordException extends GraphQLException
{
public static function create(Exception $previous = null): self
{
return new self('The provided user / password is incorrect.', 401, $previous, 'Security');
return new self('The provided user / password is incorrect.', 401, $previous, ['category' => 'Security']);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ public function __construct(UserProviderInterface $userProvider, UserPasswordHas
$this->eventDispatcher = $eventDispatcher;
}

/**
* @Mutation()
*
* @phpstan-return TUser
*/
#[Mutation]
public function login(string $userName, string $password, Request $request): UserInterface
{
try {
Expand Down Expand Up @@ -95,9 +91,7 @@ public function login(string $userName, string $password, Request $request): Use
return $user;
}

/**
* @Mutation()
*/
#[Mutation]
public function logout(Request $request): bool
{
$this->tokenStorage->setToken(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ public function __construct(TokenStorageInterface $tokenStorage)
$this->tokenStorage = $tokenStorage;
}

/**
* @Query()
*/
#[Query]
public function me(): ?UserInterface
{
$token = $this->tokenStorage->getToken();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
namespace TheCodingMachine\GraphQLite\Bundle\Controller;


use Laminas\Diactoros\ResponseFactory;
use Laminas\Diactoros\ServerRequestFactory;
use Laminas\Diactoros\StreamFactory;
use Laminas\Diactoros\UploadedFileFactory;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
use TheCodingMachine\GraphQLite\Http\HttpCodeDecider;
use TheCodingMachine\GraphQLite\Http\HttpCodeDeciderInterface;
use function array_map;
use GraphQL\Executor\ExecutionResult;
use GraphQL\Server\ServerConfig;
use GraphQL\Server\StandardServer;
use GraphQL\Upload\UploadMiddleware;
use function class_exists;
use function json_decode;
use Laminas\Diactoros\ResponseFactory;
use Laminas\Diactoros\ServerRequestFactory;
use Laminas\Diactoros\StreamFactory;
use Laminas\Diactoros\UploadedFileFactory;
use Psr\Http\Message\ServerRequestInterface;
use RuntimeException;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use TheCodingMachine\GraphQLite\Bundle\Context\SymfonyGraphQLContext;
use TheCodingMachine\GraphQLite\Http\HttpCodeDecider;
use TheCodingMachine\GraphQLite\Http\HttpCodeDeciderInterface;
use function array_map;
use function class_exists;
use function json_decode;

/**
* Listens to every single request and forward Graphql requests to Graphql Webonix standardServer.
Expand Down
File renamed without changes.
Loading

0 comments on commit 1945c66

Please sign in to comment.