From 325b093bda2b8bf17d1b31b4e8d4f166fa827542 Mon Sep 17 00:00:00 2001 From: David mattei Date: Fri, 13 Dec 2024 16:30:10 +0100 Subject: [PATCH] chore: phpcs and phpstan --- .../src/Command/Submission/ForwardCommand.php | 2 +- .../src/Common/CoreApi/Endpoint/Data/Data.php | 2 +- .../src/Common/CoreApi/Endpoint/File/File.php | 2 +- EMS/common-bundle/src/Common/File/FileReader.php | 6 ------ .../src/Contracts/CoreApi/Endpoint/Data/DataInterface.php | 2 +- .../src/Contracts/File/FileManagerInterface.php | 2 +- EMS/common-bundle/src/Controller/FileController.php | 2 +- EMS/common-bundle/src/Storage/Archive.php | 2 +- .../src/Storage/Service/AbstractUrlStorage.php | 2 +- EMS/common-bundle/src/Storage/Service/EntityStorage.php | 2 +- .../src/Storage/Service/FileSystemStorage.php | 2 +- EMS/common-bundle/src/Storage/Service/S3Storage.php | 2 +- .../src/Storage/Service/StorageInterface.php | 2 +- EMS/common-bundle/src/Storage/StorageManager.php | 4 ++-- EMS/common-bundle/src/Twig/AssetRuntime.php | 2 +- EMS/core-bundle/src/Command/CleanAssetCommand.php | 2 +- EMS/core-bundle/src/Command/Submission/ExportCommand.php | 2 +- EMS/core-bundle/src/Command/UpdateMetaFieldCommand.php | 2 +- .../src/Controller/Api/Data/PublishController.php | 6 +++--- .../src/Controller/Wysiwyg/StylesetController.php | 2 +- EMS/core-bundle/src/Form/DataField/AssetFieldType.php | 4 ++-- EMS/core-bundle/src/Form/DataField/ContainerFieldType.php | 2 +- EMS/core-bundle/src/Form/DataField/TabsFieldType.php | 3 --- EMS/core-bundle/src/Form/DataField/WysiwygFieldType.php | 2 +- .../src/Form/Extension/LocaleFormExtension.php | 2 +- EMS/core-bundle/src/Form/Field/EnvironmentPickerType.php | 1 - EMS/core-bundle/src/Form/Field/FilterOptionsType.php | 8 ++++---- EMS/core-bundle/src/Service/Revision/RevisionService.php | 2 +- 28 files changed, 32 insertions(+), 42 deletions(-) diff --git a/EMS/common-bundle/src/Command/Submission/ForwardCommand.php b/EMS/common-bundle/src/Command/Submission/ForwardCommand.php index 55c2f4111..0fee8d5ca 100644 --- a/EMS/common-bundle/src/Command/Submission/ForwardCommand.php +++ b/EMS/common-bundle/src/Command/Submission/ForwardCommand.php @@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return self::EXECUTE_ERROR; } - $results = JSON::decode($httpResponse->getContent()); + $results = Json::decode($httpResponse->getContent()); foreach (($results['summaries'] ?? []) as $result) { $this->io->writeln(\sprintf('%s with %s %s', $result['data'] ?? '', $result['status'] ?? '', $result['uid'] ?? '')); } diff --git a/EMS/common-bundle/src/Common/CoreApi/Endpoint/Data/Data.php b/EMS/common-bundle/src/Common/CoreApi/Endpoint/Data/Data.php index dfb1f5693..8bde443d5 100644 --- a/EMS/common-bundle/src/Common/CoreApi/Endpoint/Data/Data.php +++ b/EMS/common-bundle/src/Common/CoreApi/Endpoint/Data/Data.php @@ -150,7 +150,7 @@ private function makeResource(?string ...$path): string return \implode('/', \array_merge($this->endPoint, \array_filter($path))); } - public function publish(string $ouuid, string $environment, string $revisionId = null): bool + public function publish(string $ouuid, string $environment, ?string $revisionId = null): bool { $resource = $this->makeResource('publish', $ouuid, $environment, $revisionId ?? ''); $success = $this->client->post($resource)->getData()['success'] ?? null; diff --git a/EMS/common-bundle/src/Common/CoreApi/Endpoint/File/File.php b/EMS/common-bundle/src/Common/CoreApi/Endpoint/File/File.php index 37ee2ef7a..ae8c2fbbc 100644 --- a/EMS/common-bundle/src/Common/CoreApi/Endpoint/File/File.php +++ b/EMS/common-bundle/src/Common/CoreApi/Endpoint/File/File.php @@ -209,7 +209,7 @@ public function setHeadChunkSize(int $chunkSize): void $this->headChunkSize = $chunkSize; } - public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, callable $callback = null): void + public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, ?callable $callback = null): void { $admin = new Admin($this->client); $command = \sprintf('%s %s', Commands::LOAD_ARCHIVE_IN_CACHE, $archiveHash); diff --git a/EMS/common-bundle/src/Common/File/FileReader.php b/EMS/common-bundle/src/Common/File/FileReader.php index 60cd4f6e3..41b4e67f5 100644 --- a/EMS/common-bundle/src/Common/File/FileReader.php +++ b/EMS/common-bundle/src/Common/File/FileReader.php @@ -15,9 +15,6 @@ final class FileReader implements FileReaderInterface { - /** - * {@inheritDoc} - */ public function getData(string $filename, array $options = []): array { $reader = IOFactory::createReaderForFile($filename); @@ -34,9 +31,6 @@ public function getData(string $filename, array $options = []): array return $reader->load($filename)->getActiveSheet()->toArray(); } - /** - * {@inheritDoc} - */ public function readCells(string $filename, array $options = []): \Generator { $isCsv = 0 === \strcasecmp(\pathinfo($filename, PATHINFO_EXTENSION), 'csv'); diff --git a/EMS/common-bundle/src/Contracts/CoreApi/Endpoint/Data/DataInterface.php b/EMS/common-bundle/src/Contracts/CoreApi/Endpoint/Data/DataInterface.php index 977d86656..6c1a8c6d0 100644 --- a/EMS/common-bundle/src/Contracts/CoreApi/Endpoint/Data/DataInterface.php +++ b/EMS/common-bundle/src/Contracts/CoreApi/Endpoint/Data/DataInterface.php @@ -78,5 +78,5 @@ public function update(string $ouuid, array $rawData): DraftInterface; */ public function save(string $ouuid, array $rawData, int $mode = self::MODE_UPDATE, bool $discardDraft = true): int; - public function publish(string $ouuid, string $environment, string $revisionId = null): bool; + public function publish(string $ouuid, string $environment, ?string $revisionId = null): bool; } diff --git a/EMS/common-bundle/src/Contracts/File/FileManagerInterface.php b/EMS/common-bundle/src/Contracts/File/FileManagerInterface.php index 8f4d9e6ef..d360cccd5 100644 --- a/EMS/common-bundle/src/Contracts/File/FileManagerInterface.php +++ b/EMS/common-bundle/src/Contracts/File/FileManagerInterface.php @@ -36,5 +36,5 @@ public function uploadFile(string $realPath, ?string $mimeType = null, ?string $ */ public function setHeadChunkSize(int $chunkSize): void; - public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, callable $callback = null): void; + public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, ?callable $callback = null): void; } diff --git a/EMS/common-bundle/src/Controller/FileController.php b/EMS/common-bundle/src/Controller/FileController.php index 2bbd94c36..60f9a3315 100644 --- a/EMS/common-bundle/src/Controller/FileController.php +++ b/EMS/common-bundle/src/Controller/FileController.php @@ -90,7 +90,7 @@ public function generateLocalImage(Request $request, string $filename, string $c return $response; } - public function assetInArchive(Request $request, string $hash, string $path, int $maxAge = 604800, bool $extract = true, string $indexResource = null, string $notFoundTemplate = null): Response + public function assetInArchive(Request $request, string $hash, string $path, int $maxAge = 604800, bool $extract = true, ?string $indexResource = null, ?string $notFoundTemplate = null): Response { $this->closeSession($request); diff --git a/EMS/common-bundle/src/Storage/Archive.php b/EMS/common-bundle/src/Storage/Archive.php index 5ce4081ab..eb1da86e8 100644 --- a/EMS/common-bundle/src/Storage/Archive.php +++ b/EMS/common-bundle/src/Storage/Archive.php @@ -21,7 +21,7 @@ public function __construct(private readonly string $hashAlgo) { } - public static function fromDirectory(string $directory, string $hashAlgo, callable $callback = null): self + public static function fromDirectory(string $directory, string $hashAlgo, ?callable $callback = null): self { $archive = new self($hashAlgo); $finder = new Finder(); diff --git a/EMS/common-bundle/src/Storage/Service/AbstractUrlStorage.php b/EMS/common-bundle/src/Storage/Service/AbstractUrlStorage.php index 398140b6b..a7171987e 100644 --- a/EMS/common-bundle/src/Storage/Service/AbstractUrlStorage.php +++ b/EMS/common-bundle/src/Storage/Service/AbstractUrlStorage.php @@ -251,7 +251,7 @@ public function addFileInArchiveCache(string $hash, SplFileInfo $file, string $m return false; } - public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, callable $callback = null): bool + public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, ?callable $callback = null): bool { return false; } diff --git a/EMS/common-bundle/src/Storage/Service/EntityStorage.php b/EMS/common-bundle/src/Storage/Service/EntityStorage.php index 30e6fda6b..75bedcffc 100644 --- a/EMS/common-bundle/src/Storage/Service/EntityStorage.php +++ b/EMS/common-bundle/src/Storage/Service/EntityStorage.php @@ -247,7 +247,7 @@ public function addFileInArchiveCache(string $hash, SplFileInfo $file, string $m return false; } - public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, callable $callback = null): bool + public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, ?callable $callback = null): bool { return false; } diff --git a/EMS/common-bundle/src/Storage/Service/FileSystemStorage.php b/EMS/common-bundle/src/Storage/Service/FileSystemStorage.php index 912b7c6dd..85195d972 100644 --- a/EMS/common-bundle/src/Storage/Service/FileSystemStorage.php +++ b/EMS/common-bundle/src/Storage/Service/FileSystemStorage.php @@ -109,7 +109,7 @@ public function addFileInArchiveCache(string $hash, SplFileInfo $file, string $m return \copy($file->getPathname(), $filename); } - public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, callable $callback = null): bool + public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, ?callable $callback = null): bool { return false; } diff --git a/EMS/common-bundle/src/Storage/Service/S3Storage.php b/EMS/common-bundle/src/Storage/Service/S3Storage.php index 6b0f11bc9..6dc0f2e47 100644 --- a/EMS/common-bundle/src/Storage/Service/S3Storage.php +++ b/EMS/common-bundle/src/Storage/Service/S3Storage.php @@ -350,7 +350,7 @@ public function addFileInArchiveCache(string $hash, SplFileInfo $file, string $m return $result->hasKey('ETag'); } - public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, callable $callback = null): bool + public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, ?callable $callback = null): bool { $batch = []; $client = $this->getS3Client(); diff --git a/EMS/common-bundle/src/Storage/Service/StorageInterface.php b/EMS/common-bundle/src/Storage/Service/StorageInterface.php index 36947a630..17b2f91ba 100644 --- a/EMS/common-bundle/src/Storage/Service/StorageInterface.php +++ b/EMS/common-bundle/src/Storage/Service/StorageInterface.php @@ -86,5 +86,5 @@ public function readFromArchiveInCache(string $hash, string $path): ?StreamWrapp public function addFileInArchiveCache(string $hash, SplFileInfo $file, string $mimeType): bool; - public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, callable $callback = null): bool; + public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, ?callable $callback = null): bool; } diff --git a/EMS/common-bundle/src/Storage/StorageManager.php b/EMS/common-bundle/src/Storage/StorageManager.php index 27819c17f..7891c3eb0 100644 --- a/EMS/common-bundle/src/Storage/StorageManager.php +++ b/EMS/common-bundle/src/Storage/StorageManager.php @@ -530,7 +530,7 @@ public function saveCache(Config $config, FileInterface $file): void } } - public function getStreamFromArchive(string $hash, string $path, bool $extract = true, string $indexResource = null): StreamWrapper + public function getStreamFromArchive(string $hash, string $path, bool $extract = true, ?string $indexResource = null): StreamWrapper { if (null !== $indexResource && ('' === $path || \str_ends_with($path, '/'))) { $path .= $indexResource; @@ -701,7 +701,7 @@ public function setHeadChunkSize(int $chunkSize): void $this->headChunkSize = $chunkSize; } - public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, callable $callback = null): void + public function loadArchiveItemsInCache(string $archiveHash, Archive $archive, ?callable $callback = null): void { foreach ($this->adapters as $adapter) { if ($adapter->loadArchiveItemsInCache($archiveHash, $archive, $callback)) { diff --git a/EMS/common-bundle/src/Twig/AssetRuntime.php b/EMS/common-bundle/src/Twig/AssetRuntime.php index 7f3a22780..9fdbd3995 100644 --- a/EMS/common-bundle/src/Twig/AssetRuntime.php +++ b/EMS/common-bundle/src/Twig/AssetRuntime.php @@ -202,7 +202,7 @@ public function hash(string $input, ?string $hashAlgo = null, bool $binary = fal /** * @param mixed[] $options */ - public function fileFromArchive(string $hash, string $path, array $options = []): null|string|TempFile + public function fileFromArchive(string $hash, string $path, array $options = []): string|TempFile|null { $extract = Type::bool($options['extract'] ?? true); $asTempFile = Type::bool($options['asTempFile'] ?? false); diff --git a/EMS/core-bundle/src/Command/CleanAssetCommand.php b/EMS/core-bundle/src/Command/CleanAssetCommand.php index 6b9fa1279..a309f51d7 100644 --- a/EMS/core-bundle/src/Command/CleanAssetCommand.php +++ b/EMS/core-bundle/src/Command/CleanAssetCommand.php @@ -4,8 +4,8 @@ use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\ORM\EntityManager; -use EMS\CoreBundle\Commands; use EMS\CommonBundle\Common\Command\AbstractCommand; +use EMS\CoreBundle\Commands; use EMS\CoreBundle\Entity\Revision; use EMS\CoreBundle\Entity\UploadedAsset; use EMS\CoreBundle\Repository\RevisionRepository; diff --git a/EMS/core-bundle/src/Command/Submission/ExportCommand.php b/EMS/core-bundle/src/Command/Submission/ExportCommand.php index c52b46a2b..3e537a9fc 100644 --- a/EMS/core-bundle/src/Command/Submission/ExportCommand.php +++ b/EMS/core-bundle/src/Command/Submission/ExportCommand.php @@ -24,7 +24,7 @@ class ExportCommand extends AbstractCommand /** @var string[] */ private array $fields; private ?string $filter; - private ?string $filename; + private ?string $filename; public function __construct( private readonly FormSubmissionService $formSubmissionService, diff --git a/EMS/core-bundle/src/Command/UpdateMetaFieldCommand.php b/EMS/core-bundle/src/Command/UpdateMetaFieldCommand.php index 601ae4271..fd6347e93 100644 --- a/EMS/core-bundle/src/Command/UpdateMetaFieldCommand.php +++ b/EMS/core-bundle/src/Command/UpdateMetaFieldCommand.php @@ -4,8 +4,8 @@ use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\ORM\EntityManager; -use EMS\CoreBundle\Commands; use EMS\CommonBundle\Common\Command\AbstractCommand; +use EMS\CoreBundle\Commands; use EMS\CoreBundle\Entity\Environment; use EMS\CoreBundle\Entity\Revision; use EMS\CoreBundle\Exception\NotLockedException; diff --git a/EMS/core-bundle/src/Controller/Api/Data/PublishController.php b/EMS/core-bundle/src/Controller/Api/Data/PublishController.php index 982a0abcb..fc8f408ab 100644 --- a/EMS/core-bundle/src/Controller/Api/Data/PublishController.php +++ b/EMS/core-bundle/src/Controller/Api/Data/PublishController.php @@ -23,7 +23,7 @@ public function __construct( ) { } - public function publish(string $contentTypeName, string $ouuid, string $targetEnvironmentName, Revision $revision = null): JsonResponse + public function publish(string $contentTypeName, string $ouuid, string $targetEnvironmentName, ?Revision $revision = null): JsonResponse { if (null === $revision) { $contentType = $this->contentTypeService->giveByName($contentTypeName); @@ -44,8 +44,8 @@ public function publish(string $contentTypeName, string $ouuid, string $targetEn } return new JsonResponse([ - 'success' => true, - 'already-published' => 0 === $publishedCounter, + 'success' => true, + 'already-published' => 0 === $publishedCounter, ]); } } diff --git a/EMS/core-bundle/src/Controller/Wysiwyg/StylesetController.php b/EMS/core-bundle/src/Controller/Wysiwyg/StylesetController.php index 840a74df9..b3372034b 100644 --- a/EMS/core-bundle/src/Controller/Wysiwyg/StylesetController.php +++ b/EMS/core-bundle/src/Controller/Wysiwyg/StylesetController.php @@ -4,8 +4,8 @@ namespace EMS\CoreBundle\Controller\Wysiwyg; -use EMS\CommonBundle\Common\EMSLink; use EMS\ClientHelperBundle\Helper\Asset\AssetHelperRuntime; +use EMS\CommonBundle\Common\EMSLink; use EMS\CoreBundle\Entity\WysiwygStylesSet; use EMS\CoreBundle\Service\WysiwygStylesSetService; use EMS\Helpers\File\File; diff --git a/EMS/core-bundle/src/Form/DataField/AssetFieldType.php b/EMS/core-bundle/src/Form/DataField/AssetFieldType.php index 47cb31e2a..193d05b37 100644 --- a/EMS/core-bundle/src/Form/DataField/AssetFieldType.php +++ b/EMS/core-bundle/src/Form/DataField/AssetFieldType.php @@ -153,8 +153,8 @@ public function generateMapping(FieldType $current): array EmsFields::CONTENT_FILE_SIZE_FIELD => $this->elasticsearchService->getLongMapping(), EmsFields::CONTENT_FILE_SIZE_FIELD_ => $this->elasticsearchService->getLongMapping(), EmsFields::CONTENT_IMAGE_RESIZED_HASH_FIELD => $this->elasticsearchService->getKeywordMapping(), - EmsFields::CONTENT_FILE_TITLE => $mapping[$current->getName()], - ], + EmsFields::CONTENT_FILE_TITLE => $mapping[$current->getName()], + ], ], \array_filter($current->getMappingOptions())), ]; } diff --git a/EMS/core-bundle/src/Form/DataField/ContainerFieldType.php b/EMS/core-bundle/src/Form/DataField/ContainerFieldType.php index b64ebd923..f6ac11ed0 100644 --- a/EMS/core-bundle/src/Form/DataField/ContainerFieldType.php +++ b/EMS/core-bundle/src/Form/DataField/ContainerFieldType.php @@ -98,7 +98,7 @@ public function buildOptionsForm(FormBuilderInterface $builder, array $options): $optionsForm->get('displayOptions') ->add('icon', IconPickerType::class, ['required' => false]) ->add('language', ChoiceType::class, [ - 'required' => false, + 'required' => false, 'choices' => \array_flip(Locales::getNames()), 'choice_translation_domain' => false, ]) diff --git a/EMS/core-bundle/src/Form/DataField/TabsFieldType.php b/EMS/core-bundle/src/Form/DataField/TabsFieldType.php index 086420bd7..356f14673 100644 --- a/EMS/core-bundle/src/Form/DataField/TabsFieldType.php +++ b/EMS/core-bundle/src/Form/DataField/TabsFieldType.php @@ -113,9 +113,6 @@ public function configureOptions(OptionsResolver $resolver): void $resolver->setDefault(self::LOCALE_PREFERRED_FIRST_DISPLAY_OPTION, false); } - /** - * {@inheritDoc} - */ public static function isVirtual(array $option = []): bool { return true; diff --git a/EMS/core-bundle/src/Form/DataField/WysiwygFieldType.php b/EMS/core-bundle/src/Form/DataField/WysiwygFieldType.php index 78860eff3..b93819fa5 100644 --- a/EMS/core-bundle/src/Form/DataField/WysiwygFieldType.php +++ b/EMS/core-bundle/src/Form/DataField/WysiwygFieldType.php @@ -128,7 +128,7 @@ public function reverseViewTransform($data, FieldType $fieldType): DataField $out = \preg_replace_callback( '/('.\preg_quote(\substr($path, 0, \strlen($path) - 7), '/').')(?P[^\n\r"\'\?]*)/i', fn ($matches) => 'ems://'.$matches['key'], - $out + Type::string($out) ); if ('' === $out) { diff --git a/EMS/core-bundle/src/Form/Extension/LocaleFormExtension.php b/EMS/core-bundle/src/Form/Extension/LocaleFormExtension.php index 9ed45b483..86a0ae16e 100644 --- a/EMS/core-bundle/src/Form/Extension/LocaleFormExtension.php +++ b/EMS/core-bundle/src/Form/Extension/LocaleFormExtension.php @@ -18,7 +18,7 @@ public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults(['locale' => null]) - ->setNormalizer('locale', function (Options $options, null|string|array $value) { + ->setNormalizer('locale', function (Options $options, string|array|null $value) { try { $language = $options['language'] ?? null; diff --git a/EMS/core-bundle/src/Form/Field/EnvironmentPickerType.php b/EMS/core-bundle/src/Form/Field/EnvironmentPickerType.php index 31661ccc3..d189c1db5 100644 --- a/EMS/core-bundle/src/Form/Field/EnvironmentPickerType.php +++ b/EMS/core-bundle/src/Form/Field/EnvironmentPickerType.php @@ -3,7 +3,6 @@ namespace EMS\CoreBundle\Form\Field; use EMS\CoreBundle\Entity\Environment; -use EMS\CoreBundle\Form\DataTransformer\EntityNameModelTransformer; use EMS\CoreBundle\Service\EnvironmentService; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; diff --git a/EMS/core-bundle/src/Form/Field/FilterOptionsType.php b/EMS/core-bundle/src/Form/Field/FilterOptionsType.php index 4fa0ce1fc..2c7e451f6 100644 --- a/EMS/core-bundle/src/Form/Field/FilterOptionsType.php +++ b/EMS/core-bundle/src/Form/Field/FilterOptionsType.php @@ -35,9 +35,9 @@ class FilterOptionsType extends AbstractType 'asciifolding' => [ 'preserve_original', ], - 'synonym' => [ - 'synonyms', - ], + 'synonym' => [ + 'synonyms', + ], ]; /** @@ -54,7 +54,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'Stemmer' => 'stemmer', 'Elision' => 'elision', 'ASCII Folding' => 'asciifolding', - 'Synonym' => 'synonym', + 'Synonym' => 'synonym', ], 'attr' => [ 'class' => 'fields-to-display-by-input-value', diff --git a/EMS/core-bundle/src/Service/Revision/RevisionService.php b/EMS/core-bundle/src/Service/Revision/RevisionService.php index 25e64e422..de1bcb8be 100644 --- a/EMS/core-bundle/src/Service/Revision/RevisionService.php +++ b/EMS/core-bundle/src/Service/Revision/RevisionService.php @@ -237,7 +237,7 @@ public function getByEmsLink(EMSLink $emsLink, ?\DateTimeInterface $dateTime = n return $this->get($emsLink->getOuuid(), $emsLink->getContentType(), $dateTime); } - private function resolveEmsLink(EMSLink $emsLink): null|Revision|DocumentInterface + private function resolveEmsLink(EMSLink $emsLink): Revision|DocumentInterface|null { if (!$emsLink->isValid()) { return null;