Skip to content

Commit 9902abf

Browse files
committed
Removed obsolete parentheses around the 'new' calls
1 parent b68de6b commit 9902abf

File tree

103 files changed

+283
-283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+283
-283
lines changed

src/Command/Utils/CheckDependencies.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
139139
private function getNamespaceDirectories(): array
140140
{
141141
// Find all main namespace directories under 'tools' directory
142-
$finder = (new Finder())
142+
$finder = new Finder()
143143
->depth(1)
144144
->ignoreDotFiles(true)
145145
->directories()

src/EventSubscriber/JWTCreatedSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function setLocalizationData(array &$payload, UserInterface $user): void
100100
private function setExpiration(array &$payload): void
101101
{
102102
// Set new exp value for JWT
103-
$payload['exp'] = (new DateTime('+1 day', new DateTimeZone('UTC')))->getTimestamp();
103+
$payload['exp'] = new DateTime('+1 day', new DateTimeZone('UTC'))->getTimestamp();
104104
}
105105

106106
/**

src/Repository/HealthzRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function create(): Entity
8787
public function cleanup(): int
8888
{
8989
// Determine date
90-
$date = (new DateTimeImmutable(timezone: new DateTimeZone('UTC')))
90+
$date = new DateTimeImmutable(timezone: new DateTimeZone('UTC'))
9191
->sub(new DateInterval('P7D'));
9292

9393
// Create query builder

src/Repository/LogRequestRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
public function cleanHistory(): int
5252
{
5353
// Determine date
54-
$date = (new DateTimeImmutable(timezone: new DateTimeZone('UTC')))
54+
$date = new DateTimeImmutable(timezone: new DateTimeZone('UTC'))
5555
->sub(new DateInterval('P3Y'));
5656

5757
// Create query builder and define delete query

src/Repository/Traits/RepositoryMethodsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function findByAdvanced(
105105
*/
106106
RepositoryHelper::resetParameterCount();
107107

108-
$iterator = (new Paginator($queryBuilder, true))->getIterator();
108+
$iterator = new Paginator($queryBuilder, true)->getIterator();
109109

110110
assert($iterator instanceof ArrayIterator);
111111

src/Rest/RestResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function getDtoForEntity(
120120
* @var RestDtoInterface $restDto
121121
* @var class-string<RestDtoInterface> $dtoClass
122122
*/
123-
$restDto = (new $dtoClass())
123+
$restDto = new $dtoClass()
124124
->setId($id);
125125

126126
if ($patch === true) {

tests/DataFixtures/ORM/LoadApiKeyData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getOrder(): int
7777
private function createApiKey(ObjectManager $manager, ?string $role = null): bool
7878
{
7979
// Create new entity
80-
$entity = (new ApiKey())
80+
$entity = new ApiKey()
8181
->setDescription('ApiKey Description: ' . ($role === null ? '' : $this->rolesService->getShort($role)))
8282
->setToken(str_pad($role === null ? '' : $this->rolesService->getShort($role), 40, '_'));
8383

tests/DataFixtures/ORM/LoadRoleData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getOrder(): int
5959
private function createRole(ObjectManager $manager, string $role): bool
6060
{
6161
// Create new Role entity
62-
$entity = (new Role($role))
62+
$entity = new Role($role)
6363
->setDescription('Description - ' . $role);
6464

6565
// Persist entity

tests/DataFixtures/ORM/LoadUserData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private function createUser(ObjectManager $manager, ?string $role = null): bool
8282
$suffix = $role === null ? '' : '-' . $this->rolesService->getShort($role);
8383

8484
// Create new entity
85-
$entity = (new User())
85+
$entity = new User()
8686
->setUsername('john' . $suffix)
8787
->setFirstName('John')
8888
->setLastName('Doe')

tests/DataFixtures/ORM/LoadUserGroupData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private function createUserGroup(ObjectManager $manager, string $role): bool
7474
$roleReference = $this->getReference('Role-' . $this->rolesService->getShort($role), Role::class);
7575

7676
// Create new entity
77-
$entity = (new UserGroup())
77+
$entity = new UserGroup()
7878
->setRole($roleReference)
7979
->setName($this->rolesService->getRoleLabel($role));
8080

tests/Functional/Repository/HealthzRepositoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testThatReadValueMethodReturnsExpectedWithEmptyDatabase(): void
6565
public function testThatCreateValueReturnsExpected(): void
6666
{
6767
self::assertEqualsWithDelta(
68-
(new DateTimeImmutable('now', new DateTimeZone('utc')))->getTimestamp(),
68+
new DateTimeImmutable('now', new DateTimeZone('utc'))->getTimestamp(),
6969
$this->getRepository()->create()->getCreatedAt()->getTimestamp(),
7070
1,
7171
);

tests/Integration/AutoMapper/GenericRestRequestMapperTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testThatMapToObjectThrowsAnExceptionIfSourceIsAnArray(): void
3939

4040
$resource = $this->getMockBuilder(UserGroupResource::class)->disableOriginalConstructor()->getMock();
4141

42-
(new RequestMapper($resource))->mapToObject([], new stdClass());
42+
new RequestMapper($resource)->mapToObject([], new stdClass());
4343
}
4444

4545
/**
@@ -53,7 +53,7 @@ public function testThatMapToObjectThrowsAnExceptionIfSourceIsNotRequestObject()
5353

5454
$resource = $this->getMockBuilder(UserGroupResource::class)->disableOriginalConstructor()->getMock();
5555

56-
(new RequestMapper($resource))->mapToObject(new stdClass(), new stdClass());
56+
new RequestMapper($resource)->mapToObject(new stdClass(), new stdClass());
5757
}
5858

5959
/**
@@ -69,7 +69,7 @@ public function testThatMapToObjectThrowsAnExceptionIfDestinationIsNotRestDtoInt
6969

7070
$resource = $this->getMockBuilder(UserGroupResource::class)->disableOriginalConstructor()->getMock();
7171

72-
(new RequestMapper($resource))->mapToObject(new Request(), new stdClass());
72+
new RequestMapper($resource)->mapToObject(new Request(), new stdClass());
7373
}
7474

7575
/**
@@ -85,7 +85,7 @@ public function testThatMapToObjectThrowsAnExceptionIfThereIsNotPropertiesToConv
8585

8686
$mockRestDtoInterface = $this->getMockBuilder(RestDtoInterface::class)->getMock();
8787

88-
(new TestRestRequestMapperWithoutProperties())->mapToObject(new Request(), $mockRestDtoInterface);
88+
new TestRestRequestMapperWithoutProperties()->mapToObject(new Request(), $mockRestDtoInterface);
8989
}
9090

9191
/**
@@ -100,7 +100,7 @@ public function testThatMapToObjectWorksAsExpected(): void
100100
]);
101101

102102
/** @var TestRestRequestMapperDto $transformedObject */
103-
$transformedObject = (new TestRestRequestMapper())->mapToObject($request, new TestRestRequestMapperDto());
103+
$transformedObject = new TestRestRequestMapper()->mapToObject($request, new TestRestRequestMapperDto());
104104

105105
self::assertSame('someValue', $transformedObject->getSomeProperty());
106106
self::assertSame('fbzrGenafsbezInyhr', $transformedObject->getSomeTransformProperty());

tests/Integration/Compiler/StopwatchCompilerPassTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testThatFindTaggedServiceIdsMethodIsCalled(): void
3131
->method('findTaggedServiceIds')
3232
->willReturn([]);
3333

34-
(new StopwatchCompilerPass())->process($container);
34+
new StopwatchCompilerPass()->process($container);
3535
}
3636

3737
#[TestDox('Test that no other container methods are called when tagged service is not supported')]
@@ -54,7 +54,7 @@ public function testThatIfServiceStartsWithAppNoOtherContainerMethodsAreCalled()
5454
->expects(self::never())
5555
->method('setDefinition');
5656

57-
(new StopwatchCompilerPass())->process($container);
57+
new StopwatchCompilerPass()->process($container);
5858
}
5959

6060
public function testThatAllExpectedContainerMethodsAreCalled(): void
@@ -80,6 +80,6 @@ public function testThatAllExpectedContainerMethodsAreCalled(): void
8080
->method('setDefinition')
8181
->with('App\Foo.stopwatch');
8282

83-
(new StopwatchCompilerPass())->process($container);
83+
new StopwatchCompilerPass()->process($container);
8484
}
8585
}

tests/Integration/Controller/HealthzControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testThatInvokeMethodIsCallingExpectedMethods(): void
7171
),
7272
);
7373

