Skip to content

Commit d7ba2d8

Browse files
committed
Leverage str_ends_with
added the php80 polyfill to requirements when necessary
1 parent d330017 commit d7ba2d8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

OptionsResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ public function offsetGet($option/*, bool $triggerDeprecation = true*/)
927927
$fmtAllowedTypes = implode('" or "', $this->allowedTypes[$option]);
928928
$fmtProvidedTypes = implode('|', array_keys($invalidTypes));
929929
$allowedContainsArrayType = \count(array_filter($this->allowedTypes[$option], static function ($item) {
930-
return '[]' === substr(self::TYPE_ALIASES[$item] ?? $item, -2);
930+
return str_ends_with(self::TYPE_ALIASES[$item] ?? $item, '[]');
931931
})) > 0;
932932

933933
if (\is_array($value) && $allowedContainsArrayType) {

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=7.1.3"
19+
"php": ">=7.1.3",
20+
"symfony/polyfill-php80": "^1.16"
2021
},
2122
"autoload": {
2223
"psr-4": { "Symfony\\Component\\OptionsResolver\\": "" },

0 commit comments

Comments
 (0)