Skip to content
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
16 changes: 9 additions & 7 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.3', '7.4', '8.0']
php-versions: ['7.3', '7.4', '8.0', '8.1']
drupal-core: ['9.5.x']
phpstan: ['0']
include:
# We only need to run PHPStan once on the latest PHP version.
- php-versions: '8.1'
drupal-core: '9.5.x'
phpstan: '1'
# Extra run to also test on latest Drupal 10 and PHP 8.1.
# Extra runs to also test on latest Drupal 10.
- php-versions: '8.1'
drupal-core: '10.0.x'
phpstan: '0'
# We only need to run PHPStan once on the latest PHP version.
- php-versions: '8.2'
drupal-core: '10.0.x'
phpstan: '1'
steps:
- name: Checkout Drupal core
uses: actions/checkout@v3
Expand Down Expand Up @@ -110,7 +110,9 @@ jobs:
SIMPLETEST_DB: "sqlite://localhost/:memory:"

- name: Run PHPStan
run: if [[ ${{ matrix.phpstan }} == "1" ]]; then cd modules/graphql && ../../vendor/bin/phpstan analyse; fi
# phpstan-drupal bug, so we remove 1 stub file
# https://github.com/mglaman/phpstan-drupal/issues/509
run: if [[ ${{ matrix.phpstan }} == "1" ]]; then rm vendor/mglaman/phpstan-drupal/stubs/Drupal/Core/Field/FieldItemList.stub && cd modules/graphql && ../../vendor/bin/phpstan analyse; fi

- name: Run PHPCS
run: |
Expand Down
10 changes: 0 additions & 10 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ parameters:
# Drupal allows object property access to custom fields, so we cannot fix
# that.
- "#^Access to an undefined property Drupal\\\\#"
# PHPUnit deprecation warnings in Drupal 9 that we don't care about.
- "#^Method Symfony\\\\Contracts\\\\EventDispatcher\\\\EventDispatcherInterface\\:\\:dispatch\\(\\) invoked with 2 parameters, 1 required\\.$#"
# Drupal allows object property access to custom fields, so we cannot fix
# that.
- "#^Property Drupal\\\\.+ \\(Drupal\\\\Core\\\\Field\\\\FieldItemListInterface\\) does not accept .+\\.$#"
# Incomplete type doc comments in Drupal core that we have to ignore.
-
message: "#^Method Drupal\\\\graphql\\\\Plugin\\\\LanguageNegotiation\\\\OperationLanguageNegotiation\\:\\:getLangcode\\(\\) should return string but returns false\\.$#"
count: 1
path: src/Plugin/LanguageNegotiation/OperationLanguageNegotiation.php
# We forgot to use return type hints on some interfaces, cannot be changed
# in stable 4.0.
# @todo use return type hints everywhere for 5.0.
Expand Down
7 changes: 1 addition & 6 deletions src/GraphQL/Execution/Executor.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,7 @@ protected function cacheWrite($prefix, CacheableExecutionResult $result) {
* @see \Drupal\Core\Cache\CacheBackendInterface::set()
*/
protected function maxAgeToExpire($maxAge) {
/* @todo Can be removed when D9 support is dropped. In D9
* \Drupal\Core\Http\RequestStack is used here for forward compatibility,
* but phpstan thinks it's \Symfony\Component\HttpFoundation\RequestStack
* which doesn't have getMainRequest(), but in Drupal10 (Symfony 6) it has.
*/
/* @phpstan-ignore-next-line */
// @todo Can be removed when D9 support is dropped.
$time = $this->requestStack->getMainRequest()->server->get('REQUEST_TIME');
return ($maxAge === Cache::PERMANENT) ? Cache::PERMANENT : (int) $time + $maxAge;
}
Expand Down
1 change: 0 additions & 1 deletion src/Plugin/GraphQL/DataProducer/DataProducerProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ protected function cacheWrite($prefix, $value, FieldContext $field): void {
* @see \Drupal\Core\Cache\CacheBackendInterface::set()
*/
protected function maxAgeToExpire($maxAge) {
/* @phpstan-ignore-next-line */
$time = $this->requestStack->getMainRequest()->server->get('REQUEST_TIME');
return ($maxAge === Cache::PERMANENT) ? Cache::PERMANENT : (int) $time + $maxAge;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ public function resolve(FileInterface $entity = NULL, $style, RefinableCacheable
$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());
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Traits/QueryResultAssertionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private function assertResultErrors(ExecutionResult $result, array $expected): v
while ($original_error->getPrevious() !== NULL) {
$original_error = $original_error->getPrevious();
}
$unexpected[] = "Error message: ${error_message}\n Originated in: {$original_error->getFile()}:{$original_error->getLine()}";
$unexpected[] = "Error message: {$error_message}\n Originated in: {$original_error->getFile()}:{$original_error->getLine()}";
}
}

Expand Down