Revert "feature #18977 [PropertyAccess] Add missing arguments to PropertyAccess::createPropertyAccessor() (chalasr)"

This reverts commit 86eb7a3339, reversing
changes made to 856c9f6024.
This commit is contained in:
Fabien Potencier 2016-06-21 08:31:10 +02:00
parent f2ee67feae
commit a4ce063029
2 changed files with 4 additions and 54 deletions

View File

@ -21,35 +21,21 @@ final class PropertyAccess
/** /**
* Creates a property accessor with the default configuration. * Creates a property accessor with the default configuration.
* *
* @param bool $throwExceptionOnInvalidIndex
*
* @return PropertyAccessor The new property accessor * @return PropertyAccessor The new property accessor
*/ */
public static function createPropertyAccessor($throwExceptionOnInvalidIndex = false, $magicCall = false) public static function createPropertyAccessor()
{ {
return self::createPropertyAccessorBuilder($throwExceptionOnInvalidIndex, $magicCall)->getPropertyAccessor(); return self::createPropertyAccessorBuilder()->getPropertyAccessor();
} }
/** /**
* Creates a property accessor builder. * Creates a property accessor builder.
* *
* @param bool $enableExceptionOnInvalidIndex
*
* @return PropertyAccessorBuilder The new property accessor builder * @return PropertyAccessorBuilder The new property accessor builder
*/ */
public static function createPropertyAccessorBuilder($enableExceptionOnInvalidIndex = false, $enableMagicCall = false) public static function createPropertyAccessorBuilder()
{ {
$propertyAccessorBuilder = new PropertyAccessorBuilder(); return new PropertyAccessorBuilder();
if ($enableExceptionOnInvalidIndex) {
$propertyAccessorBuilder->enableExceptionOnInvalidIndex();
}
if ($enableMagicCall) {
$propertyAccessorBuilder->enableMagicCall();
}
return $propertyAccessorBuilder;
} }
/** /**

View File

@ -1,36 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\PropertyAccess\Tests;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessor;
/**
* @author Robin Chalas <robin.chalas@gmail.com
*/
final class PropertyAccessTest extends \PHPUnit_Framework_TestCase
{
public function testCreatePropertyAccessor()
{
$this->assertInstanceOf(PropertyAccessor::class, PropertyAccess::createPropertyAccessor());
}
public function testCreatePropertyAccessorWithExceptionOnInvalidIndex()
{
$this->assertInstanceOf(PropertyAccessor::class, PropertyAccess::createPropertyAccessor(true));
}
public function testCreatePropertyAccessorWithMagicCallEnabled()
{
$this->assertInstanceOf(PropertyAccessor::class, PropertyAccess::createPropertyAccessor(false, true));
}
}