From d7ba2d8b8946e9ba37f93ecb6eb82d8eba9023bf Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Sun, 4 Jul 2021 19:20:55 +0200 Subject: [PATCH] Leverage str_ends_with added the php80 polyfill to requirements when necessary --- OptionsResolver.php | 2 +- composer.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/OptionsResolver.php b/OptionsResolver.php index 759883d..d4e247b 100644 --- a/OptionsResolver.php +++ b/OptionsResolver.php @@ -927,7 +927,7 @@ public function offsetGet($option/*, bool $triggerDeprecation = true*/) $fmtAllowedTypes = implode('" or "', $this->allowedTypes[$option]); $fmtProvidedTypes = implode('|', array_keys($invalidTypes)); $allowedContainsArrayType = \count(array_filter($this->allowedTypes[$option], static function ($item) { - return '[]' === substr(self::TYPE_ALIASES[$item] ?? $item, -2); + return str_ends_with(self::TYPE_ALIASES[$item] ?? $item, '[]'); })) > 0; if (\is_array($value) && $allowedContainsArrayType) { diff --git a/composer.json b/composer.json index a9819bf..b63c7ee 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ } ], "require": { - "php": ">=7.1.3" + "php": ">=7.1.3", + "symfony/polyfill-php80": "^1.16" }, "autoload": { "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" },