v1.0 Initial commit of project

This commit is contained in:
2026-01-01 10:54:18 +01:00
commit 768cf78b57
990 changed files with 241213 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class AdderRemoverDummy
{
private $analyses;
private $feet;
public function addAnalyse(Dummy $analyse)
{
}
public function removeFoot(Dummy $foot)
{
}
}

View File

@@ -0,0 +1,19 @@
<?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\PropertyInfo\Tests\Fixtures;
class AsymmetricVisibility
{
public private(set) mixed $publicPrivate;
public protected(set) mixed $publicProtected;
protected private(set) mixed $protectedPrivate;
}

View File

@@ -0,0 +1,40 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Dmitrii Poddubnyi <dpoddubny@gmail.com>
*/
class ConstructorDummy
{
/** @var string */
private $timezone;
/** @var \DateTimeInterface */
private $date;
/** @var int */
private $dateTime;
/**
* @param \DateTimeZone $timezone
* @param int $date Timestamp
* @param \DateTimeInterface $dateObject
* @param mixed $mixed
*/
public function __construct(\DateTimeZone $timezone, $date, $dateObject, \DateTimeImmutable $dateTime, $mixed)
{
$this->timezone = $timezone->getName();
$this->date = \DateTimeImmutable::createFromFormat('U', $date);
$this->dateTime = $dateTime->getTimestamp();
}
}

View File

@@ -0,0 +1,19 @@
<?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\PropertyInfo\Tests\Fixtures;
class ConstructorDummyWithoutDocBlock
{
public function __construct(\DateTimeZone $timezone, $date, $dateObject, \DateTimeImmutable $dateTime, $mixed)
{
}
}

View File

@@ -0,0 +1,24 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Tales Santos <tales.augusto.santos@gmail.com>
*/
class DefaultValue
{
public $defaultInt = 30;
public $defaultFloat = 30.5;
public $defaultString = 'foo';
public $defaultArray = [];
public $defaultNull = null;
}

View File

@@ -0,0 +1,62 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* PhpDocExtractor should fallback from property -> accessor -> mutator when looking up docblocks.
*
* @author Martin Rademacher <mano@radebatz.net>
*/
class DockBlockFallback
{
/** @var string $pub */
public $pub = 'pub';
protected $protAcc;
protected $protMut;
public function getPub()
{
return $this->pub;
}
public function setPub($pub)
{
$this->pub = $pub;
}
/**
* @return int
*/
public function getProtAcc(): int
{
return $this->protAcc;
}
public function setProt($protAcc)
{
$this->protAcc = $protAcc;
}
public function getProtMut()
{
return $this->protMut;
}
/**
* @param bool $protMut
*/
public function setProtMut($protMut)
{
$this->protMut = $protMut;
}
}

View File

