Skip to content
Snippets Groups Projects
Verified Commit 1afac9fd authored by dpi's avatar dpi
Browse files

Issue #3269298: Coding standards and static analysis pass

parent 69b0ff9d
No related branches found
Tags 8.x-3.0-alpha32
No related merge requests found
......@@ -188,6 +188,7 @@ class ScheduledTransition extends ContentEntityBase implements ScheduledTransiti
* {@inheritdoc}
*/
public function setEntityRevisionLanguage(string $langCode) {
// @phpstan-ignore-next-line
$this->entity_revision_langcode = $langCode;
return $this;
}
......@@ -203,6 +204,7 @@ class ScheduledTransition extends ContentEntityBase implements ScheduledTransiti
* {@inheritdoc}
*/
public function setAuthor(AccountInterface $author) {
// @phpstan-ignore-next-line
$this->author = $author->id();
return $this;
}
......@@ -218,7 +220,9 @@ class ScheduledTransition extends ContentEntityBase implements ScheduledTransiti
* {@inheritdoc}
*/
public function setState(WorkflowInterface $workflow, string $state) {
// @phpstan-ignore-next-line
$this->workflow = $workflow->id();
// @phpstan-ignore-next-line
$this->moderation_state = $state;
return $this;
}
......@@ -290,6 +294,7 @@ class ScheduledTransition extends ContentEntityBase implements ScheduledTransiti
* {@inheritdoc}
*/
public function setOptions(array $options) {
// @phpstan-ignore-next-line
$this->options = $options;
return $this;
}
......
......@@ -61,7 +61,7 @@ class ScheduledTransitionsNewRevision implements EventSubscriberInterface {
/** @var \Drupal\Core\Entity\EntityStorageInterface|\Drupal\Core\Entity\RevisionableStorageInterface $entityStorage */
$entityStorage = $this->entityTypeManager->getStorage($entity->getEntityTypeId());
/** @var \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface $newRevision */
/** @var \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface|null $newRevision */
$newRevision = $entityStorage->loadRevision($entityRevisionId);
if (!isset($newRevision)) {
$this->logger->info('Target revision does not exist for scheduled transition #@id', $targs);
......
......@@ -52,6 +52,7 @@ class ScheduledTransitionsTokenReplacements {
// getWorkflowForEntity only supports Content Entities, this can be removed
// if Scheduled Transitions supports non CM workflows in the future.
$states = [];
if ($this->latest instanceof ContentEntityInterface) {
$workflow = $this->moderationInformation()->getWorkflowForEntity($this->latest);
$workflowPlugin = $workflow->getTypePlugin();
......@@ -78,6 +79,7 @@ class ScheduledTransitionsTokenReplacements {
* Moderation information service.
*/
protected function moderationInformation(): ModerationInformationInterface {
// @phpstan-ignore-next-line
return $this->moderationInformation ?? \Drupal::service('content_moderation.moderation_information');
}
......
......@@ -148,6 +148,7 @@ class ScheduledTransitionsUtility implements ScheduledTransitionsUtilityInterfac
public function generateRevisionLog(ScheduledTransitionInterface $scheduledTransition, RevisionLogInterface $newRevision): string {
$entityStorage = $this->entityTypeManager->getStorage($newRevision->getEntityTypeId());
$latestRevisionId = $entityStorage->getLatestRevisionId($newRevision->id());
$latest = NULL;
if ($latestRevisionId) {
/** @var \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface $latest */
$latest = $entityStorage->loadRevision($latestRevisionId);
......
......@@ -22,10 +22,10 @@ class ScheduledTransitionsCronUnitTest extends UnitTestCase {
private ScheduledTransitionsJobsInterface $testJobs;
/**
* ScheduledTransitionsCronUnitTest constructor.
* {@inheritdoc}
*/
public function __construct() {
parent::__construct();
protected function setUp(): void {
parent::setUp();
$this->testConfigFactory = $this->createMock(ConfigFactoryInterface::class);
$this->testJobs = $this->createMock(ScheduledTransitionsJobsInterface::class);
}
......
......@@ -31,12 +31,13 @@ class ScheduledTransitionsEntityHooksUnitTest extends UnitTestCase {
private ConfigFactoryInterface $testConfigFactory;
private EntityTypeManagerInterface $testEntityTypeManager;
private ModerationInformationInterface $testModerationInformation;
private ContainerBuilder $testContainer;
/**
* ScheduledTransitionsEntityHooksUnitTest constructor.
*/
public function __construct() {
parent::__construct();
public function setUp(): void {
parent::setUp();
$this->testConfigFactory = $this->createMock(ConfigFactoryInterface::class);
$this->testEntityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
$this->testModerationInformation = $this->createMock(ModerationInformationInterface::class);
......
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