Fix PHPStan issues

This commit is contained in:
Oliver Davies 2020-09-04 20:49:23 +01:00
parent a08f93c188
commit 98fba9306f
6 changed files with 10 additions and 8 deletions

View file

@ -9,6 +9,8 @@ parameters:
checkMissingIterableValueType: false checkMissingIterableValueType: false
ignoreErrors: ignoreErrors:
- '#Call to an undefined method Drupal\\Core\\Field\\FieldItemListInterface::referencedEntities()#' - '#Call to an undefined method Drupal\\Core\\Field\\FieldItemListInterface::referencedEntities()#'
- '#Call to an undefined method Drupal\\views\\Plugin\\views\\query\\QueryPluginBase::addOrderBy().#'
- '#Call to an undefined method GuzzleHttp\\ClientInterface::post().#'
- '#Call to an undefined method Illuminate\\Support\\HigherOrderCollectionProxy::id()#' - '#Call to an undefined method Illuminate\\Support\\HigherOrderCollectionProxy::id()#'
includes: includes:
- vendor/mglaman/phpstan-drupal/extension.neon - vendor/mglaman/phpstan-drupal/extension.neon

View file

@ -31,7 +31,7 @@ final class UpdateTalkNodeBeforeSave implements EventSubscriberInterface {
return; return;
} }
/** @var \Drupal\opdavies_blog\Entity\Node\Talk $talk */ /** @var Talk $talk */
$talk = $event->getEntity(); $talk = $event->getEntity();
$this->reorderEvents($talk); $this->reorderEvents($talk);
$this->updateCreatedDate($talk); $this->updateCreatedDate($talk);

View file

@ -19,8 +19,8 @@ final class Event extends Date {
public function __construct( public function __construct(
array $configuration, array $configuration,
$pluginId, string $pluginId,
$pluginDefinition, array $pluginDefinition,
TimeInterface $time TimeInterface $time
) { ) {
parent::__construct($configuration, $pluginId, $pluginDefinition); parent::__construct($configuration, $pluginId, $pluginDefinition);
@ -42,7 +42,7 @@ final class Event extends Date {
); );
} }
public function query() { public function query(): void {
$this->ensureMyTable(); $this->ensureMyTable();
$currentDate = Carbon::parse('today')->getTimestamp(); $currentDate = Carbon::parse('today')->getTimestamp();

View file

@ -6,7 +6,7 @@ namespace Drupal\opdavies_talks\Repository;
use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\opdavies_blog\Entity\Node\Talk; use Drupal\opdavies_talks\Entity\Node\Talk;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
final class TalkRepository { final class TalkRepository {

View file

@ -30,7 +30,7 @@ final class TalkDateUpdater {
} }
} }
private function updateNextEventDate(Talk $talk) { private function updateNextEventDate(Talk $talk): void {
if (!$nextDate = $this->findNextEventDate($talk)) { if (!$nextDate = $this->findNextEventDate($talk)) {
return; return;
} }

View file

@ -5,13 +5,13 @@
* Functions to support theming in the Tailwind CSS theme. * Functions to support theming in the Tailwind CSS theme.
*/ */
use Drupal\custom\Entity\Node\Post; use Drupal\opdavies_blog\Entity\Node\Post;
/** /**
* Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK().
*/ */
function opdavies_preprocess_page(array &$variables): void { function opdavies_preprocess_page(array &$variables): void {
/** @var \Drupal\custom\Entity\Node\Post|null $node */ /** @var Post|null $node */
$node = $variables['node'] ?? NULL; $node = $variables['node'] ?? NULL;
if (!$node) { if (!$node) {
return; return;