74-
$response = (new HealthzController($responseHandler, $healthzService))($request);
74+
$response = new HealthzController($responseHandler, $healthzService)($request);
7575
$content = $response->getContent();
7676

7777
self::assertSame(200, $response->getStatusCode());

tests/Integration/Controller/IndexControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class IndexControllerTest extends KernelTestCase
2121
#[TestDox('Test that `__invoke` method returns proper response')]
2222
public function testThatInvokeMethodReturnsExpectedResponse(): void
2323
{
24-
$response = (new IndexController())();
24+
$response = new IndexController()();
2525
$content = $response->getContent();
2626

2727
self::assertSame(200, $response->getStatusCode());

tests/Integration/Controller/VersionControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testThatInvokeMethodIsCallingExpectedMethods(): void
3131
->method('get')
3232
->willReturn('1.0.0');
3333

34-
$response = (new VersionController($version))();
34+
$response = new VersionController($version)();
3535
$content = $response->getContent();
3636

3737
self::assertSame(200, $response->getStatusCode());

tests/Integration/Controller/v1/Auth/GetTokenControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class GetTokenControllerTest extends KernelTestCase
2424
public function testThatGetTokenThrowsAnException(): void
2525
{
2626
try {
27-
(new GetTokenController())();
27+
new GetTokenController()();
2828
} catch (Throwable $exception) {
2929
self::assertInstanceOf(HttpException::class, $exception);
3030
self::assertSame(

tests/Integration/Controller/v1/Localization/LanguageControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testThatInvokeMethodCallsExpectedServiceMethods(): void
2929
->method('getLanguages')
3030
->willReturn(['fi', 'en']);
3131

32-
$response = (new LanguageController($Localization))();
32+
$response = new LanguageController($Localization)();
3333
$content = $response->getContent();
3434

3535
self::assertSame(200, $response->getStatusCode());

tests/Integration/Controller/v1/Localization/LocaleControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testThatInvokeMethodCallsExpectedServiceMethods(): void
2929
->method('getLocales')
3030
->willReturn(['fi', 'en']);
3131

32-
$response = (new LocaleController($Localization))();
32+
$response = new LocaleController($Localization)();
3333
$content = $response->getContent();
3434

3535
self::assertSame(200, $response->getStatusCode());

tests/Integration/Controller/v1/Localization/TimeZoneControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testThatInvokeMethodCallsExpectedServiceMethods(): void
3636
],
3737
]);
3838

39-
$response = (new TimeZoneController($Localization))();
39+
$response = new TimeZoneController($Localization)();
4040
$content = $response->getContent();
4141

4242
self::assertSame(200, $response->getStatusCode());

tests/Integration/Controller/v1/Profile/GroupsControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
4343
)
4444
->willReturn('{}');
4545

