Closed TysonAndre closed 5 years ago
Okay. Without this change to src/
, the unit test I added would fail.
I don't see many uses of new ElementFactory
directly after a quick search, and none of them had args.
There was 1 error:
1) ZendTest\Form\FormElementManagerTest::testCreationOptionsHandled
TypeError: Argument 1 passed to Zend\Form\ElementFactory::setCreationOptions() must be of the type array, object given, called in /path/to/zend-form/src/ElementFactory.php on line 41
/path/to/zend-form/src/ElementFactory.php:119
/path/to/zend-form/src/ElementFactory.php:41
/path/to/zend-form/test/ElementFactoryTest.php:36
/path/to/zend-form/test/ElementFactoryTest.php:26
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
Thanks, @TysonAndre!
In setCreationOptions(array $options), a TypeError would be thrown if it was anything other than an array.
Move the exceptions and traversable checks to the constructor.
(This impossible condition was detected by Phan)
Provide a narrative description of what you are trying to accomplish:
[x] Are you fixing a bug?
__construct
will convert traversables to arrays.master
branch, and submit against that branch.CHANGELOG.md
entry for the fix.[ ] Are you creating a new feature?
develop
branch, and submit against that branch.CHANGELOG.md
entry for the new feature.[ ] Is this related to quality assurance?
[ ] Is this related to documentation?