Skip to content
Snippets Groups Projects
Commit 613d2e5e authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3424330 by alexpott, dineshkumarbollu: Raise minimum PHP to 8.1

parent 84b25d8a
No related branches found
No related tags found
1 merge request!41Raise PHP minimum to 8.1
Pipeline #105937 passed
Showing
with 55 additions and 476 deletions
......@@ -5,7 +5,7 @@
"license": "GPL-2.0-or-later",
"require": {
"drupal/advancedqueue": "^1.0@RC",
"php": ">=7.4.0"
"php": ">=8.1.0"
},
"require-dev": {
"drush/drush": "^11.0 || ^12.0",
......
......@@ -4,13 +4,6 @@ namespace Drupal\vgwort\Api;
class AgencyParticipant extends Participant {
/**
* The content agency's abbreviation. 2-4 characters.
*
* @var string
*/
private string $code;
/**
* @param string $code
* The agency's abbreviation. 2-4 characters.
......@@ -18,9 +11,8 @@ class AgencyParticipant extends Participant {
* How the participant is involved. Either 'AUTHOR', 'TRANSLATOR', or
* 'PUBLISHER'.
*/
public function __construct(string $code, string $involvement) {
public function __construct(private readonly string $code, string $involvement) {
parent::__construct($involvement);
$this->code = $code;
}
/**
......
......@@ -9,32 +9,16 @@ class IdentificationCode implements \JsonSerializable {
private const CODE_TYPE_VALUES = ['ISNI', 'ORCID', 'GNDID', 'IPI'];
/**
* The identification code.
*
* @var string
*/
private string $code;
/**
* ID type (ISNI, ORCID, GNDID, IPI).
*
* @var string
*/
private string $codeType;
/**
* @param string $code
* The identification code.
* @param string $codeType
* ID type (ISNI, ORCID, GNDID, IPI).
*/
public function __construct(string $code, string $codeType) {
public function __construct(private readonly string $code, private readonly string $codeType) {
if (!in_array($codeType, self::CODE_TYPE_VALUES, TRUE)) {
throw new \InvalidArgumentException(sprintf("'%s' is not a valid code type.", $codeType));
}
$this->code = $code;
$this->codeType = $codeType;
}
/**
......
......@@ -11,19 +11,12 @@ class MessageText implements \JsonSerializable {
private const VALID_TEXT_TYPES = ['epub', 'pdf', 'plainText'];
/**
* TRUE if the text is poetic text, otherwise FALSE.
*
* @var bool
*/
private bool $lyric;
/**
* Short description / heading (title).
*
* @var string
*/
private string $shorttext;
private readonly string $shorttext;
/**
* The text itself.
......@@ -53,8 +46,7 @@ class MessageText implements \JsonSerializable {
* (optional) TRUE if the text is poetic text, otherwise FALSE. Defaults to
* FALSE.
*/
public function __construct(string $shorttext, string $text, string $text_type = 'plainText', bool $lyric = FALSE) {
$this->lyric = $lyric;
public function __construct(string $shorttext, string $text, string $text_type = 'plainText', private readonly bool $lyric = FALSE) {
// @todo Is there any maximum length for this value?
$this->shorttext = PlainTextOutput::renderFromHtml($shorttext);
$this->addText($text, $text_type);
......
......@@ -11,144 +11,55 @@ use Drupal\Component\Assertion\Inspector;
*/
class NewMessage implements \JsonSerializable {
/**
* Distribution right (§ 17 UrhG).
*
* @var bool
*
* @see https://www.gesetze-im-internet.de/urhg/__17.html
*/
private bool $distributionRight;
/**
* The message text.
*
* @var \Drupal\vgwort\Api\MessageText
*/
private MessageText $messageText;
/**
* Other Public Communication Rights (§§ 19, 20, 21, 22 UrhG).
*
* @var bool
*
* @see https://www.gesetze-im-internet.de/urhg/__19.html
* @see https://www.gesetze-im-internet.de/urhg/__20.html
* @see https://www.gesetze-im-internet.de/urhg/__21.html
* @see https://www.gesetze-im-internet.de/urhg/__22.html
*/
private bool $otherRightsOfPublicReproduction;
/**
* The originators / translators / agencies of the message.
*
* At least one author or translator must be specified. Both authors and
* translators can be specified in a report.
*
* @var \Drupal\vgwort\Api\Participant[]
*/
private array $participants;
/**
* Identification ID of the counter mark.
*
* Either the private counter ID identification code (in case of a VG WORT
* counter id) or the publisher key.
*
* @var string
*/
private string $privateidentificationid;
/**
* Right of public access (§ 19a UrhG).
*
* @var bool
*
* @see https://www.gesetze-im-internet.de/urhg/__19a.html
*/
private bool $publicAccessRight;
/**
* Reproduction Rights (§ 16 UrhG).
*
* @var bool
*
* @see https://www.gesetze-im-internet.de/urhg/__16.html
*/
private bool $reproductionRight;
/**
* Declaration of Granting of Rights.
*
* The right of reproduction (§ 16 UrhG), right of distribution (§ 17 UrhG),
* right of public access (§ 19a UrhG) and the declaration of granting rights
* must be confirmed.
*
* @var bool
*/
private bool $rightsGrantedConfirmation;
/**
* Publication location(s) where the text can be found.
*
* @var \Drupal\vgwort\Api\Webrange[]
*/
private array $webranges;
/**
* Indication of whether the publisher is involved in the work.
*
* @var bool
*/
private bool $withoutOwnParticipation;
/**
* @param string $privateidentificationid
* Identification ID of the counter mark.
* Identification ID of the counter mark. Either the private counter ID
* identification code (in case of a VG WORT counter id) or the publisher
* key.
* @param \Drupal\vgwort\Api\MessageText $messageText
* The message text.
* @param \Drupal\vgwort\Api\Participant[] $participants
* The authors and publisher of the message.
* The authors and publisher of the message. At least one author or
* translator must be specified. Both authors and translators can be
* specified in a report.
* @param \Drupal\vgwort\Api\Webrange[] $webranges
* Publication location(s) where the text can be found.
* @param bool $distributionRight
* Distribution right (§ 17 UrhG).
* Distribution right (§ 17 UrhG). See
* https://www.gesetze-im-internet.de/urhg/__17.html/
* @param bool $publicAccessRight
* Right of public access (§ 19a UrhG).
* Right of public access (§ 19a UrhG). See
* https://www.gesetze-im-internet.de/urhg/__19a.html.
* @param bool $reproductionRight
* Reproduction Rights (§ 16 UrhG).
* Reproduction Rights (§ 16 UrhG). See
* https://www.gesetze-im-internet.de/urhg/__16.html.
* @param bool $rightsGrantedConfirmation
* Declaration of Granting of Rights.
* Declaration of Granting of Rights. The right of reproduction (§ 16 UrhG),
* right of distribution (§ 17 UrhG), right of public access (§ 19a UrhG)
* and the declaration of granting rights must be confirmed.
* @param bool $otherRightsOfPublicReproduction
* Other Public Communication Rights (§§ 19, 20, 21, 22 UrhG).
* Other Public Communication Rights (§§ 19, 20, 21, 22 UrhG). See
* https://www.gesetze-im-internet.de/urhg/__19.html
* https://www.gesetze-im-internet.de/urhg/__20.html
* https://www.gesetze-im-internet.de/urhg/__21.html
* https://www.gesetze-im-internet.de/urhg/__22.html
* @param bool $withoutOwnParticipation
* Indication of whether the publisher is involved in the work.
*/
public function __construct(
string $privateidentificationid,
MessageText $messageText,
array $participants,
array $webranges,
bool $distributionRight = FALSE,
bool $publicAccessRight = FALSE,
bool $reproductionRight = FALSE,
bool $rightsGrantedConfirmation = FALSE,
bool $otherRightsOfPublicReproduction = FALSE,
bool $withoutOwnParticipation = FALSE
private readonly string $privateidentificationid,
private readonly MessageText $messageText,
private readonly array $participants,
private readonly array $webranges,
private readonly bool $distributionRight = FALSE,
private readonly bool $publicAccessRight = FALSE,
private readonly bool $reproductionRight = FALSE,
private readonly bool $rightsGrantedConfirmation = FALSE,
private readonly bool $otherRightsOfPublicReproduction = FALSE,
private readonly bool $withoutOwnParticipation = FALSE
) {
assert(Inspector::assertAllObjects($participants, Participant::class));
assert(Inspector::assertAllObjects($webranges, Webrange::class));
$this->distributionRight = $distributionRight;
$this->messageText = $messageText;
$this->otherRightsOfPublicReproduction = $otherRightsOfPublicReproduction;
$this->participants = $participants;
$this->privateidentificationid = $privateidentificationid;
$this->publicAccessRight = $publicAccessRight;
$this->reproductionRight = $reproductionRight;
$this->rightsGrantedConfirmation = $rightsGrantedConfirmation;
$this->webranges = $webranges;
$this->withoutOwnParticipation = $withoutOwnParticipation;
}
/**
......
......@@ -13,23 +13,15 @@ abstract class Participant implements \JsonSerializable {
public const PUBLISHER = 'PUBLISHER';
/**
* Type of participant AUTHOR, TRANSLATOR, PUBLISHER.
*
* @var string
*/
private string $involvement;
/**
* @param string $involvement
* How the participant is involved. Either 'AUTHOR', 'TRANSLATOR', or
* 'PUBLISHER'.
*/
public function __construct(string $involvement) {
public function __construct(private readonly string $involvement) {
if (!in_array($involvement, [static::AUTHOR, static::PUBLISHER, static::TRANSLATOR], TRUE)) {
throw new \InvalidArgumentException(sprintf("'%s' is not a valid involvement.", $involvement));
}
$this->involvement = $involvement;
}
/**
......
......@@ -9,55 +9,22 @@ use Drupal\Component\Assertion\Inspector;
*/
class PersonParticipant extends Participant {
/**
* The participant's card number from VG Wort.
*
* @var int|null
*/
private ?int $cardNumber;
/**
* First name (2-40 characters).
*
* @var string
*/
private string $firstName;
/**
* Surname (2-255 characters).
*
* @var string
*/
private string $surName;
/**
* Participant identification codes.
*
* @var \Drupal\vgwort\Api\IdentificationCode[]
*/
private array $identificationCodes;
/**
* @param int|null $cardNumber
* The participant's card number from VG Wort.
* @param string $firstName
* First name.
* First name (2-40 characters).
* @param string $surName
* Surname.
* Surname (2-255 characters).
* @param string $involvement
* How the participant is involved. Either 'AUTHOR', 'TRANSLATOR', or
* 'PUBLISHER'.
* @param \Drupal\vgwort\Api\IdentificationCode[] $identificationCodes
* (optional) The participant's identification codes.
*/
public function __construct(?int $cardNumber, string $firstName, string $surName, string $involvement, array $identificationCodes = []) {
public function __construct(private readonly ?int $cardNumber, private readonly string $firstName, private readonly string $surName, string $involvement, private readonly array $identificationCodes = []) {
parent::__construct($involvement);
assert(Inspector::assertAllObjects($identificationCodes, IdentificationCode::class));
$this->cardNumber = $cardNumber;
$this->firstName = $firstName;
$this->identificationCodes = $identificationCodes;
$this->surName = $surName;
}
/**
......
......@@ -18,23 +18,15 @@ use Drupal\Component\Utility\UrlHelper;
*/
class Webrange implements \JsonSerializable {
/**
* Maximum size: 250 characters.
*
* @var string[]
*/
private array $urls;
/**
* @param string[] $urls
* An array of URLs required to read the entire text once.
* An array of URLs required to read the entire text once. Maximum size of
* each URL is 250 characters.
*/
public function __construct(array $urls) {
public function __construct(private readonly array $urls) {
assert(Inspector::assertAll(function (string $url) {
return UrlHelper::isValid($url) && UrlHelper::isExternal($url);
}, $urls));
$this->urls = $urls;
}
/**
......
......@@ -23,49 +23,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class VgwortCommands extends DrushCommands {
use DependencySerializationTrait;
/**
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected EntityTypeManagerInterface $entityTypeManager;
/**
* @var \Drupal\vgwort\EntityQueuer
*/
protected EntityQueuer $entityQueuer;
/**
* @var \Drupal\Component\Datetime\TimeInterface
*/
protected TimeInterface $time;
/**
* @var \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface
*/
protected MemoryCacheInterface $entityMemoryCache;
/**
* @var \Drupal\advancedqueue\JobTypeManager
*/
protected JobTypeManager $jobTypeManager;
/**
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager.
* @param \Drupal\vgwort\EntityQueuer $entityQueuer
* The VG Wort entity queuer.
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
* @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $entityMemoryCache
* The entity memory cache.
* @param \Drupal\advancedqueue\JobTypeManager $jobTypeManager
* The advanced queue job type manager.
*/
public function __construct(EntityTypeManagerInterface $entityTypeManager, EntityQueuer $entityQueuer, TimeInterface $time, MemoryCacheInterface $entityMemoryCache, JobTypeManager $jobTypeManager) {
$this->entityTypeManager = $entityTypeManager;
$this->entityQueuer = $entityQueuer;
$this->time = $time;
$this->entityMemoryCache = $entityMemoryCache;
$this->jobTypeManager = $jobTypeManager;
public function __construct(protected readonly EntityTypeManagerInterface $entityTypeManager, protected readonly EntityQueuer $entityQueuer, protected readonly TimeInterface $time, protected readonly MemoryCacheInterface $entityMemoryCache, protected readonly JobTypeManager $jobTypeManager) {
}
public static function create(ContainerInterface $container): self {
......
......@@ -11,28 +11,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ConfigSubscriber implements EventSubscriberInterface {
/**
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
private EntityFieldManagerInterface $entityFieldManager;
/**
* @var \Drupal\vgwort\ParticipantListManager
*/
private ParticipantListManager $participantListManager;
/**
* @var \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface
*/
private EntityDefinitionUpdateManagerInterface $entityDefinitionUpdateManager;
/**
* Constructs the ConfigSubscriber.
*/
public function __construct(EntityFieldManagerInterface $entityFieldManager, ParticipantListManager $participantListManager, EntityDefinitionUpdateManagerInterface $entityDefinitionUpdateManager) {
$this->entityFieldManager = $entityFieldManager;
$this->participantListManager = $participantListManager;
$this->entityDefinitionUpdateManager = $entityDefinitionUpdateManager;
public function __construct(private readonly EntityFieldManagerInterface $entityFieldManager, private readonly ParticipantListManager $participantListManager, private readonly EntityDefinitionUpdateManagerInterface $entityDefinitionUpdateManager) {
}
/**
......
......@@ -26,41 +26,7 @@ final class EntityJobMapper {
*/
public const TABLE = 'vgwort_entity_registration';
/**
* The database connection used to check the IP against.
*
* @var \Drupal\Core\Database\Connection
*/
protected Connection $connection;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected EntityTypeManagerInterface $entityTypeManager;
/**
* The lock service.
*
* @var \Drupal\Core\Lock\LockBackendInterface
*/
protected LockBackendInterface $lock;
/**
* Constructs a EntityJobMapper object.
*
* @param \Drupal\Core\Database\Connection $connection
* The database connection to sort VG Wort entity registrations.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager.
* @param \Drupal\Core\Lock\LockBackendInterface $lock
* The lock service.
*/
public function __construct(Connection $connection, EntityTypeManagerInterface $entityTypeManager, LockBackendInterface $lock) {
$this->connection = $connection;
$this->entityTypeManager = $entityTypeManager;
$this->lock = $lock;
public function __construct(protected readonly Connection $connection, protected readonly EntityTypeManagerInterface $entityTypeManager, protected readonly LockBackendInterface $lock) {
}
/**
......
......@@ -20,12 +20,7 @@ class EntityQueuer {
/**
* @var \Drupal\Core\Config\Config
*/
private Config $config;
/**
* @var \Drupal\vgwort\EntityJobMapper
*/
private EntityJobMapper $entityJobMapper;
private readonly Config $config;
/**
* @var \Drupal\Core\Extension\ModuleHandlerInterface
......@@ -42,9 +37,8 @@ class EntityQueuer {
* @param \Drupal\Core\Extension\ModuleHandlerInterface|null $moduleHandler
* The module handler.
*/
public function __construct(ConfigFactoryInterface $configFactory, EntityJobMapper $entityJobMapper, ModuleHandlerInterface $moduleHandler = NULL) {
public function __construct(ConfigFactoryInterface $configFactory, private readonly EntityJobMapper $entityJobMapper, ModuleHandlerInterface $moduleHandler = NULL) {
$this->config = $configFactory->get('vgwort.settings');
$this->entityJobMapper = $entityJobMapper;
// Provide BC so sites do not need to run a container rebuild.
// @todo remove in a few releases.
if ($moduleHandler === NULL) {
......
......@@ -14,13 +14,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
abstract class FieldParticipantListBase extends PluginBase implements ParticipantListInterface, ContainerFactoryPluginInterface {
/**
* The Entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
protected EntityFieldManagerInterface $entityFieldManager;
/**
* @param array $configuration
* A configuration array containing information about the plugin instance.
......@@ -31,9 +24,8 @@ abstract class FieldParticipantListBase extends PluginBase implements Participan
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entityFieldManager
* The Entity field manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityFieldManagerInterface $entityFieldManager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, protected readonly EntityFieldManagerInterface $entityFieldManager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityFieldManager = $entityFieldManager;
}
/**
......
......@@ -22,28 +22,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class SettingsForm extends ConfigFormBase implements TrustedCallbackInterface {
/**
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected EntityTypeManagerInterface $entityTypeManager;
/**
* @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface
*/
protected EntityDisplayRepositoryInterface $entityDisplayRepository;
/**
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager.
* @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entityDisplayRepository
* The entity display repository.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entityTypeManager, EntityDisplayRepositoryInterface $entityDisplayRepository) {
public function __construct(ConfigFactoryInterface $config_factory, protected EntityTypeManagerInterface $entityTypeManager, protected EntityDisplayRepositoryInterface $entityDisplayRepository) {
parent::__construct($config_factory);
$this->entityTypeManager = $entityTypeManager;
$this->entityDisplayRepository = $entityDisplayRepository;
}
/**
......
......@@ -20,51 +20,13 @@ use Drupal\vgwort\Exception\NoParticipantsException;
*/
class MessageGenerator {
/**
* @var \Drupal\vgwort\ParticipantListManager
*/
protected ParticipantListManager $participantListManager;
/**
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected EntityTypeManagerInterface $entityTypeManager;
/**
* @var \Drupal\Core\Render\RendererInterface
*/
protected RendererInterface $renderer;
/**
* @var \Drupal\Core\Config\Config
*/
protected Config $config;
/**
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected ModuleHandlerInterface $moduleHandler;
protected readonly Config $config;
/**
* Constructs a MessageGenerator object.
*
* @param \Drupal\vgwort\ParticipantListManager $participantListManager
* The participant list manager service.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager service.
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* The config factory.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* The module handler.
*/
public function __construct(ParticipantListManager $participantListManager, EntityTypeManagerInterface $entityTypeManager, RendererInterface $renderer, ConfigFactoryInterface $configFactory, ModuleHandlerInterface $moduleHandler) {
$this->participantListManager = $participantListManager;
$this->entityTypeManager = $entityTypeManager;
$this->renderer = $renderer;
public function __construct(protected readonly ParticipantListManager $participantListManager, protected readonly EntityTypeManagerInterface $entityTypeManager, protected readonly RendererInterface $renderer, ConfigFactoryInterface $configFactory, protected readonly ModuleHandlerInterface $moduleHandler) {
$this->config = $configFactory->get('vgwort.settings');
$this->moduleHandler = $moduleHandler;
}
/**
......
......@@ -41,36 +41,6 @@ class RegistrationNotification extends JobTypeBase implements ContainerFactoryPl
private const LIVE_URL = 'https://tom.vgwort.de/api/external/metis/rest/message/v1.0/newMessageRequest';
private const TEST_URL = 'https://tom-test.vgwort.de/api/external/metis/rest/message/v1.0/newMessageRequest';
/**
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected EntityTypeManagerInterface $entityTypeManager;
/**
* @var \Drupal\vgwort\MessageGenerator
*/
protected MessageGenerator $messageGenerator;
/**
* @var \GuzzleHttp\ClientInterface
*/
protected ClientInterface $httpClient;
/**
* @var \Drupal\Core\Config\Config
*/
protected Config $config;
/**
* @var \Drupal\vgwort\EntityJobMapper
*/
protected EntityJobMapper $entityJobMapper;
/**
* @var \Drupal\Component\Datetime\TimeInterface
*/
protected TimeInterface $time;
/**
* @param array $configuration
* A configuration array containing information about the plugin instance.
......@@ -91,14 +61,8 @@ class RegistrationNotification extends JobTypeBase implements ContainerFactoryPl
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entityTypeManager, MessageGenerator $messageGenerator, ClientInterface $httpClient, Config $config, EntityJobMapper $entityJobMapper, TimeInterface $time) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, protected readonly EntityTypeManagerInterface $entityTypeManager, protected readonly MessageGenerator $messageGenerator, protected readonly ClientInterface $httpClient, protected readonly Config $config, protected readonly EntityJobMapper $entityJobMapper, protected readonly TimeInterface $time) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entityTypeManager;
$this->messageGenerator = $messageGenerator;
$this->httpClient = $httpClient;
$this->config = $config;
$this->entityJobMapper = $entityJobMapper;
$this->time = $time;
}
/**
......
......@@ -29,16 +29,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class VgWort extends DataProducerPluginBase implements ContainerFactoryPluginInterface {
/**
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
private ConfigFactoryInterface $configFactory;
/**
* @var \Drupal\Core\Render\RendererInterface
*/
private RendererInterface $renderer;
/**
* Constructs a \Drupal\vgwort\Plugin\GraphQL\DataProducer\VgWort object.
*
......@@ -53,10 +43,8 @@ class VgWort extends DataProducerPluginBase implements ContainerFactoryPluginInt
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $configFactory, RendererInterface $renderer) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, private readonly ConfigFactoryInterface $configFactory, private readonly RendererInterface $renderer) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->configFactory = $configFactory;
$this->renderer = $renderer;
}
/**
......
......@@ -21,41 +21,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class EntityReferenceFieldDeriver extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* @var \Drupal\Core\Config\Config
*/
protected Config $config;
/**
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected EntityTypeManagerInterface $entityTypeManager;
/**
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
protected EntityFieldManagerInterface $entityFieldManager;
/**
* @var \Psr\Log\LoggerInterface
*/
protected LoggerInterface $logger;
/**
* @param \Drupal\Core\Config\Config $config
* VG Wort settings config.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager.
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entityFieldManager
* The entity field manager.
* @param \Psr\Log\LoggerInterface $logger
* A logger instance.
*/
public function __construct(Config $config, EntityTypeManagerInterface $entityTypeManager, EntityFieldManagerInterface $entityFieldManager, LoggerInterface $logger) {
$this->config = $config;
$this->entityTypeManager = $entityTypeManager;
$this->entityFieldManager = $entityFieldManager;
$this->logger = $logger;
public function __construct(protected readonly Config $config, protected readonly EntityTypeManagerInterface $entityTypeManager, protected readonly EntityFieldManagerInterface $entityFieldManager, protected readonly LoggerInterface $logger) {
}
/**
......
......@@ -4,7 +4,7 @@ type: module
package: Content
core_version_requirement: ^9 || ^10
configure: vgwort.settings
php: 7.4
php: 8.1
dependencies:
- advancedqueue:advancedqueue
- drupal:node
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment