Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8121: Fixed code style for 5.0 #81

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@
"twig/twig": "^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"ibexa/ci-scripts": "^0.2@dev",
"ibexa/code-style": "^1.0",
"ibexa/code-style": "~2.0.0",
"ibexa/design-engine": "~5.0.x-dev",
"ibexa/doctrine-schema": "~5.0.x-dev",
"ibexa/fieldtype-richtext": "~5.0.x-dev",
Expand All @@ -60,7 +59,7 @@
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-symfony": "^1.3",
"phpunit/phpunit": "^8.2",
"phpunit/phpunit": "^9.6",
"symfony/phpunit-bridge": "^5.3",
"symfony/proxy-manager-bridge": "^5.0"
},
Expand Down
1 change: 1 addition & 0 deletions src/bundle/IbexaUserBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\Bundle\User;

use Ibexa\Bundle\User\DependencyInjection\Compiler\SecurityPass;
Expand Down
4 changes: 1 addition & 3 deletions src/contracts/Notification/UserPasswordReset.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
use Symfony\Component\Notifier\Recipient\EmailRecipientInterface;
use Symfony\Component\Notifier\Recipient\SmsRecipientInterface;

final class UserPasswordReset
extends Notification
implements EmailNotificationInterface, SmsNotificationInterface, UserAwareNotificationInterface
final class UserPasswordReset extends Notification implements EmailNotificationInterface, SmsNotificationInterface, UserAwareNotificationInterface
{
private User $user;

Expand Down
4 changes: 1 addition & 3 deletions src/contracts/Notification/UserRegister.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
use Symfony\Component\Notifier\Recipient\EmailRecipientInterface;
use Symfony\Component\Notifier\Recipient\SmsRecipientInterface;

final class UserRegister
extends Notification
implements EmailNotificationInterface, SmsNotificationInterface, UserAwareNotificationInterface
final class UserRegister extends Notification implements EmailNotificationInterface, SmsNotificationInterface, UserAwareNotificationInterface
{
private User $user;

Expand Down
1 change: 1 addition & 0 deletions src/lib/Behat/Context/UserSettingsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\User\Behat\Context;

use Behat\Behat\Context\Context;
Expand Down
1 change: 1 addition & 0 deletions src/lib/Form/Data/UserInvitationData.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ final class UserInvitationData
{
/**
* @Assert\NotBlank()
*
* @Assert\Email()
*/
private string $email;
Expand Down
1 change: 1 addition & 0 deletions src/lib/Form/Data/UserPasswordChangeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class UserPasswordChangeData
{
/**
* @UserAssert\UserPassword()
*
* @Assert\NotBlank()
*
* @var string
Expand Down
1 change: 1 addition & 0 deletions src/lib/Form/DataMapper/UserRegisterMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\User\Form\DataMapper;

use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
Expand Down
1 change: 1 addition & 0 deletions src/lib/Form/Processor/UserRegisterFormProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\User\Form\Processor;

use Ibexa\ContentForms\Event\FormActionEvent;
Expand Down
1 change: 1 addition & 0 deletions src/lib/Form/Type/Invitation/InvitationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\User\Form\Type\Invitation;

use Ibexa\Contracts\User\Invitation\InvitationService;
Expand Down
1 change: 1 addition & 0 deletions src/lib/Form/Type/Invitation/UserInvitationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\User\Form\Type\Invitation;

use Ibexa\User\Form\Data\UserInvitationData;
Expand Down
1 change: 1 addition & 0 deletions src/lib/Form/Type/UserRegisterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\User\Form\Type;

use Ibexa\ContentForms\Form\EventSubscriber\UserFieldsSubscriber;
Expand Down
1 change: 1 addition & 0 deletions src/lib/Permission/UserPermissionsLimitationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\User\Permission;

use Ibexa\Contracts\Core\Persistence\User\Policy;
Expand Down
1 change: 1 addition & 0 deletions src/lib/Permission/UserPermissionsLimitationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\User\Permission;

use Ibexa\Contracts\Core\Exception\InvalidArgumentType;
Expand Down
1 change: 1 addition & 0 deletions src/lib/View/Register/ConfirmView.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\User\View\Register;

use Ibexa\Core\MVC\Symfony\View\BaseView;
Expand Down
1 change: 1 addition & 0 deletions src/lib/View/Register/FormView.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

namespace Ibexa\User\View\Register;

use Ibexa\Core\MVC\Symfony\View\BaseView;
Expand Down
1 change: 1 addition & 0 deletions tests/integration/SampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

/**
* @group integration
*
* @coversNothing
*/
final class SampleTest extends IbexaKernelTestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function testGetChoiceList(
$availableTranslations
);

$this->assertSame($expectedLocales, $availableLocaleChoiceLoader->getChoiceList());
self::assertSame($expectedLocales, $availableLocaleChoiceLoader->getChoiceList());
}

public function providerForGetChoiceList(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Invitation/InvitationServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function testIsValid(
$invitation->getSiteAccessIdentifier()
)->willReturn('P2D');

$this->assertSame(
self::assertSame(
$isValid,
$this->invitationService->isValid($invitation)
);
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/Permission/UserPermissionsLimitationTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function testValidateError(UserPermissionsLimitation $limitation, int $er
->method('loadRole')
->withConsecutive([4, Role::STATUS_DEFINED], [8, Role::STATUS_DEFINED])
->willReturnOnConsecutiveCalls(
$this->throwException(new NotFoundException('Role', 4)),
self::throwException(new NotFoundException('Role', 4)),
new Role()
);

Expand All @@ -165,7 +165,7 @@ public function testValidateError(UserPermissionsLimitation $limitation, int $er
->method('loadContentInfo')
->withConsecutive([14], [18])
->willReturnOnConsecutiveCalls(
$this->throwException(new NotFoundException('Role', 4)),
self::throwException(new NotFoundException('Role', 4)),
new ContentInfo()
);

Expand Down
4 changes: 2 additions & 2 deletions tests/lib/UserSetting/UserSettingServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testCountUserSettings(): void
$valueRegistry->method('countValueDefinitions')->willReturn(2);
$userSettingService = new UserSettingService($userPreferenceService, $valueRegistry);

$this->assertEquals(2, $userSettingService->countUserSettings());
self::assertEquals(2, $userSettingService->countUserSettings());
}

public function testLoadUserSettings(): void
Expand Down Expand Up @@ -65,7 +65,7 @@ public function testLoadUserSettings(): void
'value' => '3',
]),
];
$this->assertEquals($expected, $settings);
self::assertEquals($expected, $settings);
}

/**
Expand Down
14 changes: 7 additions & 7 deletions tests/lib/UserSetting/ValueDefinitionRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testGetValueDefinitions()

$registry = new ValueDefinitionRegistry($definitions);

$this->assertEquals($definitions, $registry->getValueDefinitions());
self::assertEquals($definitions, $registry->getValueDefinitions());
}

public function testAddValueDefinition()
Expand All @@ -34,7 +34,7 @@ public function testAddValueDefinition()
$registry = new ValueDefinitionRegistry([]);
$registry->addValueDefinition('foo', $foo);

$this->assertEquals(['foo' => $foo], $registry->getValueDefinitions());
self::assertEquals(['foo' => $foo], $registry->getValueDefinitions());
}

public function testHasValueDefinition()
Expand All @@ -43,8 +43,8 @@ public function testHasValueDefinition()
'foo' => $this->createMock(ValueDefinitionInterface::class),
]);

$this->assertTrue($registry->hasValueDefinition('foo'));
$this->assertFalse($registry->hasValueDefinition('bar'));
self::assertTrue($registry->hasValueDefinition('foo'));
self::assertFalse($registry->hasValueDefinition('bar'));
}

public function testGetValueDefinition()
Expand All @@ -55,7 +55,7 @@ public function testGetValueDefinition()
'foo' => $foo,
]);

$this->assertEquals($foo, $registry->getValueDefinition('foo'));
self::assertEquals($foo, $registry->getValueDefinition('foo'));
}

public function testCountValueDefinitions()
Expand All @@ -67,14 +67,14 @@ public function testCountValueDefinitions()

$registry = new ValueDefinitionRegistry($definitions);

$this->assertEquals(2, $registry->countValueDefinitions());
self::assertEquals(2, $registry->countValueDefinitions());
}

public function testCountValueDefinitionsWithEmptyRegistry()
{
$registry = new ValueDefinitionRegistry([]);

$this->assertEquals(0, $registry->countValueDefinitions());
self::assertEquals(0, $registry->countValueDefinitions());
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/lib/Validator/Constraint/PasswordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ protected function setUp(): void

public function testConstruct(): void
{
$this->assertSame('ez.user.password.invalid', $this->constraint->message);
self::assertSame('ez.user.password.invalid', $this->constraint->message);
}

public function testValidatedBy(): void
{
$this->assertSame(PasswordValidator::class, $this->constraint->validatedBy());
self::assertSame(PasswordValidator::class, $this->constraint->validatedBy());
}

public function testGetTargets(): void
{
$this->assertSame([Password::CLASS_CONSTRAINT, Password::PROPERTY_CONSTRAINT], $this->constraint->getTargets());
self::assertSame([Password::CLASS_CONSTRAINT, Password::PROPERTY_CONSTRAINT], $this->constraint->getTargets());
}
}

Expand Down
16 changes: 8 additions & 8 deletions tests/lib/Validator/Constraint/PasswordValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ protected function setUp(): void
public function testValidateShouldBeSkipped($value): void
{
$this->userService
->expects($this->never())
->expects(self::never())
->method('validatePassword');

$this->executionContext
->expects($this->never())
->expects(self::never())
->method('buildViolation');

$this->validator->validate($value, new Password());
Expand Down Expand Up @@ -79,7 +79,7 @@ static function (string $actualPassword, PasswordValidationContext $actualContex
);

$this->executionContext
->expects($this->never())
->expects(self::never())
->method('buildViolation');

$this->validator->validate(
Expand All @@ -99,7 +99,7 @@ public function testInvalid(): void
$errorMessage = 'error';

$this->userService
->expects($this->once())
->expects(self::once())
->method('validatePassword')
->willReturnCallback(function (string $actualPassword, PasswordValidationContext $actualContext) use (
$password,
Expand All @@ -119,21 +119,21 @@ public function testInvalid(): void
$constraintViolationBuilder = $this->createMock(ConstraintViolationBuilderInterface::class);

$this->executionContext
->expects($this->once())
->expects(self::once())
->method('buildViolation')
->willReturn($constraintViolationBuilder);
$this->executionContext
->expects($this->once())
->expects(self::once())
->method('buildViolation')
->with($errorMessage)
->willReturn($constraintViolationBuilder);
$constraintViolationBuilder
->expects($this->once())
->expects(self::once())
->method('setParameters')
->with(['%foo%' => $errorParameter])
->willReturn($constraintViolationBuilder);
$constraintViolationBuilder
->expects($this->once())
->expects(self::once())
->method('addViolation');

$this->validator->validate('pass', new Password([
Expand Down
14 changes: 7 additions & 7 deletions tests/lib/Validator/Constraint/UserPasswordValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ protected function setUp(): void
public function testEmptyValueType($value)
{
$this->userService
->expects($this->never())
->expects(self::never())
->method('checkUserCredentials');
$this->tokenStorage
->expects($this->never())
->expects(self::never())
->method('getToken');
$this->executionContext
->expects($this->never())
->expects(self::never())
->method('buildViolation');

$this->validator->validate($value, new UserPassword());
Expand All @@ -81,7 +81,7 @@ public function emptyDataProvider(): array
public function testValid()
{
$apiUser = $this->getMockForAbstractClass(APIUser::class, [], '', true, true, true, ['__get']);
$apiUser->method('__get')->with($this->equalTo('login'))->willReturn('login');
$apiUser->method('__get')->with(self::equalTo('login'))->willReturn('login');
$user = $this->createMock(ReferenceUserInterface::class);
$user->method('getAPIUser')->willReturn($apiUser);
$token = $this->createMock(TokenInterface::class);
Expand All @@ -92,7 +92,7 @@ public function testValid()
->with($apiUser, 'password')
->willReturn(true);
$this->executionContext
->expects($this->never())
->expects(self::never())
->method('buildViolation');

$this->validator->validate('password', new UserPassword());
Expand All @@ -101,7 +101,7 @@ public function testValid()
public function testInvalid()
{
$apiUser = $this->getMockForAbstractClass(APIUser::class, [], '', true, true, true, ['__get']);
$apiUser->method('__get')->with($this->equalTo('login'))->willReturn('login');
$apiUser->method('__get')->with(self::equalTo('login'))->willReturn('login');
$user = $this->createMock(ReferenceUserInterface::class);
$user->method('getAPIUser')->willReturn($apiUser);
$token = $this->createMock(TokenInterface::class);
Expand All @@ -114,7 +114,7 @@ public function testInvalid()
$constraint = new UserPassword();
$constraintViolationBuilder = $this->createMock(ConstraintViolationBuilderInterface::class);
$this->executionContext
->expects($this->once())
->expects(self::once())
->method('buildViolation')
->with($constraint->message)
->willReturn($constraintViolationBuilder);
Expand Down
Loading