@@ -0,0 +1,272 @@
<?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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\Serializer\Annotation\Groups as GroupsAnnotation;
use Symfony\Component\Serializer\Attribute\Groups;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class Dummy extends ParentDummy
{
/**
* @var string This is bar
*/
private $bar;
/**
* Should be used.
*
* @var int Should be ignored
*/
protected $baz;
/**
* @var \DateTimeImmutable
*/
public $bal;
/**
* @var ParentDummy
*/
public $parent;
/**
* @var \DateTimeImmutable[]
* @GroupsAnnotation({"a", "b"})
*/
#[Groups(['a', 'b'])]
public $collection;
/**
* @var DummyCollection<int, string>
*/
public $collectionAsObject;
/**
* @var string[][]
*/
public $nestedCollection;
/**
* @var mixed[]
*/
public $mixedCollection;
/**
* @var ParentDummy
*/
public $B;
/**
* @var int
*/
protected $Id;
/**
* @var string
*/
public $Guid;
/**
* Nullable array.
*
* @var array|null
*/
public $g;
/**
* @var ?string
*/
public $h;
/**
* @var string|int|null
*/
public $i;
/**
* @var ?\DateTimeImmutable
*/
public $j;
/**
* @var int[]|null
*/
public $nullableCollectionOfNonNullableElements;
/**
* @var array<null|int>
*/
public $nonNullableCollectionOfNullableElements;
/**
* @var null|array<int|string>
*/
public $nullableCollectionOfMultipleNonNullableElementTypes;
/**
* @var array
*/
private $xTotals;
/**
* @var string
*/
private $YT;
/**
* This should not be removed.
*
* @var
*/
public $emptyVar;
/**
* @var \Iterator<string>
*/
public $iteratorCollection;
/**
* @var \Iterator<integer,string>
*/
public $iteratorCollectionWithKey;
/**
* @var \Iterator<integer,\Iterator<integer,string>>
*/
public $nestedIterators;
/**
* @var array<string,string>
*/
public $arrayWithKeys;
/**
* @var array<string,array<integer,null|string>|null>
*/
public $arrayWithKeysAndComplexValue;
/**
* @var array<string,mixed>
*/
public $arrayOfMixed;
/**
* @var list<string>
*/
public $listOfStrings;
/**
* @var parent
*/
public $parentAnnotation;
/**
* @var \BackedEnum<string>
*/
public $genericInterface;
public static function getStatic()
{
}
/**
* @return string
*/
public static function staticGetter()
{
}
public static function staticSetter(\DateTimeImmutable $d)
{
}
/**
* A.
*
* @return int
*/
public function getA()
{
}
/**
* B.
*
* @param ParentDummy|null $parent
*/
public function setB(?ParentDummy $parent = null)
{
}
/**
* Date of Birth.
*
* @return \DateTimeImmutable
*/
public function getDOB()
{
}
/**
* @return int
*/
public function getId()
{
}
public function get123()
{
}
/**
* @param self $self
*/
public function setSelf(self $self)
{
}
/**
* @param parent $realParent
*/
public function setRealParent(parent $realParent)
{
}
/**
* @return array
*/
public function getXTotals()
{
}
/**
* @return string
*/
public function getYT()
{
}
public function setDate(\DateTimeImmutable $date)
{
}
public function addDate(\DateTimeImmutable $date)
{
}
public function hasElement(string $element): bool
{
}
}

View File

@@ -0,0 +1,20 @@
<?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\PropertyInfo\Tests\Fixtures;
final class DummyCollection implements \IteratorAggregate
{
public function getIterator(): \Traversable
{
return [];
}
}

View File

@@ -0,0 +1,66 @@
<?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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\PropertyInfo\Extractor\ConstructorArgumentTypeExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\PropertyInfo\Type;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class DummyExtractor implements PropertyListExtractorInterface, PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface, PropertyInitializableExtractorInterface, ConstructorArgumentTypeExtractorInterface
{
public function getShortDescription($class, $property, array $context = []): ?string
{
return 'short';
}
public function getLongDescription($class, $property, array $context = []): ?string
{
return 'long';
}
public function getTypes($class, $property, array $context = []): ?array
{
return [new Type(Type::BUILTIN_TYPE_INT)];
}
public function getTypesFromConstructor(string $class, string $property): ?array
{
return [new Type(Type::BUILTIN_TYPE_STRING)];
}
public function isReadable($class, $property, array $context = []): ?bool
{
return true;
}
public function isWritable($class, $property, array $context = []): ?bool
{
return true;
}
public function getProperties($class, array $context = []): ?array
{
return ['a', 'b'];
}
public function isInitializable(string $class, string $property, array $context = []): ?bool
{
return true;
}
}

View File

@@ -0,0 +1,41 @@
<?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\PropertyInfo\Tests\Fixtures;
interface IFace {}
class Clazz {}
class DummyGeneric
{
/**
* @var Clazz<Dummy>
*/
public $basicClass;
/**
* @var ?Clazz<Dummy>
*/
public $nullableClass;
/**
* @var IFace<Dummy>
*/
public $basicInterface;
/**
* @var ?IFace<Dummy>
*/
public $nullableInterface;
}

View File

@@ -0,0 +1,23 @@
<?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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\PropertyInfo\Tests as TestNamespace;
/**
* @author Baptiste Leduc <baptiste.leduc@gmail.com>
*/
class DummyNamespace
{
/** @var TestNamespace\Fixtures\Dummy */
private $dummy;
}

View File

@@ -0,0 +1,56 @@
<?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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\PropertyInfo\Tests\Fixtures\TraitUsage\DummyUsedInTrait;
trait DummyTraitExternal
{
/**
* @var string
*/
private $propertyInExternalTraitPrimitiveType;
/**
* @var Dummy
*/
private $propertyInExternalTraitObjectSameNamespace;
/**
* @var DummyUsedInTrait
*/
private $propertyInExternalTraitObjectDifferentNamespace;
/**
* @return string
*/
public function getMethodInExternalTraitPrimitiveType()
{
return 'value';
}
/**
* @return Dummy
*/
public function getMethodInExternalTraitObjectSameNamespace()
{
return new Dummy();
}
/**
* @return DummyUsedInTrait
*/
public function getMethodInExternalTraitObjectDifferentNamespace()
{
return new DummyUsedInTrait();
}
}

