From f7e1fd68b8a5385c1c5c128039fee55d559ce812 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Sat, 17 Feb 2024 17:21:10 +0100 Subject: [PATCH] allow installation with symfony 6 --- composer.json | 30 +++++++++---------- .../Phpcr/NonTranslatableMetadataListener.php | 2 +- .../Phpcr/TranslatableMetadataListener.php | 2 +- src/Templating/Helper/Cmf.php | 28 +++++++++-------- 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/composer.json b/composer.json index 2fc3dd0..0eb4ae1 100644 --- a/composer.json +++ b/composer.json @@ -15,30 +15,30 @@ ], "require": { "php": "^7.4 || ^8.0", - "symfony/framework-bundle": "^4.4 || ^5.0", - "symfony/security-core": "^4.4 || ^5.0" + "symfony/framework-bundle": "^5.4 || ^6.4", + "symfony/security-core": "^5.4 || ^6.4" }, "require-dev": { - "jackalope/jackalope-doctrine-dbal": "^1.3", - "symfony/security-bundle": "^4.4 || ^5.0", - "symfony/phpunit-bridge": "^4.4.34 || ^5.0", + "jackalope/jackalope-doctrine-dbal": "^1.3 || ^2.0", + "symfony/security-bundle": "^5.4 || ^6.4", + "symfony/phpunit-bridge": "^7.0", "mockery/mockery": "^1.4.1", "symfony-cmf/routing-bundle": "^2.1.0", "symfony-cmf/testing": "^4.0.0", - "doctrine/dbal": "^2.5", + "doctrine/dbal": "^3.8.1 || ^4.0", "doctrine/doctrine-bundle": "^2.0", "doctrine/phpcr-odm": "^1.4|^2.0 ", "doctrine/phpcr-bundle": "^2.3.0", - "symfony/browser-kit": "^4.4 || ^5.0", - "symfony/form": "^4.4 || ^5.0", - "symfony/monolog-bridge": "^4.4 || ^5.0", + "symfony/browser-kit": "^5.4 || ^6.4", + "symfony/form": "^5.4 || ^6.4", + "symfony/monolog-bridge": "^5.4 || ^6.4", "symfony/monolog-bundle": "^3.0", - "symfony/templating": "^4.4 || ^5.0", - "symfony/translation": "^4.4 || ^5.0", - "symfony/twig-bundle": "^4.4 || ^5.0", - "symfony/validator": "^4.4 || ^5.0", - "symfony/yaml": "^4.4 || ^5.0", - "symfony/asset": "^4.4 || ^5.0" + "symfony/templating": "^5.4 || ^6.4", + "symfony/translation": "^5.4 || ^6.4", + "symfony/twig-bundle": "^5.4 || ^6.4", + "symfony/validator": "^5.4 || ^6.4", + "symfony/yaml": "^5.4 || ^6.4", + "symfony/asset": "^5.4 || ^6.4" }, "suggest": { "symfony/twig-bundle": "To get access to the CMF twig extension (^4.4 || ^5.0)", diff --git a/src/Doctrine/Phpcr/NonTranslatableMetadataListener.php b/src/Doctrine/Phpcr/NonTranslatableMetadataListener.php index 7fef30b..0447f6f 100644 --- a/src/Doctrine/Phpcr/NonTranslatableMetadataListener.php +++ b/src/Doctrine/Phpcr/NonTranslatableMetadataListener.php @@ -39,7 +39,7 @@ public function getSubscribedEvents() */ public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) { - /** @var $meta ClassMetadata */ + /** @var ClassMetadata $meta */ $meta = $eventArgs->getClassMetadata(); if (!$meta->translator) { diff --git a/src/Doctrine/Phpcr/TranslatableMetadataListener.php b/src/Doctrine/Phpcr/TranslatableMetadataListener.php index d5e1aab..3524830 100644 --- a/src/Doctrine/Phpcr/TranslatableMetadataListener.php +++ b/src/Doctrine/Phpcr/TranslatableMetadataListener.php @@ -51,7 +51,7 @@ public function getSubscribedEvents() */ public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) { - /** @var $meta ClassMetadata */ + /** @var ClassMetadata $meta */ $meta = $eventArgs->getClassMetadata(); if ($meta->getReflectionClass()->implementsInterface(TranslatableInterface::class)) { diff --git a/src/Templating/Helper/Cmf.php b/src/Templating/Helper/Cmf.php index eb81d69..f51feba 100644 --- a/src/Templating/Helper/Cmf.php +++ b/src/Templating/Helper/Cmf.php @@ -180,7 +180,7 @@ private function getDocument($document, ?bool $ignoreRole = false, ?string $clas try { $document = $this->getDm()->find(null, $document); } catch (MissingTranslationException $e) { - return; + return null; } } @@ -193,7 +193,7 @@ private function getDocument($document, ?bool $ignoreRole = false, ?string $clas || (true === $ignoreRole && !$this->publishWorkflowChecker->isGranted(PublishWorkflowChecker::VIEW_ANONYMOUS_ATTRIBUTE, $document)) || (null !== $class && !($document instanceof $class)) ) { - return; + return null; } return $document; @@ -239,7 +239,7 @@ public function findMany(array $paths = [], $limit = false, $offset = false, ?bo * If you need the bypass role, you will have a firewall configured and can * simply use {{ is_granted('VIEW', document) }} * - * @param object $document + * @param ?object $document */ public function isPublished($document): bool { @@ -492,7 +492,7 @@ private function checkChildren(array $childNames, string $path, ?bool $ignoreRol } } - return; + return null; } /** @@ -522,7 +522,7 @@ private function traversePrevDepth(?int $depth, int $anchorDepth, array $childNa } } - return; + return null; } /** @@ -543,7 +543,7 @@ private function searchDepthPrev($path, $anchor, ?int $depth = null, ?bool $igno } if (null === $path || '/' === $path) { - return; + return null; } $node = $this->getDm()->getPhpcrSession()->getNode($path); @@ -557,7 +557,7 @@ private function searchDepthPrev($path, $anchor, ?int $depth = null, ?bool $igno } if ($path === $anchor) { - return; + return null; } $parent = $node->getParent(); @@ -599,7 +599,7 @@ private function searchDepthPrev($path, $anchor, ?int $depth = null, ?bool $igno } } - return; + return null; } /** @@ -620,7 +620,7 @@ private function searchDepthNext($path, $anchor, ?int $depth = null, ?bool $igno } if (null === $path || '/' === $path) { - return; + return null; } $node = $this->getDm()->getPhpcrSession()->getNode($path); @@ -660,7 +660,7 @@ private function searchDepthNext($path, $anchor, ?int $depth = null, ?bool $igno while ('/' !== $parentPath) { $parent = $parent->getParent(); if (false === strpos($parent->getPath(), $anchor)) { - return; + return null; } $childNames = $parent->getNodeNames()->getArrayCopy(); @@ -673,7 +673,7 @@ private function searchDepthNext($path, $anchor, ?int $depth = null, ?bool $igno } } - return; + return null; } /** @@ -693,7 +693,7 @@ private function search($path, ?bool $reverse = false, ?bool $ignoreRole = false } if (null === $path || '/' === $path) { - return; + return null; } $node = $this->getDm()->getPhpcrSession()->getNode($path); @@ -777,6 +777,8 @@ public function getPrevLinkable($current, $anchor = null, ?int $depth = null, ?b $current = $candidate; } + + return null; } /** @@ -807,5 +809,7 @@ public function getNextLinkable($current, $anchor = null, ?int $depth = null, ?b $current = $candidate; } + + return null; } }