-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[OptionsResolver] support array of instance validaion #15671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
$type = isset(self::$typeAliases[$type]) ? self::$typeAliases[$type] : $type; | ||
|
||
if (substr($type, -2) === '[]') { | ||
if (is_array($value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is very hard to read what happens when if (!is_array())
.
I would omit the single return and add a if (!is_array()) {return false;}
I would like to see a profiling of the impact of this feature. Blackfire makes it easy by allowing to share a comparison graph of before vs after the change (and it is free). @webmozart do you have a test project for forms somewhere ? You used such projects in the past when working on the component. |
this PR looks interesting 👍 |
Updated PR: exception message for complex types now format the complex value's type better (cf test case where allowed type is Oh, and @stof: I'll try to do some profiling if I can find the time. Do I compare the performance to 2.7 or current 2.8? |
return is_object($value) ? get_class($value) : gettype($value); | ||
} | ||
|
||
/** | ||
* Returns a string represnetation of the complex type of the value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo here ;) (Hi Elias!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo fixed, (reading through commits in your own time, or not enough work back at NG? ;-P)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saw your name come by last week, kept an eye out. ;) Hope you are well!
This PR was merged into the 3.0-dev branch. Discussion ---------- [Finder] removed obsolete code | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- be729e3 [Finder] removed obsolete code
This PR was merged into the 3.0-dev branch. Discussion ---------- use try-finally when possible | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | I hope | Fixed tickets | n/a | License | MIT | Doc PR | n/a Found those with regex `catch \(\\Exception[^\}]+throw \$` Commits ------- 49edef2 use try-finally when possible
…urce() which was deprecated in 2.8 (mpdude) This PR was squashed before being merged into the 3.0-dev branch (closes symfony#15929). Discussion ---------- [3.0][Config] Remove ResourceInterface::getResource() which was deprecated in 2.8 | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Deprecated in symfony#15719. Commits ------- 7cef180 [3.0][Config] Remove ResourceInterface::getResource() which was deprecated in 2.8
Conflicts: composer.json src/Symfony/Bundle/FrameworkBundle/Command/RouterApacheDumperCommand.php src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php src/Symfony/Component/ClassLoader/DebugClassLoader.php src/Symfony/Component/ClassLoader/UniversalClassLoader.php src/Symfony/Component/Console/Input/StringInput.php src/Symfony/Component/Debug/DebugClassLoader.php src/Symfony/Component/DependencyInjection/Container.php src/Symfony/Component/DependencyInjection/ContainerBuilder.php src/Symfony/Component/DependencyInjection/ContainerInterface.php src/Symfony/Component/DependencyInjection/Definition.php src/Symfony/Component/DependencyInjection/DefinitionDecorator.php src/Symfony/Component/DependencyInjection/Scope.php src/Symfony/Component/DependencyInjection/ScopeInterface.php src/Symfony/Component/DomCrawler/composer.json src/Symfony/Component/EventDispatcher/Event.php src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/HttpKernel/KernelInterface.php src/Symfony/Component/HttpKernel/Log/LoggerInterface.php src/Symfony/Component/HttpKernel/Log/NullLogger.php src/Symfony/Component/Security/Core/composer.json src/Symfony/Component/Security/Resources/translations/security.tr.xlf src/Symfony/Component/Security/composer.json src/Symfony/Component/Translation/Translator.php
…(xabbuh) This PR was merged into the 3.0-dev branch. Discussion ---------- [Ldap] update branch alias for the master branch | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- b4092a7 [Ldap] update branch alias for the master branch
* 2.8: Remove profiler storages deprecate finding deep items in request parameters [CssSelector] updated README [CssSelector] remove ConverterInterface [DependencyInjection] improved a comment for reading fluency [HttpKernel] change a class in tests to avoid depending on SQLite [FrameworkBundle] Fix tests [Bridge\Twig] Fix form lowest version [ci] Display fastest results first when running tests in parallel [Yaml] Improve newline handling in folded scalar blocks
* 2.8: fixed deprecation notices fixed typos [FrameworkBundle] Tag deprecated services [VarDumper] Dump PHP+Twig code excerpts in backtraces [Config] Fix ArrayNode extra keys "ignore" and "remove" behaviors
* 2.8: add dependency required by a replaced package Add a way to group toolbar info pieces Added general sf-toolbar-block-right class Bind input before executing the COMMAND event
…terJ) This PR was merged into the 3.0-dev branch. Discussion ---------- [3.0][Security] Remove deprecated features | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- c3c5989 Remove more tests 6f9e897 Remove AbstractVoter#isGranted() method 6b6de15 Removed supports{Attribute,Class}() methods
* 2.8: Set the redraw frequency at least to 1. Setting it to 0 would otherwise produce an error. [Process] Unset callback after stop to free memory Improve error message for undefined DIC aliases [VarDumper] fixed .sf-dump z-index [Validator] Updated Luxembourgish translations for 2.8 Disallow http-kernel 3.x, fixes symfony#16837. [DependencyInjection] Validate class names and factory methods ampq → amqp Fix typo Refactoring EntityUserProvider::__construct() to not do work, cause cache warm error [Form] Add context to FormFactory deprecations CS: remove unneeded parentheses around control statements [TwigBridge] Clean deps now that 2.8.0 is tagged
* 3.0: Set the redraw frequency at least to 1. Setting it to 0 would otherwise produce an error. [Form] document changes to form type interfaces [Process] Unset callback after stop to free memory Improve error message for undefined DIC aliases [VarDumper] fixed .sf-dump z-index [Validator] Updated Luxembourgish translations for 2.8 Disallow http-kernel 3.x, fixes symfony#16837. [Config] Throw an exception when using cannotBeEmpty() on numeric or boolean nodes [DependencyInjection] Validate class names and factory methods ampq → amqp Fix typo Refactoring EntityUserProvider::__construct() to not do work, cause cache warm error [Form] Add context to FormFactory deprecations Reapply the Yaml bugfix of symfony#16745 CS: remove unneeded parentheses around control statements [DomCrawler] add upgrade hint on interface changes [TwigBridge] Clean deps now that 2.8.0 is tagged
* 2.8: [Process] Fix stopping a process on Windows [PhpUnitBridge] Add weak-verbose mode and match against message instead of test name Added a note about the new requirement iconv. Improved error messages for Yaml Deprecations Added a test case for the Logger class. [Form] Fix choices defined as Traversable CS: general fixes Suggested Process dependency
* 3.0: [Process] Fix stopping a process on Windows [PhpUnitBridge] Add weak-verbose mode and match against message instead of test name Added a note about the new requirement iconv. Improved error messages for Yaml Deprecations Added a test case for the Logger class. [Form] Fix choices defined as Traversable CS: general fixes Suggested Process dependency
* 2.8: Fix the exception message expectation
* 3.0: Fix the exception message expectation
* 2.8: Fix DeprecationErrorHandler on PHP 5.3
* 2.8: [Process] Enhance compatiblity with --enable-sigchild [Validator] removes unused variable in LengthValidator class. [FrameworkBundle] [Bug] Fixes new InputStyle bug symfony#16920 fix short array syntax for php 5.3 [Serializer] Fixed on array of objects in . [Process] Always call proc_close [Form] Add missing tests for StringUtil::fqcnToBlockPrefix() [Security] Fix a Polyfill import statement in StringUtils [Validator] Updated Luxembourgish translations for 2.8 Improved the code of the commands that use the new SymfonyStyle class disable server commands without Process component list all server command names in suggestion Suggested Process dependency disable server:run cmd without Process component Suggested Process dependency [FrameworkBundle] prevent cache:clear creating too long paths [FrameworkBundle] [Translation] Fixed translations not written when no translations directory in update command Conflicts: .travis.yml src/Symfony/Bridge/Twig/Command/LintCommand.php src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php src/Symfony/Bundle/FrameworkBundle/Command/RouterApacheDumperCommand.php src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php src/Symfony/Bundle/TwigBundle/Command/DebugCommand.php src/Symfony/Component/Security/Core/Util/StringUtils.php
* 3.0: [Process] Enhance compatiblity with --enable-sigchild [Validator] removes unused variable in LengthValidator class. [FrameworkBundle] [Bug] Fixes new InputStyle bug symfony#16920 fix short array syntax for php 5.3 [Serializer] Fixed on array of objects in . [Process] Always call proc_close [Form] Add missing tests for StringUtil::fqcnToBlockPrefix() [Security] Fix a Polyfill import statement in StringUtils [Validator] Updated Luxembourgish translations for 2.8 Improved the code of the commands that use the new SymfonyStyle class disable server commands without Process component list all server command names in suggestion Suggested Process dependency disable server:run cmd without Process component Suggested Process dependency Fix DeprecationErrorHandler on PHP 5.3 [FrameworkBundle] prevent cache:clear creating too long paths [FrameworkBundle] [Translation] Fixed translations not written when no translations directory in update command
in symfony 3.0 there is no ajax collector declared. Because of that debug toolbar do not display ajac calls
This PR was merged into the 3.0 branch. Discussion ---------- return ajax collector to collectors.php | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | symfony#16880 | License | MIT | Doc PR | in symfony 3.0 there is no ajax collector declared. Because of that debug toolbar do not display ajax calls Commits ------- 8a2c757 return ajax collector to collectors.php
…king (voronkovich) This PR was merged into the 3.0 branch. Discussion ---------- [HttpKernel] HttpCache: remove an ESI instance checking | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | no | License | MIT | Doc PR | no This checking was added by this commit symfony@32d964b, but now it's not needed Commits ------- 7528134 Removed ESI instance check
…riggerDeprecation flag (ogizanagi) This PR was merged into the 3.0 branch. Discussion ---------- [FrameworkBundle][HttpKernel] Remove remaining $triggerDeprecation flag | Q | A | ------------- | --- | Fixed tickets | n/a | License | MIT Introduced in symfony#14665, this flag controlled the deprecation notice triggering when using the `ContainerAwareHttpKernel`, in order to avoid triggering it when using this class in the Symfony framework. This class no longer exists now, neither the flag. Commits ------- ac15454 [FrameworkBundle][HttpKernel] Remove remaining $triggerDeprecation flag
Status: Reviewed I'm marking this PR as reviewed, seeing as there haven't been any comments in some time |
Travis is failing. BTW, 2.8 and 3.0 are out now. I think this PR should target 3.1 now. |
Created a new PR merging changes into 3.1 instead of 2.8 |
A suggested approach to add support for typed-arrays as allowed types, using a simple recursive method