diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f2cb63c381..677fef7241 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -12235,11 +12235,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\ContentExtension\\:\\:getFunctions\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\ContentExtension\\:\\:getTranslatedField\\(\\) should return Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Field but returns Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Field\\|null\\.$#" count: 1 @@ -12250,26 +12245,11 @@ parameters: count: 2 path: src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\ContentExtension\\:\\:\\$logger \\(Psr\\\\Log\\\\LoggerInterface\\) does not accept Psr\\\\Log\\\\LoggerInterface\\|null\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\CoreExtension\\:\\:getGlobals\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: src/lib/MVC/Symfony/Templating/Twig/Extension/CoreExtension.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\DataAttributesExtension\\:\\:getFilters\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Templating\\\\Twig\\\\Extension\\\\DataAttributesExtension\\:\\:serializeDataAttributes\\(\\) has parameter \\$dataAttributes with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php - - message: "#^Parameter \\#1 \\$string of function htmlspecialchars expects string, string\\|false given\\.$#" count: 1 @@ -21837,7 +21817,7 @@ parameters: - message: "#^Cannot access offset 0 on array\\\\|bool\\|float\\|int\\|string\\.$#" - count: 2 + count: 1 path: src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsMainLocation.php - @@ -21897,7 +21877,7 @@ parameters: - message: "#^Cannot access offset 0 on array\\\\|bool\\|float\\|int\\|string\\.$#" - count: 2 + count: 1 path: src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Visibility.php - diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php index b064af4def..9dd6641cda 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php @@ -17,6 +17,7 @@ use Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList; use Ibexa\Core\Helper\TranslationHelper; use Psr\Log\LoggerInterface; +use Psr\Log\NullLogger; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; @@ -51,15 +52,13 @@ public function __construct( $this->translationHelper = $translationHelper; $this->fieldHelper = $fieldHelper; $this->fieldsGroupsList = $fieldsGroupsList; - $this->logger = $logger; + $this->logger = $logger ?? new NullLogger(); } /** * Returns a list of functions to add to the existing list. - * - * @return array */ - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction( diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php index c059f7797c..741e112c9b 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/DataAttributesExtension.php @@ -18,8 +18,6 @@ class DataAttributesExtension extends AbstractExtension { /** * Returns a list of functions to add to the existing list. - * - * @return array */ public function getFilters(): array { @@ -36,7 +34,7 @@ public function getFilters(): array * Processes an associative list of data attributes and returns them as HTML attributes list * in the form of data-="". * - * @param array $dataAttributes + * @param array $dataAttributes * * @return string */ diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php index 113aeee275..a119bfd4ac 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php @@ -31,7 +31,7 @@ public function __construct(VariationHandler $imageVariationService, AssetMapper $this->assetMapper = $assetMapper; } - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction( diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php b/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php index aa8476419e..da79e8c9ee 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php @@ -71,10 +71,7 @@ protected function getExtensions() ]; } - /** - * @return string - */ - protected function getFixturesDir() + protected function getFixturesDir(): string { return __DIR__ . '/_fixtures/functions/ibexa_file_size'; }