View File

@@ -0,0 +1,56 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Baptiste Leduc <baptiste.leduc@gmail.com>
*/
class DummyUnionType
{
private const TYPE_A = 'a';
private const TYPE_B = 'b';
/**
* @var string|int
*/
public $a;
/**
* @var (string|int)[]
*/
public $b;
/**
* @var array<string|int>
*/
public $c;
/**
* @var array<string|int, array<string>>
*/
public $d;
/**
* @var (Dummy<array<mixed, string>, (int | (\Traversable<DefaultValue>)[])> | ParentDummy | null)
*/
public $e;
/**
* @var self::TYPE_*|null
*/
public $f;
/**
* @var non-empty-array<string|int>
*/
public $g;
}

View File

@@ -0,0 +1,29 @@
<?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 A {
class Property {
}
class Dummy {
/**
* @var Property
*/
public $property;
}
}
namespace B {
class Dummy extends \A\Dummy {
}
}

View 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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\Serializer\Annotation\Groups as GroupsAnnotation;
use Symfony\Component\Serializer\Annotation\Ignore as IgnoreAnnotation;
use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Serializer\Attribute\Ignore;
/**
* @author Vadim Borodavko <vadim.borodavko@gmail.com>
*/
class IgnorePropertyDummy
{
/**
* @GroupsAnnotation({"a"})
*/
#[Groups(['a'])]
public $visibleProperty;
/**
* @GroupsAnnotation({"a"})
* @IgnoreAnnotation
*/
#[Groups(['a']), Ignore]
private $ignoredProperty;
}

View File

@@ -0,0 +1,30 @@
<?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\PropertyInfo\Tests\Fixtures;
class IntRangeDummy
{
/**
* @var int<0, 100>
*/
public $a;
/**
* @var int<min, 100>|null
*/
public $b;
/**
* @var int<50, max>
*/
public $c;
}

View File

@@ -0,0 +1,50 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Martin Rademacher <mano@radebatz.net>
*/
class InvalidDummy
{
/**
* @var
*/
public $pub;
/**
* @return
*/
public static function getStat()
{
return 'stat';
}
/**
* Foo.
*
* @param
*/
public function setFoo($foo)
{
}
/**
* Bar.
*
* @return
*/
public function getBar()
{
return 'bar';
}
}

View File

@@ -0,0 +1,19 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class NoProperties
{
}

View File

@@ -0,0 +1,22 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class NotInstantiable
{
private function __construct(string $foo)
{
}
}

View File

@@ -0,0 +1,85 @@
<?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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
/**
* Not able to guess anything.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class NullExtractor implements PropertyListExtractorInterface, PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface, PropertyInitializableExtractorInterface
{
public function getShortDescription($class, $property, array $context = []): ?string
{
$this->assertIsString($class);
$this->assertIsString($property);
return null;
}
public function getLongDescription($class, $property, array $context = []): ?string
{
$this->assertIsString($class);
$this->assertIsString($property);
return null;
}
public function getTypes($class, $property, array $context = []): ?array
{
$this->assertIsString($class);
$this->assertIsString($property);
return null;
}
public function isReadable($class, $property, array $context = []): ?bool
{
$this->assertIsString($class);
$this->assertIsString($property);
return null;
}
public function isWritable($class, $property, array $context = []): ?bool
{
$this->assertIsString($class);
$this->assertIsString($property);
return null;
}
public function getProperties($class, array $context = []): ?array
{
$this->assertIsString($class);
return null;
}
public function isInitializable(string $class, string $property, array $context = []): ?bool
{
return null;
}
private function assertIsString($string)
{
if (!\is_string($string)) {
throw new \InvalidArgumentException(sprintf('"%s" expects strings, given "%s".', __CLASS__, get_debug_type($string)));
}
}
}

View File

@@ -0,0 +1,128 @@
<?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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\PropertyInfo\Tests\Fixtures\RootDummy\RootDummyItem;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class ParentDummy
{
/**
* Short description.
*
* Long description.
*/
public $foo;
/**
* @var float
*/
public $foo2;
/**
* @var callable
*/
public $foo3;
/**
* @var void
*/
public $foo4;
/**
* @var mixed
*/
public $foo5;
/**
* @var \SplFileInfo[]|resource
*/
public $files;
/**
* @var static
*/
public $propertyTypeStatic;
/**
* @var parent
*/
public $parentAnnotationNoParent;
/**
* @var RootDummyItem[]
*/
public $rootDummyItems;
/**
* @var \Symfony\Component\PropertyInfo\Tests\Fixtures\RootDummy\RootDummyItem
*/
public $rootDummyItem;
/**
* @return bool|null
*/
public function isC()
{
}
/**
* @return true|null
*/
public function isCt()
{
}
/**
* @return false|null
*/
public function isCf()
{
}
/**
* @return bool
*/
public function canD()
{
}
/**
* @return true
*/
public function canDt()
{
}
/**
* @return false
*/
public function canDf()
{
}
/**
* @param resource $e
*/
public function addE($e)
{
}
/**
* @param \DateTimeImmutable $f
*/
public function removeF(\DateTimeImmutable $f)
{
}
}

