From 9b0cba1a7306f1d747b736c05b92be5367871d7d Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 11 Dec 2024 13:30:21 +0100 Subject: [PATCH] added Helpers::isWindows() --- src/Utils/Finder.php | 2 +- src/Utils/Helpers.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Utils/Finder.php b/src/Utils/Finder.php index a496528af..841c2878d 100644 --- a/src/Utils/Finder.php +++ b/src/Utils/Finder.php @@ -505,6 +505,6 @@ private function buildPattern(string $mask): string '\-' => '-', ], ); - return '#' . $anchor . $pattern . '$#D' . (defined('PHP_WINDOWS_VERSION_BUILD') ? 'i' : ''); + return '#' . $anchor . $pattern . '$#D' . (Helpers::isWindows() ? 'i' : ''); } } diff --git a/src/Utils/Helpers.php b/src/Utils/Helpers.php index b3586c16c..9ca599013 100644 --- a/src/Utils/Helpers.php +++ b/src/Utils/Helpers.php @@ -52,6 +52,15 @@ public static function falseToNull(mixed $value): mixed } + /** + * Determines if the script is running on a Windows operating system. + */ + public static function isWindows(): bool + { + return defined('PHP_WINDOWS_VERSION_BUILD'); + } + + /** * Returns value clamped to the inclusive range of min and max. */