merged branch Seldaek/rename (PR #4986)
Commits -------c81b2ad
[Form] Rename UnmodifiableFormConfig to ImmutableFormConfig274eb9e
[EventDispatcher] Rename UnmodifiableEventDispatcher to ImmutableEventDispatcher Discussion ---------- Rename unmodifiable to immutable Maybe it's just me, but it sounded really wrong. The EventDispatcher one was added in 2.1 so no BC break. I don't know about the Form one, but I guess it's just used internally anyway.
This commit is contained in:
commit
503899e26c
|
@ -13,4 +13,4 @@ CHANGELOG
|
||||||
* added GenericEvent event class
|
* added GenericEvent event class
|
||||||
* added the possibility for subscribers to subscribe several times for the
|
* added the possibility for subscribers to subscribe several times for the
|
||||||
same event
|
same event
|
||||||
* added UnmodifiableEventDispatcher
|
* added ImmutableEventDispatcher
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Symfony\Component\EventDispatcher;
|
||||||
*
|
*
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
class UnmodifiableEventDispatcher implements EventDispatcherInterface
|
class ImmutableEventDispatcher implements EventDispatcherInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The proxied dispatcher.
|
* The proxied dispatcher.
|
|
@ -12,13 +12,13 @@
|
||||||
namespace Symfony\Component\EventDispatcher\Tests;
|
namespace Symfony\Component\EventDispatcher\Tests;
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\Event;
|
use Symfony\Component\EventDispatcher\Event;
|
||||||
use Symfony\Component\EventDispatcher\UnmodifiableEventDispatcher;
|
use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
class UnmodifiableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
class ImmutableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \PHPUnit_Framework_MockObject_MockObject
|
* @var \PHPUnit_Framework_MockObject_MockObject
|
||||||
|
@ -26,14 +26,14 @@ class UnmodifiableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||||
private $innerDispatcher;
|
private $innerDispatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var UnmodifiableEventDispatcher
|
* @var ImmutableEventDispatcher
|
||||||
*/
|
*/
|
||||||
private $dispatcher;
|
private $dispatcher;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->innerDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
$this->innerDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
||||||
$this->dispatcher = new UnmodifiableEventDispatcher($this->innerDispatcher);
|
$this->dispatcher = new ImmutableEventDispatcher($this->innerDispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDispatchDelegates()
|
public function testDispatchDelegates()
|
|
@ -126,8 +126,8 @@ class Form implements \IteratorAggregate, FormInterface
|
||||||
*/
|
*/
|
||||||
public function __construct(FormConfigInterface $config)
|
public function __construct(FormConfigInterface $config)
|
||||||
{
|
{
|
||||||
if (!$config instanceof UnmodifiableFormConfig) {
|
if (!$config instanceof ImmutableFormConfig) {
|
||||||
$config = new UnmodifiableFormConfig($config);
|
$config = new ImmutableFormConfig($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compound forms always need a data mapper, otherwise calls to
|
// Compound forms always need a data mapper, otherwise calls to
|
||||||
|
@ -152,7 +152,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||||
/**
|
/**
|
||||||
* Returns the configuration of the form.
|
* Returns the configuration of the form.
|
||||||
*
|
*
|
||||||
* @return UnmodifiableFormConfig The form's immutable configuration.
|
* @return ImmutableFormConfig The form's immutable configuration.
|
||||||
*/
|
*/
|
||||||
public function getConfig()
|
public function getConfig()
|
||||||
{
|
{
|
||||||
|
@ -562,7 +562,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||||
// Synchronize representations - must not change the content!
|
// Synchronize representations - must not change the content!
|
||||||
$modelData = $this->normToModel($normData);
|
$modelData = $this->normToModel($normData);
|
||||||
$viewData = $this->normToView($normData);
|
$viewData = $this->normToView($normData);
|
||||||
|
|
||||||
$synchronized = true;
|
$synchronized = true;
|
||||||
} catch (TransformationFailedException $e) {
|
} catch (TransformationFailedException $e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
namespace Symfony\Component\Form;
|
namespace Symfony\Component\Form;
|
||||||
|
|
||||||
use Symfony\Component\Form\Util\PropertyPath;
|
use Symfony\Component\Form\Util\PropertyPath;
|
||||||
use Symfony\Component\EventDispatcher\UnmodifiableEventDispatcher;
|
use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A read-only form configuration.
|
* A read-only form configuration.
|
||||||
*
|
*
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
class UnmodifiableFormConfig implements FormConfigInterface
|
class ImmutableFormConfig implements FormConfigInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
|
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
|
||||||
|
@ -134,8 +134,8 @@ class UnmodifiableFormConfig implements FormConfigInterface
|
||||||
public function __construct(FormConfigInterface $config)
|
public function __construct(FormConfigInterface $config)
|
||||||
{
|
{
|
||||||
$dispatcher = $config->getEventDispatcher();
|
$dispatcher = $config->getEventDispatcher();
|
||||||
if (!$dispatcher instanceof UnmodifiableEventDispatcher) {
|
if (!$dispatcher instanceof ImmutableEventDispatcher) {
|
||||||
$dispatcher = new UnmodifiableEventDispatcher($dispatcher);
|
$dispatcher = new ImmutableEventDispatcher($dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->dispatcher = $dispatcher;
|
$this->dispatcher = $dispatcher;
|
Reference in New Issue