46-
(new GroupsController($serializer))($user);
46+
new GroupsController($serializer)($user);
4747
}
4848
}

tests/Integration/Controller/v1/Profile/IndexControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
5454
->with(['foo', 'bar'])
5555
->willReturn(['foo', 'bar']);
5656

57-
(new IndexController($serializer, $rolesService))($user);
57+
new IndexController($serializer, $rolesService)($user);
5858
}
5959
}

tests/Integration/Controller/v1/Profile/RolesControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
3939
->with($user->getRoles())
4040
->willReturn([]);
4141

42-
(new RolesController($rolesService))->__invoke($user);
42+
new RolesController($rolesService)->__invoke($user);
4343
}
4444
}

tests/Integration/Controller/v1/Role/FindOneRoleControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
5858
->method('createResponse')
5959
->with($request, $role, $resource);
6060

61-
(new FindOneRoleController($resource))
61+
new FindOneRoleController($resource)
6262
->setResponseHandler($responseHandler)
6363
->__invoke($request, 'role');
6464
}

tests/Integration/Controller/v1/Role/InheritedRolesControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
3232
->with([$role->getId()])
3333
->willReturn([$role]);
3434

35-
(new InheritedRolesController($rolesService))($role);
35+
new InheritedRolesController($rolesService)($role);
3636
}
3737
}

tests/Integration/Controller/v1/User/AttachUserGroupControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
3636
$serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
3737

3838
$user = new User();
39-
$userGroup = (new UserGroup())->setRole(new Role('role'));
39+
$userGroup = new UserGroup()->setRole(new Role('role'));
4040

4141
$userResource
4242
->expects($this->once())
@@ -55,7 +55,7 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
5555
->method('serialize')
5656
->willReturn('[]');
5757

