Code readability fixes, removed unneeded typecasts and checks
Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: - Todo: -
This commit is contained in:
parent
baa63b8077
commit
d02f17268e
@ -12,16 +12,16 @@
|
|||||||
namespace Symfony\Tests\Component\Form\Extension\Core\EventListener;
|
namespace Symfony\Tests\Component\Form\Extension\Core\EventListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is a hand written simplified version of PHP native `ArrayObject`
|
* This class is a hand written simplified version of PHP native `ArrayObject`
|
||||||
* class, to show that it behaves differently than the PHP native implementation.
|
* class, to show that it behaves differently than the PHP native implementation.
|
||||||
*/
|
*/
|
||||||
class MergeCollectionListenerCustomArrayObjectTest_CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
|
class MergeCollectionListenerCustomArrayObjectTest_CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
|
||||||
{
|
{
|
||||||
private $array;
|
private $array;
|
||||||
|
|
||||||
public function __construct(array $array = null)
|
public function __construct(array $array = null)
|
||||||
{
|
{
|
||||||
$this->array = (array) ($array ?: array());
|
$this->array = $array ?: array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($offset)
|
public function offsetExists($offset)
|
||||||
@ -45,10 +45,8 @@ class MergeCollectionListenerCustomArrayObjectTest_CustomArrayObject implements
|
|||||||
|
|
||||||
public function offsetUnset($offset)
|
public function offsetUnset($offset)
|
||||||
{
|
{
|
||||||
if (array_key_exists($offset, $this->array)) {
|
|
||||||
unset($this->array[$offset]);
|
unset($this->array[$offset]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function getIterator()
|
public function getIterator()
|
||||||
{
|
{
|
||||||
|
@ -12,16 +12,16 @@
|
|||||||
namespace Symfony\Tests\Component\Validator\Constraints;
|
namespace Symfony\Tests\Component\Validator\Constraints;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is a hand written simplified version of PHP native `ArrayObject`
|
* This class is a hand written simplified version of PHP native `ArrayObject`
|
||||||
* class, to show that it behaves different than PHP native implementation.
|
* class, to show that it behaves differently than the PHP native implementation.
|
||||||
*/
|
*/
|
||||||
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
|
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
|
||||||
{
|
{
|
||||||
private $array;
|
private $array;
|
||||||
|
|
||||||
public function __construct(array $array = null)
|
public function __construct(array $array = null)
|
||||||
{
|
{
|
||||||
$this->array = (array) ($array ?: array());
|
$this->array = $array ?: array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($offset)
|
public function offsetExists($offset)
|
||||||
@ -45,10 +45,8 @@ class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable,
|
|||||||
|
|
||||||
public function offsetUnset($offset)
|
public function offsetUnset($offset)
|
||||||
{
|
{
|
||||||
if (array_key_exists($offset, $this->array)) {
|
|
||||||
unset($this->array[$offset]);
|
unset($this->array[$offset]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function getIterator()
|
public function getIterator()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user