View File

@@ -0,0 +1,57 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Teoh Han Hui <teohhanhui@gmail.com>
*/
class Php71Dummy
{
public function __construct(string $string, int $intPrivate)
{
}
public function getFoo(): ?array
{
}
public function getBuz(): void
{
}
public function setBar(?int $bar)
{
}
public function addBaz(string $baz)
{
}
public function removeBaz(string $baz)
{
}
}
class Php71DummyExtended extends Php71Dummy
{
}
class Php71DummyExtended2 extends Php71Dummy
{
public function __construct(int $intWithAccessor)
{
}
public function getIntWithAccessor()
{
}
}

View File

@@ -0,0 +1,40 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class Php74Dummy
{
public Dummy $dummy;
private ?bool $nullableBoolProp;
/** @var string[] */
private array $stringCollection;
private ?int $nullableWithDefault = 1;
public array $collection = [];
/** @var Dummy[]|null */
public ?array $nullableTypedCollection = null;
public function addStringCollection(string $string): void
{
}
public function removeStringCollection(string $string): void
{
}
public function addNullableTypedCollection(Dummy $dummy): void
{
}
}

View File

@@ -0,0 +1,38 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class Php7Dummy extends Php7ParentDummy
{
public function getFoo(): array
{
}
public function setBar(int $bar)
{
}
public function addBaz(string $baz)
{
}
public function getBuz(): self
{
}
public function getBiz(): parent
{
}
}

View File

@@ -0,0 +1,19 @@
<?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\PropertyInfo\Tests\Fixtures;
class Php7ParentDummy extends \stdClass
{
public function getParent(): parent
{
}
}

View File

@@ -0,0 +1,67 @@
<?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\PropertyInfo\Tests\Fixtures;
class Php80Dummy
{
public mixed $mixedProperty;
/**
* @param string $promotedAndMutated
* @param string $promotedWithDocComment
* @param string $promotedWithDocCommentAndType
* @param array<string> $collection
*/
public function __construct(
private mixed $promoted,
private mixed $promotedAndMutated,
/**
* Comment without @var.
*/
private mixed $promotedWithDocComment,
/**
* @var int
*/
private mixed $promotedWithDocCommentAndType,
private array $collection,
)
{
}
public function getFoo(): array|null
{
}
public function setBar(int|null $bar)
{
}
public function setTimeout(int|float $timeout)
{
}
public function getOptional(): int|float|null
{
}
public function setString(string|\Stringable $string)
{
}
public function setPayload(mixed $payload)
{
}
public function getData(): mixed
{
}
}

View File

@@ -0,0 +1,24 @@
<?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\PropertyInfo\Tests\Fixtures;
class Php80PromotedDummy
{
public function __construct(private string $promoted)
{
}
public function getPromoted(): string
{
return $this->promoted;
}
}

View File

@@ -0,0 +1,28 @@
<?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\PropertyInfo\Tests\Fixtures;
class Php81Dummy
{
public function __construct(public readonly string $foo)
{
}
public function getNothing(): never
{
throw new \Exception('Oops');
}
public function getCollection(): \Traversable&\Countable
{
}
}

View File

@@ -0,0 +1,23 @@
<?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\PropertyInfo\Tests\Fixtures;
class Php82Dummy
{
public null $nil = null;
public false $false = false;
public true $true = true;
public (\Traversable&\Countable)|null $someCollection = null;
}

