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
ignoreErrors:
- '#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()#'
includes:
- vendor/mglaman/phpstan-drupal/extension.neon

View file

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

View file

@ -19,8 +19,8 @@ final class Event extends Date {
public function __construct(
array $configuration,
$pluginId,
$pluginDefinition,
string $pluginId,
array $pluginDefinition,
TimeInterface $time
) {
parent::__construct($configuration, $pluginId, $pluginDefinition);
@ -42,7 +42,7 @@ final class Event extends Date {
);
}
public function query() {
public function query(): void {
$this->ensureMyTable();
$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\EntityTypeManagerInterface;
use Drupal\opdavies_blog\Entity\Node\Talk;
use Drupal\opdavies_talks\Entity\Node\Talk;
use Illuminate\Support\Collection;
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)) {
return;
}

View file

@ -5,13 +5,13 @@
* 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().
*/
function opdavies_preprocess_page(array &$variables): void {
/** @var \Drupal\custom\Entity\Node\Post|null $node */
/** @var Post|null $node */
$node = $variables['node'] ?? NULL;
if (!$node) {
return;