Skip to content

Commit 4e7b5cd

Browse files
committed
Fix phpstan errors
1 parent 77d8710 commit 4e7b5cd

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ parameters:
44
- src/
55
- tests/
66
ignoreErrors:
7-
- '~^Call to method getWrappedType\(\) on an unknown class GraphQL\\Type\\Definition\\callback.$~'
87
- '~^Property GraphQL\\Doctrine\\Annotation\\Field::\$type \(string\) does not accept GraphQL\\Type\\Definition\\~'
98
- '~^Instanceof between string and GraphQL\\Type\\Definition\\Type will always evaluate to false\.$~'
109
- '~^Parameter #1 \$wrappedType of static method GraphQL\\Type\\Definition\\Type::~'

src/DefaultFieldResolver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ final class DefaultFieldResolver
1919
{
2020
public function __invoke($source, array $args, $context, ResolveInfo $info)
2121
{
22+
/** @var string $fieldName */
2223
$fieldName = $info->fieldName;
2324
$property = null;
2425

src/Factory/FilteredQueryBuilderFactory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace GraphQL\Doctrine\Factory;
66

77
use Doctrine\ORM\EntityManager;
8+
use Doctrine\ORM\EntityRepository;
89
use Doctrine\ORM\Mapping\ClassMetadata;
910
use Doctrine\ORM\QueryBuilder;
1011
use GraphQL\Doctrine\Definition\Operator\AbstractOperator;
@@ -55,7 +56,9 @@ public function create(string $className, array $filter, array $sorting): QueryB
5556
$this->dqlConditions = [];
5657
$this->uniqueJoins = [];
5758

58-
$this->queryBuilder = $this->entityManager->getRepository($className)->createQueryBuilder($alias);
59+
/** @var EntityRepository $repository */
60+
$repository = $this->entityManager->getRepository($className);
61+
$this->queryBuilder = $repository->createQueryBuilder($alias);
5962
$metadata = $this->entityManager->getClassMetadata($className);
6063
$type = $this->types->getFilter($className);
6164

tests/Blog/Types/DateTimeType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function parseLiteral($valueNode, array $variables = null)
1717
// Note: throwing GraphQL\Error\Error vs \UnexpectedValueException to benefit from GraphQL
1818
// error location in query:
1919
if (!($valueNode instanceof StringValueNode)) {
20-
throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, [$valueNode]);
20+
throw new Error('Query error: Can only parse strings got: ' . $valueNode->kind, $valueNode);
2121
}
2222

2323
return $valueNode->value;

tests/DefaultFieldResolverTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ final class DefaultFieldResolverTest extends \PHPUnit\Framework\TestCase
1616
{
1717
public function providerDefaultFieldResolver(): array
1818
{
19-
$entityID = new class() extends EntityID
20-
{
19+
$entityID = new class() extends EntityID {
2120
public function __construct()
2221
{
2322
}

0 commit comments

Comments
 (0)