From 32445023d820fbed2a4aa9fac89b675b585d0ec4 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 17 Aug 2023 21:36:47 +0200 Subject: [PATCH] `strip_tags()/$allowed_tags` can accept arrays since 7.4 Fixes vimeo/psalm#4317 --- src/Psalm/Config.php | 4 ++++ stubs/Php74.phpstub | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 stubs/Php74.phpstub diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 32ff16ea8cf..1439c9bb335 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -2258,6 +2258,10 @@ public function visitStubFiles(Codebase $codebase, ?Progress $progress = null): $stubsDir . 'SPL.phpstub', ]; + if ($codebase->analysis_php_version_id >= 7_04_00) { + $this->internal_stubs[] = $stubsDir . 'Php74.phpstub'; + } + if ($codebase->analysis_php_version_id >= 8_00_00) { $this->internal_stubs[] = $stubsDir . 'CoreGenericAttributes.phpstub'; $this->internal_stubs[] = $stubsDir . 'Php80.phpstub'; diff --git a/stubs/Php74.phpstub b/stubs/Php74.phpstub new file mode 100644 index 00000000000..4ade3a6da4c --- /dev/null +++ b/stubs/Php74.phpstub @@ -0,0 +1,11 @@ + return + * + * @param null|string|array $allowed_tags + */ +function strip_tags(string $string, null|string|array $allowed_tags = null) : string {}