View File

@@ -0,0 +1,45 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Emil Masiakowski <emil.masiakowski@gmail.com>
*/
class PhpStanPseudoTypesDummy extends PseudoTypesDummy
{
/** @var negative-int */
public $negativeInt;
/** @var non-empty-array */
public $nonEmptyArray;
/** @var non-empty-list */
public $nonEmptyList;
/** @var interface-string */
public $interfaceString;
/** @var scalar */
public $scalar;
/** @var array-key */
public $arrayKey;
/** @var number */
public $number;
/** @var numeric */
public $numeric;
/** @var double */
public $double;
}

View File

@@ -0,0 +1,20 @@
<?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\PropertyInfo\Tests\Fixtures;
class PseudoTypeDummy
{
/**
* @var scalar
*/
public $unknownPseudoType;
}

View File

@@ -0,0 +1,48 @@
<?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\PropertyInfo\Tests\Fixtures;
/**
* @author Emil Masiakowski <emil.masiakowski@gmail.com>
*/
class PseudoTypesDummy
{
/** @var class-string */
public $classString;
/** @var class-string<\stdClass> */
public $classStringGeneric;
/** @var html-escaped-string */
public $htmlEscapedString;
/** @var lowercase-string */
public $lowercaseString;
/** @var non-empty-lowercase-string */
public $nonEmptyLowercaseString;
/** @var non-empty-string */
public $nonEmptyString;
/** @var numeric-string */
public $numericString;
/** @var trait-string */
public $traitString;
/** @var positive-int */
public $positiveInt;
/** @var literal-string */
public $literalString;
}

View File

@@ -0,0 +1,16 @@
<?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\PropertyInfo\Tests\Fixtures\RootDummy;
class RootDummyItem
{
}

View File

@@ -0,0 +1,39 @@
<?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\PropertyInfo\Tests\Fixtures;
class SnakeCaseDummy
{
private string $snake_property;
private string $snake_readOnly;
private string $snake_method;
public function getSnakeProperty()
{
return $this->snake_property;
}
public function getSnakeReadOnly()
{
return $this->snake_readOnly;
}
public function setSnakeProperty($snake_property)
{
$this->snake_property = $snake_property;
}
public function setSnake_method($snake_method)
{
$this->snake_method = $snake_method;
}
}

View File

@@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\PropertyInfo\Tests\Fixtures\TraitUsage\AnotherNamespace;
class DummyInAnotherNamespace
{
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Symfony\Component\PropertyInfo\Tests\Fixtures\TraitUsage\AnotherNamespace;
trait DummyTraitInAnotherNamespace
{
/**
* @var DummyInAnotherNamespace
*/
public $dummyInAnotherNamespace;
}

View File

@@ -0,0 +1,59 @@
<?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\PropertyInfo\Tests\Fixtures\TraitUsage;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyTraitExternal;
trait DummyTrait
{
use DummyTraitExternal;
/**
* @var string
*/
private $propertyInTraitPrimitiveType;
/**
* @var DummyUsedInTrait
*/
private $propertyInTraitObjectSameNamespace;
/**
* @var Dummy
*/
private $propertyInTraitObjectDifferentNamespace;
/**
* @return string
*/
public function getMethodInTraitPrimitiveType()
{
return 'value';
}
/**
* @return DummyUsedInTrait
*/
public function getMethodInTraitObjectSameNamespace()
{
return new DummyUsedInTrait();
}
/**
* @return Dummy
*/
public function getMethodInTraitObjectDifferentNamespace()
{
return new Dummy();
}
}

View File

@@ -0,0 +1,16 @@
<?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\PropertyInfo\Tests\Fixtures\TraitUsage;
class DummyUsedInTrait
{
}

View File

@@ -0,0 +1,20 @@
<?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\PropertyInfo\Tests\Fixtures\TraitUsage;
use Symfony\Component\PropertyInfo\Tests\Fixtures\TraitUsage\AnotherNamespace\DummyTraitInAnotherNamespace;
class DummyUsingTrait
{
use DummyTrait;
use DummyTraitInAnotherNamespace;
}

View File

@@ -0,0 +1,19 @@
<?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\PropertyInfo\Tests\Fixtures;
class VirtualProperties
{
public bool $virtualNoSetHook { get => true; }
public bool $virtualSetHookOnly { set => $value; }
public bool $virtualHook { get => true; set => $value; }
}