Merge branch '5.2' into 5.x

* 5.2:
  [Console] Fix line wrapping for decorated text in block output
  [Inflector] Fixed pluralize "coupon"
  [PhpUnitBridge] fix compat with symfony/debug
  [VarDumper] Adds support for ReflectionUnionType to VarDumper
  Correctly clear lines for multi-line progress bar messages.
  [Security] Add XML support for authenticator manager
This commit is contained in:
Nicolas Grekas 2021-03-17 17:56:09 +01:00
commit 78fccbeb4c
21 changed files with 365 additions and 48 deletions

View File

@ -11,6 +11,8 @@
namespace Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestSuite;
use PHPUnit\Util\Test;
use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerFor;
use Symfony\Component\Debug\DebugClassLoader as LegacyDebugClassLoader;
@ -87,41 +89,45 @@ class Deprecation
}
}
if (isset($line['object']) || isset($line['class'])) {
set_error_handler(function () {});
$parsedMsg = unserialize($this->message);
restore_error_handler();
if ($parsedMsg && isset($parsedMsg['deprecation'])) {
$this->message = $parsedMsg['deprecation'];
$this->originClass = $parsedMsg['class'];
$this->originMethod = $parsedMsg['method'];
if (isset($parsedMsg['files_stack'])) {
$this->originalFilesStack = $parsedMsg['files_stack'];
}
// If the deprecation has been triggered via
// \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest()
// then we need to use the serialized information to determine
// if the error has been triggered from vendor code.
if (isset($parsedMsg['triggering_file'])) {
$this->triggeringFile = $parsedMsg['triggering_file'];
}
if (!isset($line['object']) && !isset($line['class'])) {
return;
}
return;
set_error_handler(function () {});
$parsedMsg = unserialize($this->message);
restore_error_handler();
if ($parsedMsg && isset($parsedMsg['deprecation'])) {
$this->message = $parsedMsg['deprecation'];
$this->originClass = $parsedMsg['class'];
$this->originMethod = $parsedMsg['method'];
if (isset($parsedMsg['files_stack'])) {
$this->originalFilesStack = $parsedMsg['files_stack'];
}
// If the deprecation has been triggered via
// \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest()
// then we need to use the serialized information to determine
// if the error has been triggered from vendor code.
if (isset($parsedMsg['triggering_file'])) {
$this->triggeringFile = $parsedMsg['triggering_file'];
}
if (!isset($line['class'], $trace[$i - 2]['function']) || 0 !== strpos($line['class'], SymfonyTestsListenerFor::class)) {
$this->originClass = isset($line['object']) ? \get_class($line['object']) : $line['class'];
$this->originMethod = $line['function'];
return;
}
return;
}
if (!isset($line['class'], $trace[$i - 2]['function']) || 0 !== strpos($line['class'], SymfonyTestsListenerFor::class)) {
$this->originClass = isset($line['object']) ? \get_class($line['object']) : $line['class'];
$this->originMethod = $line['function'];
if ('trigger_error' !== $trace[$i - 2]['function'] || isset($trace[$i - 2]['class'])) {
$this->originClass = \get_class($line['args'][0]);
$this->originMethod = $line['args'][0]->getName();
return;
}
return;
}
$test = $line['args'][0] ?? null;
if (($test instanceof TestCase || $test instanceof TestSuite) && ('trigger_error' !== $trace[$i - 2]['function'] || isset($trace[$i - 2]['class']))) {
$this->originClass = \get_class($line['args'][0]);
$this->originMethod = $line['args'][0]->getName();
return;
}
}

View File

@ -31,7 +31,7 @@ class LoginLinkFactory extends AbstractFactory implements AuthenticatorFactoryIn
public function addConfiguration(NodeDefinition $node)
{
/** @var NodeBuilder $builder */
$builder = $node->children();
$builder = $node->fixXmlConfig('signature_property', 'signature_properties')->children();
$builder
->scalarNode('check_route')
@ -98,6 +98,10 @@ class LoginLinkFactory extends AbstractFactory implements AuthenticatorFactoryIn
if (null !== $config['max_uses'] && !isset($config['used_link_cache'])) {
$config['used_link_cache'] = 'security.authenticator.cache.expired_links';
$defaultCacheDefinition = $container->getDefinition($config['used_link_cache']);
if (!$defaultCacheDefinition->hasTag('cache.pool')) {
$defaultCacheDefinition->addTag('cache.pool');
}
}
$expiredStorageId = null;

View File

@ -25,6 +25,7 @@
<xsd:attribute name="hide-user-not-found" type="xsd:boolean" />
<xsd:attribute name="always-authenticate-before-granting" type="xsd:boolean" />
<xsd:attribute name="erase-credentials" type="xsd:boolean" />
<xsd:attribute name="enable-authenticator-manager" type="xsd:boolean" />
</xsd:complexType>
<xsd:complexType name="encoders">
@ -166,6 +167,7 @@
<xsd:element name="http-basic-ldap" type="http_basic_ldap" minOccurs="0" maxOccurs="1" />
<xsd:element name="json-login" type="json_login" minOccurs="0" maxOccurs="1" />
<xsd:element name="json-login-ldap" type="json_login_ldap" minOccurs="0" maxOccurs="1" />
<xsd:element name="login-throttling" type="login_throttling" minOccurs="0" maxOccurs="1" />
<xsd:element name="remember-me" type="remember_me" minOccurs="0" maxOccurs="1" />
<xsd:element name="remote-user" type="remote_user" minOccurs="0" maxOccurs="1" />
<xsd:element name="x509" type="x509" minOccurs="0" maxOccurs="1" />
@ -185,6 +187,7 @@
<xsd:attribute name="provider" type="xsd:string" />
<xsd:attribute name="stateless" type="xsd:boolean" />
<xsd:attribute name="context" type="xsd:string" />
<xsd:attribute name="lazy" type="xsd:boolean" />
<!-- allow factories to use dynamic elements -->
<xsd:anyAttribute processContents="lax" />
</xsd:complexType>
@ -256,6 +259,7 @@
<xsd:attribute name="csrf-token-id" type="xsd:string" />
<xsd:attribute name="post-only" type="xsd:boolean" />
<xsd:attribute name="csrf-token-generator" type="xsd:string" />
<xsd:attribute name="enable-csrf" type="xsd:boolean" />
<xsd:attributeGroup ref="success-handler-options" />
<xsd:attributeGroup ref="failure-handler-options" />
</xsd:extension>
@ -308,6 +312,25 @@
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="login_link">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="signature-property" type="xsd:string" />
</xsd:choice>
<xsd:attribute name="check-route" type="xsd:string" />
<xsd:attribute name="check-post-only" type="xsd:boolean" />
<xsd:attribute name="lifetime" type="xsd:integer" />
<xsd:attribute name="max-uses" type="xsd:integer" />
<xsd:attribute name="used-link-cache" type="xsd:string" />
<xsd:attribute name="success-handler" type="xsd:string" />
<xsd:attribute name="failure-handler" type="xsd:string" />
<xsd:attribute name="provider" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="login_throttling">
<xsd:attribute name="limiter" type="xsd:string" />
<xsd:attribute name="max-attempts" type="xsd:integer" />
</xsd:complexType>
<xsd:complexType name="remember_me">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="user-provider" type="xsd:string" />

View File

@ -51,7 +51,6 @@ return static function (ContainerConfigurator $container) {
->set('security.authenticator.cache.expired_links')
->parent('cache.app')
->private()
->tag('cache.pool')
->set('security.authenticator.firewall_aware_login_link_handler', FirewallAwareLoginLinkHandler::class)
->args([

View File

@ -25,6 +25,7 @@ use Symfony\Component\PasswordHasher\Hasher\SodiumPasswordHasher;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
use Symfony\Component\Security\Core\Encoder\NativePasswordEncoder;
use Symfony\Component\Security\Core\Encoder\SodiumPasswordEncoder;
use Symfony\Component\Security\Http\Authentication\AuthenticatorManager;
abstract class CompleteConfigurationTest extends TestCase
{
@ -32,6 +33,38 @@ abstract class CompleteConfigurationTest extends TestCase
abstract protected function getFileExtension();
public function testAuthenticatorManager()
{
$container = $this->getContainer('authenticator_manager');
$this->assertEquals(AuthenticatorManager::class, $container->getDefinition('security.authenticator.manager.main')->getClass());
// login link
$expiredStorage = $container->getDefinition($expiredStorageId = 'security.authenticator.expired_login_link_storage.main');
$this->assertEquals('cache.redis', (string) $expiredStorage->getArgument(0));
$this->assertEquals(3600, (string) $expiredStorage->getArgument(1));
$linker = $container->getDefinition($linkerId = 'security.authenticator.login_link_handler.main');
$this->assertEquals(['id', 'email'], $linker->getArgument(3));
$this->assertEquals([
'route_name' => 'login_check',
'lifetime' => 3600,
'max_uses' => 1,
], $linker->getArgument(5));
$this->assertEquals($expiredStorageId, (string) $linker->getArgument(6));
$authenticator = $container->getDefinition('security.authenticator.login_link.main');
$this->assertEquals($linkerId, (string) $authenticator->getArgument(0));
$this->assertEquals([
'check_route' => 'login_check',
'check_post_only' => true,
], $authenticator->getArgument(4));
// login throttling
$listener = $container->getDefinition('security.listener.login_throttling.main');
$this->assertEquals('app.rate_limiter', (string) $listener->getArgument(1));
}
public function testRolesHierarchy()
{
$container = $this->getContainer('container1');
@ -940,6 +973,7 @@ abstract class CompleteConfigurationTest extends TestCase
$container->setParameter('kernel.debug', false);
$container->setParameter('request_listener.http_port', 80);
$container->setParameter('request_listener.https_port', 443);
$container->register('cache.app', \stdClass::class);
$security = new SecurityExtension();
$container->registerExtension($security);

View File

@ -0,0 +1,20 @@
<?php
$container->loadFromExtension('security', [
'enable_authenticator_manager' => true,
'firewalls' => [
'main' => [
'login_link' => [
'check_route' => 'login_check',
'check_post_only' => true,
'signature_properties' => ['id', 'email'],
'max_uses' => 1,
'lifetime' => 3600,
'used_link_cache' => 'cache.redis',
],
'login_throttling' => [
'limiter' => 'app.rate_limiter',
],
],
],
]);

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:srv="http://symfony.com/schema/dic/services"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/security
https://symfony.com/schema/dic/security/security-1.0.xsd">
<config enable-authenticator-manager="true">
<firewall name="main">
<login-link check-route="login_check"
check-post-only="true"
max-uses="1"
lifetime="3600"
used-link-cache="cache.redis"
>
<signature-property>id</signature-property>
<signature-property>email</signature-property>
</login-link>
<login-throttling limiter="app.rate_limiter"/>
</firewall>
</config>
</srv:container>

View File

@ -0,0 +1,13 @@
security:
enable_authenticator_manager: true
firewalls:
main:
login_link:
check_route: login_check
check_post_only: true
signature_properties: [id, email]
max_uses: 1
lifetime: 3600
used_link_cache: 'cache.redis'
login_throttling:
limiter: 'app.rate_limiter'

View File

@ -472,8 +472,15 @@ final class ProgressBar
if ($this->overwrite) {
if (null !== $this->previousMessage) {
if ($this->output instanceof ConsoleSectionOutput) {
$lines = floor(Helper::strlenWithoutDecoration($this->output->getFormatter(), $message) / $this->terminal->getWidth()) + $this->formatLineCount + 1;
$this->output->clear($lines);
$messageLines = explode("\n", $message);
$lineCount = \count($messageLines);
foreach ($messageLines as $messageLine) {
$messageLineLength = Helper::strlenWithoutDecoration($this->output->getFormatter(), $messageLine);
if ($messageLineLength > $this->terminal->getWidth()) {
$lineCount += floor($messageLineLength / $this->terminal->getWidth());
}
}
$this->output->clear($lineCount);
} else {
if ($this->formatLineCount > 0) {
$this->cursor->moveUp($this->formatLineCount);

View File

@ -476,7 +476,12 @@ class SymfonyStyle extends OutputStyle
$message = OutputFormatter::escape($message);
}
$lines = array_merge($lines, explode(\PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, \PHP_EOL, true)));
$decorationLength = Helper::strlen($message) - Helper::strlenWithoutDecoration($this->getFormatter(), $message);
$messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength);
$messageLines = explode(\PHP_EOL, wordwrap($message, $messageLineLength, \PHP_EOL, true));
foreach ($messageLines as $messageLine) {
$lines[] = $messageLine;
}
if (\count($messages) > 1 && $key < \count($messages) - 1) {
$lines[] = '';
@ -496,7 +501,9 @@ class SymfonyStyle extends OutputStyle
}
$line = $prefix.$line;
$line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
$decorationLength = Helper::strlen($line) - Helper::strlenWithoutDecoration($this->getFormatter(), $line);
$messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength);
$line .= str_repeat(' ', max($this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line), 0));
if ($style) {
$line = sprintf('<%s>%s</>', $style, $line);

View File

@ -1,7 +1,7 @@
 // Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et 
 // dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea 
 // commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla 
 // pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim
 // id est laborum
 // Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore 
 // magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 
 // consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla 
 // pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
 // est laborum

View File

@ -397,6 +397,34 @@ class ProgressBarTest extends TestCase
);
}
public function testOverwriteWithSectionOutputWithNewlinesInMessage()
{
$sections = [];
$stream = $this->getOutputStream(true);
$output = new ConsoleSectionOutput($stream->getStream(), $sections, $stream->getVerbosity(), $stream->isDecorated(), new OutputFormatter());
ProgressBar::setFormatDefinition('test', '%current%/%max% [%bar%] %percent:3s%% %message% Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.');
$bar = new ProgressBar($output, 50, 0);
$bar->setFormat('test');
$bar->start();
$bar->display();
$bar->setMessage("Twas brillig, and the slithy toves. Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe.\nBeware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch!");
$bar->advance();
$bar->setMessage("He took his vorpal sword in hand; Long time the manxome foe he sought— So rested he by the Tumtum tree And stood awhile in thought.\nAnd, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whiffling through the tulgey wood, And burbled as it came!");
$bar->advance();
rewind($output->getStream());
$this->assertEquals(
' 0/50 [>] 0% %message% Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.'.\PHP_EOL.
"\x1b[6A\x1b[0J 1/50 [>] 2% Twas brillig, and the slithy toves. Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe.
Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch! Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.".\PHP_EOL.
"\x1b[6A\x1b[0J 2/50 [>] 4% He took his vorpal sword in hand; Long time the manxome foe he sought— So rested he by the Tumtum tree And stood awhile in thought.
And, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whiffling through the tulgey wood, And burbled as it came! Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.".\PHP_EOL,
stream_get_contents($output->getStream())
);
}
public function testMultipleSectionsWithCustomFormat()
{
$sections = [];

View File

@ -204,6 +204,7 @@ class InflectorTest extends TestCase
['crisis', 'crises'],
['criteria', 'criterion'],
['cup', 'cups'],
['coupon', 'coupons'],
['data', 'data'],
['day', 'days'],
['disco', 'discos'],

View File

@ -226,6 +226,9 @@ final class EnglishInflector implements InflectorInterface
// bacteria (bacterium), criteria (criterion), phenomena (phenomenon)
['noi', 3, true, true, 'ions'],
// coupon (coupons)
['nop', 3, true, true, 'pons'],
// seasons (season), treasons (treason), poisons (poison), lessons (lesson)
['nos', 3, true, true, 'sons'],

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\String\Tests;
namespace Symfony\Component\String\Tests\Inflector;
use PHPUnit\Framework\TestCase;
use Symfony\Component\String\Inflector\EnglishInflector;
@ -58,6 +58,7 @@ class EnglishInflectorTest extends TestCase
['crises', ['cris', 'crise', 'crisis']],
['criteria', ['criterion', 'criterium']],
['cups', 'cup'],
['coupon', 'coupons'],
['data', 'data'],
['days', 'day'],
['discos', 'disco'],

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\String\Tests;
namespace Symfony\Component\String\Tests\Inflector;
use PHPUnit\Framework\TestCase;
use Symfony\Component\String\Inflector\FrenchInflector;

View File

@ -96,11 +96,20 @@ class ReflectionCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'name' => $c instanceof \ReflectionNamedType ? $c->getName() : (string) $c,
$prefix.'allowsNull' => $c->allowsNull(),
$prefix.'isBuiltin' => $c->isBuiltin(),
];
if ($c instanceof \ReflectionNamedType || \PHP_VERSION_ID < 80000) {
$a += [
$prefix.'name' => $c instanceof \ReflectionNamedType ? $c->getName() : (string) $c,
$prefix.'allowsNull' => $c->allowsNull(),
$prefix.'isBuiltin' => $c->isBuiltin(),
];
} elseif ($c instanceof \ReflectionUnionType) {
$a[$prefix.'allowsNull'] = $c->allowsNull();
self::addMap($a, $c, [
'types' => 'getTypes',
]);
} else {
$a[$prefix.'allowsNull'] = $c->allowsNull();
}
return $a;
}

View File

@ -14,9 +14,12 @@ namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
use Symfony\Component\VarDumper\Tests\Fixtures\ExtendsReflectionTypeFixture;
use Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo;
use Symfony\Component\VarDumper\Tests\Fixtures\LotsOfAttributes;
use Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass;
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionNamedTypeFixture;
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionUnionTypeFixture;
/**
* @author Nicolas Grekas <p@tchwork.com>
@ -91,7 +94,7 @@ Closure($x) {
$b: & 123
}
file: "%sReflectionCasterTest.php"
line: "84 to 84"
line: "87 to 87"
}
EOTXT
, $var
@ -227,6 +230,104 @@ EOTXT
);
}
/**
* @requires PHP 7.4
*/
public function testReflectionPropertyScalar()
{
$var = new \ReflectionProperty(ReflectionNamedTypeFixture::class, 'a');
$this->assertDumpMatchesFormat(
<<<'EOTXT'
ReflectionProperty {
+name: "a"
+class: "Symfony\Component\VarDumper\Tests\Fixtures\ReflectionNamedTypeFixture"
modifiers: "public"
}
EOTXT
, $var
);
}
/**
* @requires PHP 7.4
*/
public function testReflectionNamedType()
{
$var = (new \ReflectionProperty(ReflectionNamedTypeFixture::class, 'a'))->getType();
$this->assertDumpMatchesFormat(
<<<'EOTXT'
ReflectionNamedType {
name: "int"
allowsNull: false
isBuiltin: true
}
EOTXT
, $var
);
}
/**
* @requires PHP 8
*/
public function testReflectionUnionType()
{
$var = (new \ReflectionProperty(ReflectionUnionTypeFixture::class, 'a'))->getType();
$this->assertDumpMatchesFormat(
<<<'EOTXT'
ReflectionUnionType {
allowsNull: false
types: array:2 [
0 => ReflectionNamedType {
name: "string"
allowsNull: false
isBuiltin: true
}
1 => ReflectionNamedType {
name: "int"
allowsNull: false
isBuiltin: true
}
]
}
EOTXT
, $var
);
}
/**
* @requires PHP 8
*/
public function testExtendsReflectionType()
{
$var = new ExtendsReflectionTypeFixture();
$this->assertDumpMatchesFormat(
<<<'EOTXT'
Symfony\Component\VarDumper\Tests\Fixtures\ExtendsReflectionTypeFixture {
allowsNull: false
}
EOTXT
, $var
);
}
/**
* @requires PHP < 8
*/
public function testLegacyExtendsReflectionType()
{
$var = new ExtendsReflectionTypeFixture();
$this->assertDumpMatchesFormat(
<<<'EOTXT'
Symfony\Component\VarDumper\Tests\Fixtures\ExtendsReflectionTypeFixture {
name: "fake"
allowsNull: false
isBuiltin: false
}
EOTXT
, $var
);
}
public function testReturnType()
{
$f = eval('return function ():int {};');

View File

@ -0,0 +1,21 @@
<?php
namespace Symfony\Component\VarDumper\Tests\Fixtures;
class ExtendsReflectionTypeFixture extends \ReflectionType
{
public function allowsNull(): bool
{
return false;
}
public function isBuiltin(): bool
{
return false;
}
public function __toString(): string
{
return 'fake';
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace Symfony\Component\VarDumper\Tests\Fixtures;
class ReflectionNamedTypeFixture
{
public int $a;
}

View File

@ -0,0 +1,8 @@
<?php
namespace Symfony\Component\VarDumper\Tests\Fixtures;
class ReflectionUnionTypeFixture
{
public int|string $a;
}