58-
(new AttachUserGroupController($userResource, $userGroupResource, $serializer))($user, $userGroup);
58+
new AttachUserGroupController($userResource, $userGroupResource, $serializer)($user, $userGroup);
5959

6060
self::assertTrue(
6161
$user->getUserGroups()->contains($userGroup),

tests/Integration/Controller/v1/User/DeleteUserControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testThatInvokeMethodThrowsAnExceptionIfUserTriesToDeleteHimself(
5656
$request = Request::create('/');
5757
$user = new User();
5858

59-
(new DeleteUserController($resource))($request, $user, $user);
59+
new DeleteUserController($resource)($request, $user, $user);
6060
}
6161

6262
/**
@@ -83,7 +83,7 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
8383
->method('createResponse')
8484
->with($request, $requestUser, $resource);
8585

86-
(new DeleteUserController($resource))
86+
new DeleteUserController($resource)
8787
->setResponseHandler($responseHandler)
8888
->__invoke($request, $requestUser, $loggedInUser);
8989
}

tests/Integration/Controller/v1/User/DetachUserGroupControllerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
3535
$userGroupResource = $this->getMockBuilder(UserGroupResource::class)->disableOriginalConstructor()->getMock();
3636
$serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
3737

38-
$userGroup = (new UserGroup())->setRole(new Role('role'));
39-
$user = (new User())->addUserGroup($userGroup);
38+
$userGroup = new UserGroup()->setRole(new Role('role'));
39+
$user = new User()->addUserGroup($userGroup);
4040

4141
$userResource
4242
->expects($this->once())
@@ -55,7 +55,7 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
5555
->method('serialize')
5656
->willReturn('[]');
5757

58-
(new DetachUserGroupController($userResource, $userGroupResource, $serializer))($user, $userGroup);
58+
new DetachUserGroupController($userResource, $userGroupResource, $serializer)($user, $userGroup);
5959

6060
self::assertFalse(
6161
$user->getUserGroups()->contains($userGroup),

tests/Integration/Controller/v1/User/UserGroupsControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
4343
)
4444
->willReturn('[]');
4545

46-
(new UserGroupsController($serializer))($user);
46+
new UserGroupsController($serializer)($user);
4747
}
4848
}

tests/Integration/Controller/v1/User/UserRolesControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
3939
->with($user->getRoles())
4040
->willReturn([]);
4141

42-
(new UserRolesController($rolesService))->__invoke($user);
42+
new UserRolesController($rolesService)->__invoke($user);
4343
}
4444
}

tests/Integration/Controller/v1/UserGroup/AttachUserControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
3535
$userGroupResource = $this->getMockBuilder(UserGroupResource::class)->disableOriginalConstructor()->getMock();
3636
$serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
3737

38-
$userGroup = (new UserGroup())->setRole(new Role('role'));
38+
$userGroup = new UserGroup()->setRole(new Role('role'));
3939
$user = new User();
4040

4141
$userResource
@@ -55,7 +55,7 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
5555
->method('serialize')
5656
->willReturn('[]');
5757

58-
(new AttachUserController($userResource, $userGroupResource, $serializer))($userGroup, $user);
58+
new AttachUserController($userResource, $userGroupResource, $serializer)($userGroup, $user);
5959

6060
self::assertTrue(
6161
$user->getUserGroups()->contains($userGroup),

tests/Integration/Controller/v1/UserGroup/DetachUserControllerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
3535
$userGroupResource = $this->getMockBuilder(UserGroupResource::class)->disableOriginalConstructor()->getMock();
3636
$serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
3737

38-
$userGroup = (new UserGroup())->setRole(new Role('role'));
39-
$user = (new User())->addUserGroup($userGroup);
38+
$userGroup = new UserGroup()->setRole(new Role('role'));
39+
$user = new User()->addUserGroup($userGroup);
4040

4141
$userResource
4242
->expects($this->once())
@@ -55,7 +55,7 @@ public function testThatInvokeMethodCallsExpectedMethods(): void
5555
->method('serialize')
5656
->willReturn('[]');
5757

58-
(new DetachUserController($userResource, $userGroupResource, $serializer))($userGroup, $user);
58+
new DetachUserController($userResource, $userGroupResource, $serializer)($userGroup, $user);
5959

6060
self::assertFalse(
6161
$user->getUserGroups()->contains($userGroup),

0 commit comments

Comments
 (0)