diff --git a/Classes/Fusion/Helper/ImageHelper.php b/Classes/Fusion/Helper/ImageHelper.php index 51ebe3c..179d0fd 100644 --- a/Classes/Fusion/Helper/ImageHelper.php +++ b/Classes/Fusion/Helper/ImageHelper.php @@ -21,11 +21,8 @@ class ImageHelper implements ProtectedContextAwareInterface { - /** - * @Flow\Inject - * @var ThumbnailService - */ - protected $thumbnailService; + #[Flow\Inject] + protected ThumbnailService $thumbnailService; /** * @param AssetInterface $asset @@ -54,8 +51,7 @@ public function createThumbnail( $async = false, $quality = null, $format = null - ) - { + ): ?ImageInterface { if (!empty($preset)) { $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset); } else { @@ -82,9 +78,8 @@ public function createThumbnail( * All methods are considered safe * * @param string $methodName - * @return boolean */ - public function allowsCallOfMethod($methodName) + public function allowsCallOfMethod($methodName): bool { return true; } diff --git a/Classes/Fusion/XmlSitemapUrlsImplementation.php b/Classes/Fusion/XmlSitemapUrlsImplementation.php index 57170cf..8777a07 100644 --- a/Classes/Fusion/XmlSitemapUrlsImplementation.php +++ b/Classes/Fusion/XmlSitemapUrlsImplementation.php @@ -24,47 +24,35 @@ use Neos\Flow\Persistence\Doctrine\PersistenceManager; use Neos\Fusion\FusionObjects\AbstractFusionObject; use Neos\Media\Domain\Model\ImageInterface; +use Neos\Neos\Utility\NodeTypeWithFallbackProvider; use Neos\Utility\Exception\PropertyNotAccessibleException; class XmlSitemapUrlsImplementation extends AbstractFusionObject { - #[Flow\Inject(lazy: false)] + use NodeTypeWithFallbackProvider; + + #[Flow\Inject] protected ContentRepositoryRegistry $contentRepositoryRegistry; - /** - * @var PersistenceManager - */ #[Flow\Inject(lazy: true)] - protected $persistenceManager; + protected PersistenceManager $persistenceManager; /** * @var array> */ - protected $assetPropertiesByNodeType = []; + protected array $assetPropertiesByNodeType = []; - /** - * @var bool - */ - protected $renderHiddenInIndex; + protected ?bool $renderHiddenInIndex = null; - /** - * @var bool - */ - protected $includeImageUrls; + protected ?bool $includeImageUrls = null; - /** - * @var Node - */ - protected $startingPoint; + protected ?Node $startingPoint = null; /** - * @var array + * @var array|null */ - protected $items; + protected ?array $items = null; - /** - * @return bool - */ public function getIncludeImageUrls(): bool { if ($this->includeImageUrls === null) { @@ -74,9 +62,6 @@ public function getIncludeImageUrls(): bool return $this->includeImageUrls; } - /** - * @return bool - */ public function getRenderHiddenInIndex(): bool { if ($this->renderHiddenInIndex === null) { @@ -102,6 +87,7 @@ public function getStartingPoint(): Node * Evaluate this Fusion object and return the result * * @return array + * @throws PropertyNotAccessibleException */ public function evaluate(): array { @@ -151,6 +137,9 @@ private function getAssetPropertiesForNodeType(NodeType $nodeType): array return $this->assetPropertiesByNodeType[$nodeType->name->value]; } + /** + * @throws PropertyNotAccessibleException + */ protected function collectItems(array &$items, Subtree $subtree): void { $node = $subtree->node; @@ -205,7 +194,7 @@ protected function collectItems(array &$items, Subtree $subtree): void protected function resolveImages(Subtree $subtree, array &$item): void { $node = $subtree->node; - $assetPropertiesForNodeType = $this->getAssetPropertiesForNodeType($node->nodeType); + $assetPropertiesForNodeType = $this->getAssetPropertiesForNodeType($this->getNodeType($node)); foreach ($assetPropertiesForNodeType as $propertyName) { if (is_array($node->getProperty($propertyName)) && !empty($node->getProperty($propertyName))) { @@ -230,7 +219,7 @@ protected function resolveImages(Subtree $subtree, array &$item): void */ protected function isDocumentNodeToBeIndexed(Node $node): bool { - return !$node->nodeType->isOfType('Neos.Seo:NoindexMixin') + return !$this->getNodeType($node)->isOfType('Neos.Seo:NoindexMixin') && ($this->getRenderHiddenInIndex() || $node->getProperty('hiddenInIndex') !== true) && $node->getProperty('metaRobotsNoindex') !== true && (