diff --git a/src/Elasticsearch/Serializer/ItemNormalizer.php b/src/Elasticsearch/Serializer/ItemNormalizer.php index 74c1194b609..a33c4ab48b8 100644 --- a/src/Elasticsearch/Serializer/ItemNormalizer.php +++ b/src/Elasticsearch/Serializer/ItemNormalizer.php @@ -64,7 +64,7 @@ public function supportsDenormalization(mixed $data, string $type, ?string $form /** * {@inheritdoc} */ - public function normalize(mixed $object, ?string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null { return $this->decorated->normalize($object, $format, $context); } diff --git a/src/Hydra/Tests/JsonSchema/SchemaFactoryTest.php b/src/Hydra/Tests/JsonSchema/SchemaFactoryTest.php index 82097130c63..69d70b3387c 100644 --- a/src/Hydra/Tests/JsonSchema/SchemaFactoryTest.php +++ b/src/Hydra/Tests/JsonSchema/SchemaFactoryTest.php @@ -85,9 +85,7 @@ public function testHasRootDefinitionKeyBuildSchema(): void $definitions = $resultSchema->getDefinitions(); $rootDefinitionKey = $resultSchema->getRootDefinitionKey(); - // @noRector $this->assertTrue(isset($definitions[$rootDefinitionKey])); - // @noRector $this->assertTrue(isset($definitions[$rootDefinitionKey]['properties'])); $properties = $resultSchema['definitions'][$rootDefinitionKey]['properties']; $this->assertArrayHasKey('@context', $properties); @@ -124,9 +122,7 @@ public function testSchemaTypeBuildSchema(): void $definitionName = 'Dummy.jsonld'; $this->assertNull($resultSchema->getRootDefinitionKey()); - // @noRector $this->assertTrue(isset($resultSchema['properties'])); - // @noRector $this->assertTrue(isset($resultSchema['properties']['hydra:member'])); $this->assertArrayHasKey('hydra:totalItems', $resultSchema['properties']); $this->assertArrayHasKey('hydra:view', $resultSchema['properties']); @@ -139,9 +135,7 @@ public function testSchemaTypeBuildSchema(): void $resultSchema = $this->schemaFactory->buildSchema(Dummy::class, 'jsonld', Schema::TYPE_OUTPUT, null, null, null, true); $this->assertNull($resultSchema->getRootDefinitionKey()); - // @noRector $this->assertTrue(isset($resultSchema['properties'])); - // @noRector $this->assertTrue(isset($resultSchema['properties']['hydra:member'])); $this->assertArrayHasKey('hydra:totalItems', $resultSchema['properties']); $this->assertArrayHasKey('hydra:view', $resultSchema['properties']); @@ -157,9 +151,7 @@ public function testHasHydraViewNavigationBuildSchema(): void $resultSchema = $this->schemaFactory->buildSchema(Dummy::class, 'jsonld', Schema::TYPE_OUTPUT, new GetCollection()); $this->assertNull($resultSchema->getRootDefinitionKey()); - // @noRector $this->assertTrue(isset($resultSchema['properties'])); - // @noRector $this->assertTrue(isset($resultSchema['properties']['hydra:view'])); $this->assertArrayHasKey('properties', $resultSchema['properties']['hydra:view']); $this->assertArrayHasKey('hydra:first', $resultSchema['properties']['hydra:view']['properties']); diff --git a/src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php b/src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php index 2f22ea23edd..ef3825f6e21 100644 --- a/src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php +++ b/src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php @@ -95,9 +95,7 @@ public function testHasRootDefinitionKeyBuildSchema(): void $definitions = $resultSchema->getDefinitions(); $rootDefinitionKey = $resultSchema->getRootDefinitionKey(); - // @noRector $this->assertTrue(isset($definitions[$rootDefinitionKey])); - // @noRector $this->assertTrue(isset($definitions[$rootDefinitionKey]['properties'])); $properties = $resultSchema['definitions'][$rootDefinitionKey]['properties']; $this->assertArrayHasKey('data', $properties); @@ -132,7 +130,6 @@ public function testSchemaTypeBuildSchema(): void $definitionName = 'Dummy.jsonapi'; $this->assertNull($resultSchema->getRootDefinitionKey()); - // @noRector $this->assertTrue(isset($resultSchema['properties'])); $this->assertArrayHasKey('links', $resultSchema['properties']); $this->assertArrayHasKey('self', $resultSchema['properties']['links']['properties']); @@ -160,7 +157,6 @@ public function testSchemaTypeBuildSchema(): void $resultSchema = $this->schemaFactory->buildSchema(Dummy::class, 'jsonapi', Schema::TYPE_OUTPUT, forceCollection: true); $this->assertNull($resultSchema->getRootDefinitionKey()); - // @noRector $this->assertTrue(isset($resultSchema['properties'])); $this->assertArrayHasKey('links', $resultSchema['properties']); $this->assertArrayHasKey('self', $resultSchema['properties']['links']['properties']); diff --git a/src/JsonSchema/Command/JsonSchemaGenerateCommand.php b/src/JsonSchema/Command/JsonSchemaGenerateCommand.php index 835f7de6cfd..eebcf5d5286 100644 --- a/src/JsonSchema/Command/JsonSchemaGenerateCommand.php +++ b/src/JsonSchema/Command/JsonSchemaGenerateCommand.php @@ -31,7 +31,6 @@ */ final class JsonSchemaGenerateCommand extends Command { - // @noRector \Rector\Php81\Rector\Property\ReadOnlyPropertyRector private array $formats; public function __construct(private readonly SchemaFactoryInterface $schemaFactory, array $formats) diff --git a/src/JsonSchema/Tests/SchemaFactoryTest.php b/src/JsonSchema/Tests/SchemaFactoryTest.php index 4015f408300..da38fc6474d 100644 --- a/src/JsonSchema/Tests/SchemaFactoryTest.php +++ b/src/JsonSchema/Tests/SchemaFactoryTest.php @@ -90,7 +90,6 @@ public function testBuildSchemaForNonResourceClass(): void $definitions = $resultSchema->getDefinitions(); $this->assertSame((new \ReflectionClass(NotAResource::class))->getShortName(), $rootDefinitionKey); - // @noRector $this->assertTrue(isset($definitions[$rootDefinitionKey])); $this->assertArrayHasKey('type', $definitions[$rootDefinitionKey]); $this->assertSame('object', $definitions[$rootDefinitionKey]['type']); @@ -166,7 +165,6 @@ public function testBuildSchemaForNonResourceClassWithUnionIntersectTypes(): voi $definitions = $resultSchema->getDefinitions(); $this->assertSame((new \ReflectionClass(NotAResourceWithUnionIntersectTypes::class))->getShortName(), $rootDefinitionKey); - // @noRector $this->assertTrue(isset($definitions[$rootDefinitionKey])); $this->assertArrayHasKey('type', $definitions[$rootDefinitionKey]); $this->assertSame('object', $definitions[$rootDefinitionKey]['type']); @@ -249,7 +247,6 @@ public function testBuildSchemaWithSerializerGroups(): void $definitions = $resultSchema->getDefinitions(); $this->assertSame((new \ReflectionClass(OverriddenOperationDummy::class))->getShortName().'-'.$serializerGroup, $rootDefinitionKey); - // @noRector $this->assertTrue(isset($definitions[$rootDefinitionKey])); $this->assertArrayHasKey('type', $definitions[$rootDefinitionKey]); $this->assertSame('object', $definitions[$rootDefinitionKey]['type']); @@ -307,7 +304,6 @@ public function testBuildSchemaForAssociativeArray(): void $definitions = $resultSchema->getDefinitions(); $this->assertSame((new \ReflectionClass(NotAResource::class))->getShortName(), $rootDefinitionKey); - // @noRector $this->assertTrue(isset($definitions[$rootDefinitionKey])); $this->assertArrayHasKey('properties', $definitions[$rootDefinitionKey]); $this->assertArrayHasKey('foo', $definitions[$rootDefinitionKey]['properties']); diff --git a/src/JsonSchema/Tests/SchemaTest.php b/src/JsonSchema/Tests/SchemaTest.php index d574337e585..d60ab82a6ba 100644 --- a/src/JsonSchema/Tests/SchemaTest.php +++ b/src/JsonSchema/Tests/SchemaTest.php @@ -67,12 +67,10 @@ public function testDefinitions(string $version, array $baseDefinitions): void if (Schema::VERSION_OPENAPI === $version) { $this->assertArrayHasKey('schemas', $schema['components']); } else { - // @noRector $this->assertTrue(isset($schema['definitions'])); } $definitions = $schema->getDefinitions(); - // @noRector $this->assertTrue(isset($definitions['foo'])); $this->assertArrayNotHasKey('definitions', $schema->getArrayCopy(false)); diff --git a/src/Metadata/Tests/Resource/Factory/AttributesResourceMetadataCollectionFactoryTest.php b/src/Metadata/Tests/Resource/Factory/AttributesResourceMetadataCollectionFactoryTest.php index f3c457553d2..124def411ec 100644 --- a/src/Metadata/Tests/Resource/Factory/AttributesResourceMetadataCollectionFactoryTest.php +++ b/src/Metadata/Tests/Resource/Factory/AttributesResourceMetadataCollectionFactoryTest.php @@ -95,7 +95,6 @@ class: AttributeResource::class, priority: 4, status: 301, provider: AttributeResourceProvider::class, - // @noRector \Rector\Php81\Rector\Array_\FirstClassCallableRector processor: [AttributeResourceProcessor::class, 'process'] ), '_api_/dummy/{dummyId}/attribute_resources/{identifier}{._format}_patch' => new Patch( @@ -106,14 +105,12 @@ class: AttributeResource::class, priority: 5, status: 301, provider: AttributeResourceProvider::class, - // @noRector \Rector\Php81\Rector\Array_\FirstClassCallableRector processor: [AttributeResourceProcessor::class, 'process'] ), ], inputFormats: ['json' => ['application/merge-patch+json']], status: 301, provider: AttributeResourceProvider::class, - // @noRector \Rector\Php81\Rector\Array_\FirstClassCallableRector processor: [AttributeResourceProcessor::class, 'process'] ), ]), diff --git a/src/Serializer/AbstractCollectionNormalizer.php b/src/Serializer/AbstractCollectionNormalizer.php index c35033cdeb9..bf983c3dc55 100644 --- a/src/Serializer/AbstractCollectionNormalizer.php +++ b/src/Serializer/AbstractCollectionNormalizer.php @@ -39,7 +39,6 @@ abstract class AbstractCollectionNormalizer implements NormalizerInterface, Norm /** * This constant must be overridden in the child class. */ - // @noRector \Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector public const FORMAT = 'to-override'; public function __construct(protected ResourceClassResolverInterface $resourceClassResolver, protected string $pageParameterName, protected ?ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null) diff --git a/src/Serializer/JsonEncoder.php b/src/Serializer/JsonEncoder.php index 4b1be321528..f7a34ca4f18 100644 --- a/src/Serializer/JsonEncoder.php +++ b/src/Serializer/JsonEncoder.php @@ -26,7 +26,6 @@ */ final class JsonEncoder implements EncoderInterface, DecoderInterface { - // @noRector \Rector\Php81\Rector\Property\ReadOnlyPropertyRector public function __construct(private readonly string $format, private ?BaseJsonEncoder $jsonEncoder = null) { if (null !== $this->jsonEncoder) { diff --git a/src/Symfony/Bundle/DependencyInjection/Compiler/ElasticsearchClientPass.php b/src/Symfony/Bundle/DependencyInjection/Compiler/ElasticsearchClientPass.php index 7ca076677db..1be89c71010 100644 --- a/src/Symfony/Bundle/DependencyInjection/Compiler/ElasticsearchClientPass.php +++ b/src/Symfony/Bundle/DependencyInjection/Compiler/ElasticsearchClientPass.php @@ -57,10 +57,8 @@ public function process(ContainerBuilder $container): void $clientDefinition = $container->getDefinition('api_platform.elasticsearch.client'); if (!$clientConfiguration) { - // @noRector \Rector\Php81\Rector\Array_\FirstClassCallableRector $clientDefinition->setFactory([$builderName, 'build']); } else { - // @noRector \Rector\Php81\Rector\Array_\FirstClassCallableRector $clientDefinition->setFactory([$builderName, 'fromConfig']); $clientDefinition->setArguments([$clientConfiguration]); } diff --git a/tests/Behat/DoctrineContext.php b/tests/Behat/DoctrineContext.php index 899a224e8e2..4639644beb4 100644 --- a/tests/Behat/DoctrineContext.php +++ b/tests/Behat/DoctrineContext.php @@ -224,11 +224,8 @@ */ final class DoctrineContext implements Context { - // @noRector \Rector\Php81\Rector\Property\ReadOnlyPropertyRector private ObjectManager $manager; - // @noRector \Rector\Php81\Rector\Property\ReadOnlyPropertyRector private ?SchemaTool $schemaTool; - // @noRector \Rector\Php81\Rector\Property\ReadOnlyPropertyRector private ?SchemaManager $schemaManager; /** @@ -1470,7 +1467,7 @@ public function thereArePrograms(int $nb): void ->count()->getQuery()->execute(); } - for ($i = $count + 1; $i <= $nb; ++$i) { + for ($i = (int) $count + 1; $i <= $nb; ++$i) { $program = $this->isOrm() ? new Program() : new ProgramDocument(); $program->name = "Lorem ipsum $i"; $program->date = new \DateTimeImmutable(\sprintf('2015-03-0%dT10:00:00+00:00', $i)); @@ -1518,7 +1515,7 @@ public function thereAreComments(int $nb): void ->count()->getQuery()->execute(); } - for ($i = $count + 1; $i <= $nb; ++$i) { + for ($i = (int) $count + 1; $i <= $nb; ++$i) { $comment = $this->isOrm() ? new Comment() : new CommentDocument(); $comment->comment = "Lorem ipsum dolor sit amet $i"; $comment->date = new \DateTimeImmutable(\sprintf('2015-03-0%dT10:00:00+00:00', $i)); diff --git a/tests/Fixtures/TestBundle/Entity/Content.php b/tests/Fixtures/TestBundle/Entity/Content.php index e76c089f518..4a447c3748a 100644 --- a/tests/Fixtures/TestBundle/Entity/Content.php +++ b/tests/Fixtures/TestBundle/Entity/Content.php @@ -37,7 +37,6 @@ class Content implements \JsonSerializable #[ORM\OrderBy(['id' => 'ASC'])] private Collection|iterable $fields; #[ORM\Column(type: 'string')] - // @noRector \Rector\Php81\Rector\Property\ReadOnlyPropertyRector private string $status = ContentStatus::DRAFT; public function __construct() diff --git a/tests/Hal/JsonSchema/SchemaFactoryTest.php b/tests/Hal/JsonSchema/SchemaFactoryTest.php index 90b48e34cf2..8868ab3d0cf 100644 --- a/tests/Hal/JsonSchema/SchemaFactoryTest.php +++ b/tests/Hal/JsonSchema/SchemaFactoryTest.php @@ -86,9 +86,7 @@ public function testHasRootDefinitionKeyBuildSchema(): void $definitions = $resultSchema->getDefinitions(); $rootDefinitionKey = $resultSchema->getRootDefinitionKey(); - // @noRector $this->assertTrue(isset($definitions[$rootDefinitionKey])); - // @noRector $this->assertTrue(isset($definitions[$rootDefinitionKey]['properties'])); $properties = $resultSchema['definitions'][$rootDefinitionKey]['properties']; $this->assertArrayHasKey('_links', $properties); @@ -117,7 +115,6 @@ public function testSchemaTypeBuildSchema(): void $definitionName = 'Dummy.jsonhal'; $this->assertNull($resultSchema->getRootDefinitionKey()); - // @noRector $this->assertTrue(isset($resultSchema['properties'])); $this->assertArrayHasKey('_embedded', $resultSchema['properties']); $this->assertArrayHasKey('totalItems', $resultSchema['properties']); @@ -129,7 +126,6 @@ public function testSchemaTypeBuildSchema(): void $resultSchema = $this->schemaFactory->buildSchema(Dummy::class, 'jsonhal', Schema::TYPE_OUTPUT, null, null, null, true); $this->assertNull($resultSchema->getRootDefinitionKey()); - // @noRector $this->assertTrue(isset($resultSchema['properties'])); $this->assertArrayHasKey('_embedded', $resultSchema['properties']); $this->assertArrayHasKey('totalItems', $resultSchema['properties']); diff --git a/tests/Symfony/Bundle/DependencyInjection/Compiler/ElasticsearchClientPassTest.php b/tests/Symfony/Bundle/DependencyInjection/Compiler/ElasticsearchClientPassTest.php index 3cb5f70410a..2245b50df0c 100644 --- a/tests/Symfony/Bundle/DependencyInjection/Compiler/ElasticsearchClientPassTest.php +++ b/tests/Symfony/Bundle/DependencyInjection/Compiler/ElasticsearchClientPassTest.php @@ -56,7 +56,6 @@ public function testProcess(): void } $clientDefinitionProphecy = $this->prophesize(Definition::class); - // @noRector \Rector\Php81\Rector\Array_\FirstClassCallableRector $clientDefinitionProphecy->setFactory([$clientBuilder, 'fromConfig'])->willReturn($clientDefinitionProphecy->reveal())->shouldBeCalled(); $clientDefinitionProphecy->setArguments( Argument::allOf( @@ -79,7 +78,6 @@ public function testProcessWithoutConfiguration(): void $clientBuilder = class_exists(\Elasticsearch\ClientBuilder::class) ? \Elasticsearch\ClientBuilder::class : \Elastic\Elasticsearch\ClientBuilder::class; $clientDefinitionProphecy = $this->prophesize(Definition::class); - // @noRector \Rector\Php81\Rector\Array_\FirstClassCallableRector $clientDefinitionProphecy->setFactory([$clientBuilder, 'build'])->willReturn($clientDefinitionProphecy->reveal())->shouldBeCalled(); $containerBuilderProphecy = $this->prophesize(ContainerBuilder::class);