添加网站文件
This commit is contained in:
65
vendor/symfony/property-access/Tests/Fixtures/NonTraversableArrayObject.php
vendored
Normal file
65
vendor/symfony/property-access/Tests/Fixtures/NonTraversableArrayObject.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?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\Fixtures;
|
||||
|
||||
/**
|
||||
* 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 NonTraversableArrayObject implements \ArrayAccess, \Countable, \Serializable
|
||||
{
|
||||
private $array;
|
||||
|
||||
public function __construct(array $array = null)
|
||||
{
|
||||
$this->array = $array ?: array();
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return array_key_exists($offset, $this->array);
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->array[$offset];
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if (null === $offset) {
|
||||
$this->array[] = $value;
|
||||
} else {
|
||||
$this->array[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->array[$offset]);
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
return \count($this->array);
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
return serialize($this->array);
|
||||
}
|
||||
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$this->array = (array) unserialize((string) $serialized);
|
||||
}
|
||||
}
|
||||
36
vendor/symfony/property-access/Tests/Fixtures/ReturnTyped.php
vendored
Normal file
36
vendor/symfony/property-access/Tests/Fixtures/ReturnTyped.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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\Fixtures;
|
||||
|
||||
/**
|
||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||
*/
|
||||
class ReturnTyped
|
||||
{
|
||||
public function getFoos(): array
|
||||
{
|
||||
return 'It doesn\'t respect the return type on purpose';
|
||||
}
|
||||
|
||||
public function addFoo(\DateTime $dateTime)
|
||||
{
|
||||
}
|
||||
|
||||
public function removeFoo(\DateTime $dateTime)
|
||||
{
|
||||
}
|
||||
|
||||
public function setName($name): self
|
||||
{
|
||||
return 'This does not respect the return type on purpose.';
|
||||
}
|
||||
}
|
||||
176
vendor/symfony/property-access/Tests/Fixtures/TestClass.php
vendored
Normal file
176
vendor/symfony/property-access/Tests/Fixtures/TestClass.php
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
<?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\Fixtures;
|
||||
|
||||
class TestClass
|
||||
{
|
||||
public $publicProperty;
|
||||
protected $protectedProperty;
|
||||
private $privateProperty;
|
||||
|
||||
private $publicAccessor;
|
||||
private $publicMethodAccessor;
|
||||
private $publicGetSetter;
|
||||
private $publicAccessorWithDefaultValue;
|
||||
private $publicAccessorWithRequiredAndDefaultValue;
|
||||
private $publicAccessorWithMoreRequiredParameters;
|
||||
private $publicIsAccessor;
|
||||
private $publicHasAccessor;
|
||||
private $publicGetter;
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->publicProperty = $value;
|
||||
$this->publicAccessor = $value;
|
||||
$this->publicMethodAccessor = $value;
|
||||
$this->publicGetSetter = $value;
|
||||
$this->publicAccessorWithDefaultValue = $value;
|
||||
$this->publicAccessorWithRequiredAndDefaultValue = $value;
|
||||
$this->publicAccessorWithMoreRequiredParameters = $value;
|
||||
$this->publicIsAccessor = $value;
|
||||
$this->publicHasAccessor = $value;
|
||||
$this->publicGetter = $value;
|
||||
}
|
||||
|
||||
public function setPublicAccessor($value)
|
||||
{
|
||||
$this->publicAccessor = $value;
|
||||
}
|
||||
|
||||
public function setPublicAccessorWithDefaultValue($value = null)
|
||||
{
|
||||
$this->publicAccessorWithDefaultValue = $value;
|
||||
}
|
||||
|
||||
public function setPublicAccessorWithRequiredAndDefaultValue($value, $optional = null)
|
||||
{
|
||||
$this->publicAccessorWithRequiredAndDefaultValue = $value;
|
||||
}
|
||||
|
||||
public function setPublicAccessorWithMoreRequiredParameters($value, $needed)
|
||||
{
|
||||
$this->publicAccessorWithMoreRequiredParameters = $value;
|
||||
}
|
||||
|
||||
public function getPublicAccessor()
|
||||
{
|
||||
return $this->publicAccessor;
|
||||
}
|
||||
|
||||
public function getPublicAccessorWithDefaultValue()
|
||||
{
|
||||
return $this->publicAccessorWithDefaultValue;
|
||||
}
|
||||
|
||||
public function getPublicAccessorWithRequiredAndDefaultValue()
|
||||
{
|
||||
return $this->publicAccessorWithRequiredAndDefaultValue;
|
||||
}
|
||||
|
||||
public function getPublicAccessorWithMoreRequiredParameters()
|
||||
{
|
||||
return $this->publicAccessorWithMoreRequiredParameters;
|
||||
}
|
||||
|
||||
public function setPublicIsAccessor($value)
|
||||
{
|
||||
$this->publicIsAccessor = $value;
|
||||
}
|
||||
|
||||
public function isPublicIsAccessor()
|
||||
{
|
||||
return $this->publicIsAccessor;
|
||||
}
|
||||
|
||||
public function setPublicHasAccessor($value)
|
||||
{
|
||||
$this->publicHasAccessor = $value;
|
||||
}
|
||||
|
||||
public function hasPublicHasAccessor()
|
||||
{
|
||||
return $this->publicHasAccessor;
|
||||
}
|
||||
|
||||
public function publicGetSetter($value = null)
|
||||
{
|
||||
if (null !== $value) {
|
||||
$this->publicGetSetter = $value;
|
||||
}
|
||||
|
||||
return $this->publicGetSetter;
|
||||
}
|
||||
|
||||
public function getPublicMethodMutator()
|
||||
{
|
||||
return $this->publicGetSetter;
|
||||
}
|
||||
|
||||
protected function setProtectedAccessor($value)
|
||||
{
|
||||
}
|
||||
|
||||
protected function getProtectedAccessor()
|
||||
{
|
||||
return 'foobar';
|
||||
}
|
||||
|
||||
protected function setProtectedIsAccessor($value)
|
||||
{
|
||||
}
|
||||
|
||||
protected function isProtectedIsAccessor()
|
||||
{
|
||||
return 'foobar';
|
||||
}
|
||||
|
||||
protected function setProtectedHasAccessor($value)
|
||||
{
|
||||
}
|
||||
|
||||
protected function hasProtectedHasAccessor()
|
||||
{
|
||||
return 'foobar';
|
||||
}
|
||||
|
||||
private function setPrivateAccessor($value)
|
||||
{
|
||||
}
|
||||
|
||||
private function getPrivateAccessor()
|
||||
{
|
||||
return 'foobar';
|
||||
}
|
||||
|
||||
private function setPrivateIsAccessor($value)
|
||||
{
|
||||
}
|
||||
|
||||
private function isPrivateIsAccessor()
|
||||
{
|
||||
return 'foobar';
|
||||
}
|
||||
|
||||
private function setPrivateHasAccessor($value)
|
||||
{
|
||||
}
|
||||
|
||||
private function hasPrivateHasAccessor()
|
||||
{
|
||||
return 'foobar';
|
||||
}
|
||||
|
||||
public function getPublicGetter()
|
||||
{
|
||||
return $this->publicGetter;
|
||||
}
|
||||
}
|
||||
27
vendor/symfony/property-access/Tests/Fixtures/TestClassIsWritable.php
vendored
Normal file
27
vendor/symfony/property-access/Tests/Fixtures/TestClassIsWritable.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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\Fixtures;
|
||||
|
||||
class TestClassIsWritable
|
||||
{
|
||||
protected $value;
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
37
vendor/symfony/property-access/Tests/Fixtures/TestClassMagicCall.php
vendored
Normal file
37
vendor/symfony/property-access/Tests/Fixtures/TestClassMagicCall.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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\Fixtures;
|
||||
|
||||
class TestClassMagicCall
|
||||
{
|
||||
private $magicCallProperty;
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->magicCallProperty = $value;
|
||||
}
|
||||
|
||||
public function __call($method, array $args)
|
||||
{
|
||||
if ('getMagicCallProperty' === $method) {
|
||||
return $this->magicCallProperty;
|
||||
}
|
||||
|
||||
if ('getConstantMagicCallProperty' === $method) {
|
||||
return 'constant value';
|
||||
}
|
||||
|
||||
if ('setMagicCallProperty' === $method) {
|
||||
$this->magicCallProperty = reset($args);
|
||||
}
|
||||
}
|
||||
}
|
||||
42
vendor/symfony/property-access/Tests/Fixtures/TestClassMagicGet.php
vendored
Normal file
42
vendor/symfony/property-access/Tests/Fixtures/TestClassMagicGet.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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\Fixtures;
|
||||
|
||||
class TestClassMagicGet
|
||||
{
|
||||
private $magicProperty;
|
||||
|
||||
public $publicProperty;
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->magicProperty = $value;
|
||||
}
|
||||
|
||||
public function __set($property, $value)
|
||||
{
|
||||
if ('magicProperty' === $property) {
|
||||
$this->magicProperty = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function __get($property)
|
||||
{
|
||||
if ('magicProperty' === $property) {
|
||||
return $this->magicProperty;
|
||||
}
|
||||
|
||||
if ('constantMagicProperty' === $property) {
|
||||
return 'constant value';
|
||||
}
|
||||
}
|
||||
}
|
||||
32
vendor/symfony/property-access/Tests/Fixtures/TestClassSetValue.php
vendored
Normal file
32
vendor/symfony/property-access/Tests/Fixtures/TestClassSetValue.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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\Fixtures;
|
||||
|
||||
class TestClassSetValue
|
||||
{
|
||||
protected $value;
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
31
vendor/symfony/property-access/Tests/Fixtures/Ticket5775Object.php
vendored
Normal file
31
vendor/symfony/property-access/Tests/Fixtures/Ticket5775Object.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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\Fixtures;
|
||||
|
||||
class Ticket5775Object
|
||||
{
|
||||
private $property;
|
||||
|
||||
public function getProperty()
|
||||
{
|
||||
return $this->property;
|
||||
}
|
||||
|
||||
private function setProperty()
|
||||
{
|
||||
}
|
||||
|
||||
public function __set($property, $value)
|
||||
{
|
||||
$this->$property = $value;
|
||||
}
|
||||
}
|
||||
70
vendor/symfony/property-access/Tests/Fixtures/TraversableArrayObject.php
vendored
Normal file
70
vendor/symfony/property-access/Tests/Fixtures/TraversableArrayObject.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?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\Fixtures;
|
||||
|
||||
/**
|
||||
* 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 TraversableArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
|
||||
{
|
||||
private $array;
|
||||
|
||||
public function __construct(array $array = null)
|
||||
{
|
||||
$this->array = $array ?: array();
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return array_key_exists($offset, $this->array);
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->array[$offset];
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if (null === $offset) {
|
||||
$this->array[] = $value;
|
||||
} else {
|
||||
$this->array[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->array[$offset]);
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->array);
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
return \count($this->array);
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
return serialize($this->array);
|
||||
}
|
||||
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$this->array = (array) unserialize((string) $serialized);
|
||||
}
|
||||
}
|
||||
51
vendor/symfony/property-access/Tests/Fixtures/TypeHinted.php
vendored
Normal file
51
vendor/symfony/property-access/Tests/Fixtures/TypeHinted.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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\Fixtures;
|
||||
|
||||
/**
|
||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||
*/
|
||||
class TypeHinted
|
||||
{
|
||||
private $date;
|
||||
|
||||
/**
|
||||
* @var \Countable
|
||||
*/
|
||||
private $countable;
|
||||
|
||||
public function setDate(\DateTime $date)
|
||||
{
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
public function getDate()
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Countable
|
||||
*/
|
||||
public function getCountable()
|
||||
{
|
||||
return $this->countable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Countable $countable
|
||||
*/
|
||||
public function setCountable(\Countable $countable)
|
||||
{
|
||||
$this->countable = $countable;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user