From df851c12329fc24b629335e199a0244e5de18e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 29 Jan 2024 16:57:48 +0100 Subject: [PATCH] Fixed Content Type Limitation --- phpstan-baseline.neon | 5 ----- .../LimitationParser/ContentTypeLimitationParser.php | 2 +- src/lib/Core/Debug/Shell/Shell.php | 7 +++++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c3d91f51..2a20eeda 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -2690,11 +2690,6 @@ parameters: count: 1 path: src/lib/Core/Debug/Shell/Shell.php - - - message: "#^Parameter \\#2 \\$callback of function array_filter expects callable\\(int\\|string\\)\\: mixed, Closure\\(string\\)\\: bool given\\.$#" - count: 1 - path: src/lib/Core/Debug/Shell/Shell.php - - message: "#^Method Ibexa\\\\Behat\\\\Core\\\\Log\\\\Failure\\\\AnalysisResult\\:\\:getJiraReference\\(\\) should return string but returns string\\|null\\.$#" count: 1 diff --git a/src/lib/API/Context/LimitationParser/ContentTypeLimitationParser.php b/src/lib/API/Context/LimitationParser/ContentTypeLimitationParser.php index a23e2d0b..7d7ba43e 100644 --- a/src/lib/API/Context/LimitationParser/ContentTypeLimitationParser.php +++ b/src/lib/API/Context/LimitationParser/ContentTypeLimitationParser.php @@ -57,7 +57,7 @@ private function parseCommonContentTypes(string $contentTypeName): string { $contentTypeName = strtolower($contentTypeName); - if (\in_array($contentTypeName, $this->contentTypeNameIdentifierMap, true)) { + if (\array_key_exists($contentTypeName, $this->contentTypeNameIdentifierMap)) { return $this->contentTypeNameIdentifierMap[$contentTypeName]; } diff --git a/src/lib/Core/Debug/Shell/Shell.php b/src/lib/Core/Debug/Shell/Shell.php index d0dd08f2..53130ee1 100644 --- a/src/lib/Core/Debug/Shell/Shell.php +++ b/src/lib/Core/Debug/Shell/Shell.php @@ -40,9 +40,12 @@ public function addBaseImports(): void ++$level; } $dir = dirname(__DIR__, $level); - $classess = array_keys(require $dir . '/vendor/composer/autoload_classmap.php'); + $classes = array_map( + 'strval', + array_keys(require $dir . '/vendor/composer/autoload_classmap.php') + ); - $baseImports = array_filter($classess, static function (string $classFcqn) { + $baseImports = array_filter($classes, static function (string $classFcqn): bool { return strpos($classFcqn, 'Ibexa\Behat\Browser\Element') === 0 || strpos($classFcqn, 'Ibexa\Behat\Browser\Locator') === 0; });