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", "name": "drupal/simple_message",
"description": "Displays a simple message.", "description": "Displays a simple message.",
"type": "drupal-module" "type": "drupal-module",
"require": {
"php": "^7.4"
}
} }

View file

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