PHP 7.4 only

This commit is contained in:
Oliver Davies 2020-07-21 19:09:57 +01:00
parent 520821c6a6
commit b200b6514b
2 changed files with 11 additions and 5 deletions

View file

@ -1,5 +1,8 @@
{
"name": "drupal/simple_message",
"description": "Displays a simple message.",
"type": "drupal-module"
"type": "drupal-module",
"require": {
"php": "^7.4"
}
}

View file

@ -1,7 +1,10 @@
<?php
declare(strict_types=1);
namespace Drupal\simple_message;
use Drupal\Core\Config\Config;
use Drupal\Core\Routing\AdminContext;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
@ -14,9 +17,9 @@ final class DisplaySimpleMessage implements EventSubscriberInterface {
use StringTranslationTrait;
private $messenger;
private $adminContext;
private $config;
private MessengerInterface $messenger;
private AdminContext $adminContext;
private Config $config;
public function __construct(
MessengerInterface $messenger,
@ -28,7 +31,7 @@ final class DisplaySimpleMessage implements EventSubscriberInterface {
$this->config = $configFactory->get('simple_message.config');
}
public function displayMessage(GetResponseEvent $event) {
public function displayMessage(GetResponseEvent $event): void {
if ($this->adminContext->isAdminRoute()) {
return;
}