Skip to content

Commit c169912

Browse files
Merge branch '2.7'
* 2.7: [Hackday] - add trigger error for deprecated clases. [2.3] Remove useless tests skips [ClassLoader] removes deprecated classes from documentation. Add type aliases for allowed types in OptionsResolver [ClassLoader] added missing deprecation notice. [HttpFoundation] Fix an issue caused by php's Bug #66606. [Yaml] Update README.md Don't add Accept-Range header on unsafe HTTP requests simplify hasScheme method adapted merge to 2.5 adapted previous commit for 2.3 [Security] Don't send remember cookie for sub request [Security] fixed wrong phpdoc [HttpKernel] Fix UriSigner::check when _hash is not at the end of the uri [2.3] Cleanup deprecations [Form] Add deprecation message for Form::bind() and Form::isBound() [Validator] add deprecation log (#12674) [Filesystem] Keep executable permission when a file is copied [HttpKernel] RouterListener uses "context" argument when logging route Conflicts: src/Symfony/Bridge/Twig/composer.json src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Bundle/TwigBundle/composer.json src/Symfony/Component/Debug/composer.json src/Symfony/Component/Form/Tests/AbstractLayoutTest.php src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php src/Symfony/Component/HttpKernel/CHANGELOG.md src/Symfony/Component/HttpKernel/composer.json src/Symfony/Component/Security/composer.json
2 parents b34a3a4 + 5d5a3f1 commit c169912

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

OptionsResolver.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ class OptionsResolver implements Options, OptionsResolverInterface
110110
*/
111111
private $locked = false;
112112

113+
private static $typeAliases = array(
114+
'boolean' => 'bool',
115+
'integer' => 'int',
116+
'double' => 'float',
117+
);
118+
113119
/**
114120
* Sets the default value of a given option.
115121
*
@@ -844,6 +850,8 @@ public function offsetGet($option)
844850
$valid = false;
845851

846852
foreach ($this->allowedTypes[$option] as $type) {
853+
$type = isset(self::$typeAliases[$type]) ? self::$typeAliases[$type] : $type;
854+
847855
if (function_exists($isFunction = 'is_'.$type)) {
848856
if ($isFunction($value)) {
849857
$valid = true;

Tests/OptionsResolverTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ public function testResolveLazy()
7878
), $this->resolver->resolve(array()));
7979
}
8080

81+
public function testTypeAliasesForAllowedTypes()
82+
{
83+
$this->resolver->setDefaults(array(
84+
'force' => false,
85+
));
86+
87+
$this->resolver->setAllowedTypes(array(
88+
'force' => 'boolean',
89+
));
90+
91+
$this->resolver->resolve(array(
92+
'force' => true,
93+
));
94+
}
95+
8196
public function testResolveLazyDependencyOnOptional()
8297
{
8398
$this->resolver->setDefaults(array(

0 commit comments

Comments
 (0)