|  | 
| 3 | 3 | declare(strict_types=1); | 
| 4 | 4 | 
 | 
| 5 | 5 | use PHPStan\Type\ArrayType; | 
| 6 |  | -use PHPStan\Type\BooleanType; | 
| 7 |  | -use PHPStan\Type\FloatType; | 
| 8 |  | -use PHPStan\Type\IntegerType; | 
| 9 | 6 | use PHPStan\Type\MixedType; | 
| 10 |  | -use PHPStan\Type\NullType; | 
| 11 | 7 | use PHPStan\Type\ObjectType; | 
| 12 |  | -use PHPStan\Type\StringType; | 
| 13 |  | -use PHPStan\Type\UnionType; | 
| 14 | 8 | use Rector\Config\RectorConfig; | 
| 15 | 9 | use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector; | 
| 16 | 10 | use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration; | 
| 17 |  | -use Rector\Util\Reflection\PrivatesAccessor; | 
| 18 | 11 | 
 | 
| 19 | 12 | // https://github.com/symfony/symfony/blob/6.1/UPGRADE-6.0.md | 
| 20 | 13 | // @see https://github.com/symfony/symfony/blob/6.1/.github/expected-missing-return-types.diff | 
|  | 
| 23 | 16 |     $arrayType = new ArrayType(new MixedType(), new MixedType()); | 
| 24 | 17 |     $httpFoundationResponseType = new ObjectType('Symfony\Component\HttpFoundation\Response'); | 
| 25 | 18 | 
 | 
| 26 |  | -    $scalarTypes = [ | 
| 27 |  | -        $arrayType, | 
| 28 |  | -        new BooleanType(), | 
| 29 |  | -        new StringType(), | 
| 30 |  | -        new IntegerType(), | 
| 31 |  | -        new FloatType(), | 
| 32 |  | -        new NullType(), | 
| 33 |  | -    ]; | 
| 34 |  | - | 
| 35 |  | -    $scalarArrayObjectUnionedTypes = [...$scalarTypes, new ObjectType('ArrayObject')]; | 
| 36 |  | - | 
| 37 |  | -    // cannot be crated with \PHPStan\Type\UnionTypeHelper::sortTypes() as ObjectType requires a class reflection we do not have here | 
| 38 |  | -    $unionTypeReflectionClass = new ReflectionClass(UnionType::class); | 
| 39 |  | - | 
| 40 |  | -    /** @var UnionType $scalarArrayObjectUnionType */ | 
| 41 |  | -    $scalarArrayObjectUnionType = $unionTypeReflectionClass->newInstanceWithoutConstructor(); | 
| 42 |  | - | 
| 43 |  | -    $privatesAccessor = new PrivatesAccessor(); | 
| 44 |  | -    $privatesAccessor->setPrivateProperty($scalarArrayObjectUnionType, 'types', $scalarArrayObjectUnionedTypes); | 
| 45 | 19 |     $rectorConfig->ruleWithConfiguration(AddReturnTypeDeclarationRector::class, [ | 
| 46 | 20 |         new AddReturnTypeDeclaration( | 
| 47 | 21 |             'Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface', | 
|  | 
0 commit comments