ZF-11280: No meaningful code
Description
If you remove all occurrences of the string "case (2 <= $argc):" from the classes: Zend_Form, Zend_File_Transfer_Adapter_Abstrakt, Zend_Form_displaygroup and Zend_Form_Element, meaning the code will not change.
Comments
Posted by Anton (freeneutron) on 2011-04-12T02:56:02.000+0000
http://zendframework.ru/forum/index.php/… use google translator for details
Posted by Anton (freeneutron) on 2011-04-12T07:56:49.000+0000
I want to emphasize the difference between "switch" and "if" variants. The code:
gives the following result: case_1 case_2 default case_1 default
Posted by Aleksey 'Xerkus' Khudyakov (xerkus) on 2011-04-12T18:38:02.000+0000
Initial patch. Switch statements replaced by conditionals
Posted by Thomas Weidner (thomas) on 2011-04-16T21:39:56.000+0000
Your code is only another way to code things. Every switch statement can be recoded to an if statement. There is no pro and no con about such a change as performance is equal.
Actually I find the switch statement easier to read as you can without reading easily see what happens when you give 0, 1 or more parameters.
Closing as non-issue because it's no bug and there is no improvement by integration.
Posted by Thomas Weidner (thomas) on 2011-04-16T21:41:02.000+0000
Btw: The fall-through is intentionally as you can see when you read the code carefully
Posted by Anton (freeneutron) on 2011-04-17T07:13:09.000+0000
Ok. But if you remove the string "case (2 <= $argc):", "case (3 <= $argc):" and "default:" from clauses, referred to, it is still easier to read.
Posted by Thomas Weidner (thomas) on 2011-04-17T07:54:06.000+0000
And would then break functionallity (at last for the file component).
Posted by Anton (freeneutron) on 2011-04-17T09:32:27.000+0000
No, do not break. Because, if "1 <= $argc" is true, then PHP will execute all of the statements after the condition "case (1 <= $argc):", regardless of other case-conditions.