Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
graphql
Commits
fbd42916
Unverified
Commit
fbd42916
authored
Dec 21, 2021
by
klausi
Committed by
GitHub
Dec 21, 2021
Browse files
test(phpstan): Update PHPStan and dependencies (
#1257
)
parent
31498a8d
Changes
13
Hide whitespace changes
Inline
Side-by-side
.github/workflows/testing.yml
View file @
fbd42916
...
...
@@ -13,12 +13,21 @@ jobs:
strategy
:
fail-fast
:
false
matrix
:
php-versions
:
[
'
7.3'
,
'
7.4'
,
'
8.0'
,
'
8.1'
]
php-versions
:
[
'
7.3'
,
'
7.4'
]
phpstan
:
[
'
1'
]
drupal-core
:
[
'
9.3.x'
]
include
:
# Extra run to also test on latest Drupal 8 and PHP 7.2.
-
php-versions
:
'
7.2'
drupal-core
:
'
8.9.x'
phpstan
:
'
1'
# PHPStan is broken on PHP 8.0 and 8.1 for now, don't run it there.
-
php-versions
:
'
8.0'
drupal-core
:
'
9.3.x'
phpstan
:
'
0'
-
php-versions
:
'
8.1'
drupal-core
:
'
9.3.x'
phpstan
:
'
0'
steps
:
-
name
:
Checkout Drupal core
uses
:
actions/checkout@v2
...
...
@@ -80,11 +89,11 @@ jobs:
webonyx/graphql-php:^14.8 \
drupal/typed_data:^1.0 \
drupal/redirect:^1.6 \
phpstan/phpstan:^
0.12.88
\
mglaman/phpstan-drupal:^
0
.12
.8
\
phpstan/phpstan-deprecation-rules:^
0.12.2
\
jangregor/phpstan-prophecy:^0.
8
\
phpstan/phpstan-phpunit:^
0.12
phpstan/phpstan:^
1.2.0
\
mglaman/phpstan-drupal:^
1
.1
.
2 \
phpstan/phpstan-deprecation-rules:^
1.0.0
\
jangregor/phpstan-prophecy:^
1.
0.
0
\
phpstan/phpstan-phpunit:^
1.0.0
# We install Coder separately because updating did not work in the local
# Drupal vendor dir.
...
...
@@ -103,7 +112,7 @@ jobs:
-
name
:
Run PHPStan
run
:
|
cd modules/graphql && ../../vendor/bin/phpstan analyse
if [[ ${{ matrix.phpstan }} == "1" ]]; then
cd modules/graphql && ../../vendor/bin/phpstan analyse
; fi
-
name
:
Run PHPCS
run
:
|
...
...
examples/graphql_example/src/Wrappers/QueryConnection.php
View file @
fbd42916
...
...
@@ -30,6 +30,7 @@ class QueryConnection {
public
function
total
()
{
$query
=
clone
$this
->
query
;
$query
->
range
(
NULL
,
NULL
)
->
count
();
/** @var int */
return
$query
->
execute
();
}
...
...
phpstan.neon
View file @
fbd42916
...
...
@@ -90,6 +90,31 @@ parameters:
count: 1
path: src/Plugin/SchemaExtensionPluginInterface.php
-
message: "#^Method Drupal\\\\graphql\\\\Plugin\\\\PersistedQueryPluginInterface\\:\\:setWeight\\(\\) has no return type specified\\.$#"
count: 1
path: src/Plugin/PersistedQueryPluginInterface.php
-
message: "#^Method Drupal\\\\graphql\\\\Plugin\\\\SchemaExtensionPluginInterface\\:\\:registerResolvers\\(\\) has no return type specified\\.$#"
count: 1
path: src/Plugin/SchemaExtensionPluginInterface.php
-
message: "#^Method Drupal\\\\graphql\\\\Entity\\\\ServerInterface\\:\\:addPersistedQueryInstance\\(\\) has no return type specified\\.$#"
count: 1
path: src/Entity/ServerInterface.php
-
message: "#^Method Drupal\\\\graphql\\\\Entity\\\\ServerInterface\\:\\:removeAllPersistedQueryInstances\\(\\) has no return type specified\\.$#"
count: 1
path: src/Entity/ServerInterface.php
-
message: "#^Method Drupal\\\\graphql\\\\Entity\\\\ServerInterface\\:\\:removePersistedQueryInstance\\(\\) has no return type specified\\.$#"
count: 1
path: src/Entity/ServerInterface.php
-
message: "#^Unable to resolve the template type ExpectedType in call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\)$#"
count: 1
...
...
src/Entity/Server.php
View file @
fbd42916
...
...
@@ -517,6 +517,8 @@ class Server extends ConfigEntityBase implements ServerInterface {
*/
protected
function
getValidationRules
()
{
return
function
(
OperationParams
$params
,
DocumentNode
$document
,
$operation
)
{
// queryId is not documented properly in the library, it can be NULL.
// @phpstan-ignore-next-line
if
(
isset
(
$params
->
queryId
))
{
// Assume that pre-parsed documents are already validated. This allows
// us to store pre-validated query documents e.g. for persisted queries
...
...
src/EventSubscriber/CurrentLanguageResetTrait.php
View file @
fbd42916
...
...
@@ -19,7 +19,7 @@ trait CurrentLanguageResetTrait {
/**
* The language negotiator.
*
* @var \Drupal\language\LanguageNegotiatorInterface
* @var \Drupal\language\LanguageNegotiatorInterface
|null
*/
protected
$languageNegotiator
;
...
...
src/GraphQL/Utility/DeferredUtility.php
View file @
fbd42916
...
...
@@ -14,7 +14,7 @@ class DeferredUtility {
/**
* The promise adapter.
*
* @var \GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter
* @var \GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter
|null
*/
public
static
$promiseAdapter
;
...
...
src/Plugin/GraphQL/DataProducer/Entity/Fields/Image/ImageDerivative.php
View file @
fbd42916
...
...
@@ -101,6 +101,9 @@ class ImageDerivative extends DataProducerPluginBase implements ContainerFactory
$width
=
$entity
->
width
;
$height
=
$entity
->
height
;
// @todo Not sure why PHPStan complains here, this should be refactored to
// check the entity properties first.
// @phpstan-ignore-next-line
if
(
empty
(
$width
)
||
empty
(
$height
))
{
/** @var \Drupal\Core\Image\ImageInterface $image */
$image
=
\
Drupal
::
service
(
'image.factory'
)
->
get
(
$entity
->
getFileUri
());
...
...
src/Plugin/GraphQL/DataProducer/Taxonomy/TermFieldAutocomplete.php
View file @
fbd42916
...
...
@@ -75,14 +75,14 @@ class TermFieldAutocomplete extends DataProducerPluginBase implements ContainerF
/**
* The term storage.
*
* @var \Drupal\taxonomy\TermStorageInterface
* @var \Drupal\taxonomy\TermStorageInterface
|null
*/
protected
$termStorage
;
/**
* The term type.
*
* @var \Drupal\Core\Entity\ContentEntityTypeInterface
* @var \Drupal\Core\Entity\ContentEntityTypeInterface
|null
*/
protected
$termType
;
...
...
src/Plugin/LanguageNegotiation/OperationLanguageNegotiation.php
View file @
fbd42916
...
...
@@ -33,7 +33,7 @@ class OperationLanguageNegotiation extends LanguageNegotiationMethodBase {
/**
* The current execution context.
*
* @var \Drupal\graphql\GraphQL\Execution\ResolveContext
* @var \Drupal\graphql\GraphQL\Execution\ResolveContext
|null
*/
protected
static
$context
;
...
...
tests/modules/graphql_resolver_builder_test/src/TypedData/Definition/TreeDefinition.php
View file @
fbd42916
...
...
@@ -14,7 +14,7 @@ class TreeDefinition extends ComplexDataDefinitionBase {
* {@inheritdoc}
*/
public
function
getPropertyDefinitions
()
{
if
(
!
isset
(
$this
->
propertyDefinitions
))
{
if
(
empty
(
$this
->
propertyDefinitions
))
{
$info
=
&
$this
->
propertyDefinitions
;
$info
[
'left'
]
=
self
::
create
(
'tree'
)
...
...
tests/src/Kernel/DataProducer/EntityReferenceTest.php
View file @
fbd42916
...
...
@@ -10,7 +10,6 @@ use Drupal\Core\Entity\EntityInterface;
use
Drupal\node\Entity\NodeType
;
use
Drupal\node\Entity\Node
;
use
Drupal\user\UserInterface
;
use
Drupal\Tests\graphql\Traits\QueryResultAssertionTrait
;
/**
* Data producers Field test class.
...
...
@@ -19,7 +18,6 @@ use Drupal\Tests\graphql\Traits\QueryResultAssertionTrait;
*/
class
EntityReferenceTest
extends
GraphQLTestBase
{
use
EntityReferenceTestTrait
;
use
QueryResultAssertionTrait
;
/**
* {@inheritdoc}
...
...
tests/src/Kernel/GraphQLTestBase.php
View file @
fbd42916
...
...
@@ -26,6 +26,13 @@ abstract class GraphQLTestBase extends KernelTestBase {
use
MockingTrait
;
use
UserCreationTrait
;
/**
* The server under test.
*
* @var \Drupal\graphql\Entity\Server|null
*/
protected
$server
;
/**
* {@inheritdoc}
*/
...
...
tests/src/Traits/QueryResultAssertionTrait.php
View file @
fbd42916
...
...
@@ -19,7 +19,7 @@ trait QueryResultAssertionTrait {
protected
$server
;
/**
* @var \Drupal\Core\Render\RendererInterface
* @var \Drupal\Core\Render\RendererInterface
|null
*/
protected
$renderer
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment