-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[OptionsResolver] fixed two bugs and applied optimization #4388
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
I just tested this on my machine, and static calls are a tiny bit faster here, although this is really irrelevant for practical use. Even though I dislike useless micro-optimizations like this, I'm ok with this PR in general. |
I didn't say that's an optimization in the first place. (The optimization was the removal of a variable assignment) |
Please merge before 4387 |
Commits ------- bad4a1f [OptionsResolver] CS fix in LazyOption a54ea1b [OptionsResolver] small optimization in Options class 104dcf2 [OptionsResolver] fixed bugs concerning required options 1bfcff4 [OptionsResolver] added failing test cases to demonstrate two bugs 37a3a29 [OptionsResolver] optimized validation Discussion ---------- [OptionsResolver] fixed two bugs and applied optimization The first commit optimizes the validation in OptionsResolver by removing several unneeded method calls (without changing anything semantically). Then I recognized two bugs in the current code that I wrote failing test cases for in the second commit. 1. setAllowedValues wrongly validated missing options 2. required options with defaults were considered missing by `resolve` (contrary to the `isRequired` method) The third commit fixes these bugs. The forth commit applies a small optimization in Options and uses a static function call for a static function. --------------------------------------------------------------------------- by travisbot at 2012-05-24T03:39:34Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1418785) (merged a54ea1b into b07fb3c). --------------------------------------------------------------------------- by travisbot at 2012-05-24T05:22:33Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1419232) (merged bad4a1f into b07fb3c). --------------------------------------------------------------------------- by bschussek at 2012-05-24T06:20:02Z I just tested this on my machine, and static calls are a tiny bit faster here, although this is really irrelevant for practical use. Even though I dislike useless micro-optimizations like this, I'm ok with this PR in general. --------------------------------------------------------------------------- by Tobion at 2012-05-24T13:23:11Z I didn't say that's an optimization in the first place. (The optimization was the removal of a variable assignment) I just changed it because in other PRs I've been told, static functions should be called in a static way. --------------------------------------------------------------------------- by Tobion at 2012-05-24T23:36:13Z Please merge before 4387
The first commit optimizes the validation in OptionsResolver by removing several unneeded method calls (without changing anything semantically).
Then I recognized two bugs in the current code that I wrote failing test cases for in the second commit.
resolve
(contrary to theisRequired
method)The third commit fixes these bugs.
The forth commit applies a small optimization in Options and uses a static function call for a static function.