Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Dec 3, 2023
1 parent 81e5e06 commit a0a562e
Show file tree
Hide file tree
Showing 29 changed files with 138 additions and 147 deletions.
13 changes: 4 additions & 9 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="v4.14.0@14dcbc908ab2625cd7a74258ee6c740cbecc6140">
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591">
<file src="src/Type/JsonType.php">
<TooManyTemplateParams occurrences="1">
<code>DataTransformerInterface</code>
</TooManyTemplateParams>
</file>
<file src="src/Type/OutputType.php">
<TooManyTemplateParams occurrences="1">
<code>DataTransformerInterface</code>
</TooManyTemplateParams>
<NoValue>
<code>$value</code>
</NoValue>
</file>
</files>
4 changes: 1 addition & 3 deletions src/Handler/Exception/InvalidCallbackException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@

use InvalidArgumentException;

class InvalidCallbackException extends InvalidArgumentException
{
}
class InvalidCallbackException extends InvalidArgumentException {}
6 changes: 3 additions & 3 deletions src/Test/AbstractFormHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ final protected function assertError(string $message, array $messageParameters =

private function equalToErrors(): Constraint
{
return static::callback(function ($error) {
return self::callback(function ($error) {
if ($error instanceof FormError) {
foreach ($this->errors as &$data) {
if ($error->getMessage() === $data['message'] && $error->getMessageParameters() === $data['parameters']) {
Expand All @@ -177,9 +177,9 @@ private function checkCalledErrors(): void
{
$count = \count($this->errors);
if (0 === $count) {
$this->form->expects(static::never())->method('addError');
$this->form->expects(self::never())->method('addError');
} else {
$this->form->expects(static::exactly($count))->method('addError')
$this->form->expects(self::exactly($count))->method('addError')
->with($this->equalToErrors())
;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Type/GenderType.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'choices' => [
'male' => static::TYPE_MALE,
'female' => static::TYPE_FEMALE,
'non_binary' => static::TYPE_NON_BINARY,
'male' => self::TYPE_MALE,
'female' => self::TYPE_FEMALE,
'non_binary' => self::TYPE_NON_BINARY,
],
'choice_label' => static function ($value, $key, $index) {
return 'gender.'.$key;
Expand Down
1 change: 0 additions & 1 deletion src/Validator/Constraints/BatchTimeAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

/**
* @Annotation
*
* @Target({"CLASS", "ANNOTATION"})
*/
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
Expand Down
1 change: 0 additions & 1 deletion src/Validator/Constraints/DateAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

/**
* @Annotation
*
* @Target({"CLASS", "ANNOTATION"})
*/
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
Expand Down
2 changes: 1 addition & 1 deletion tests/Bridge/Symfony/Bundle/BundleIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public function testStartup(): void

$client->request('GET', '/test');

static::assertSame(200, $client->getResponse()->getStatusCode());
self::assertSame(200, $client->getResponse()->getStatusCode());
}
}
4 changes: 2 additions & 2 deletions tests/Bridge/Symfony/Bundle/NucleosFormBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ public function testGetPath(): void
{
$bundle = new NucleosFormBundle();

static::assertStringEndsWith('Bridge/Symfony/Bundle', \dirname($bundle->getPath()));
self::assertStringEndsWith('Bridge/Symfony/Bundle', \dirname($bundle->getPath()));
}

public function testGetContainerExtension(): void
{
$bundle = new NucleosFormBundle();

static::assertInstanceOf(NucleosFormExtension::class, $bundle->getContainerExtension());
self::assertInstanceOf(NucleosFormExtension::class, $bundle->getContainerExtension());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ public function testLoadDefaultWithAdmin(): void
public function testLoadWithTwigExtension(): void
{
$fakeContainer = $this->createMock(ContainerBuilder::class);
$fakeContainer->expects(static::once())
$fakeContainer->expects(self::once())
->method('hasExtension')
->with(static::equalTo('twig'))
->with(self::equalTo('twig'))
->willReturn(true)
;
$fakeContainer->expects(static::once())
$fakeContainer->expects(self::once())
->method('prependExtensionConfig')
->with('twig', ['form_themes' => ['@NucleosForm/Form/widgets.html.twig']])
;
Expand Down
16 changes: 8 additions & 8 deletions tests/Extension/DownloadTypeExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public function testConfigureOptions(): void

$result = $resolver->resolve();

static::assertNull($result['download_path']);
static::assertSame('link_download', $result['download_text']);
self::assertNull($result['download_path']);
self::assertSame('link_download', $result['download_text']);
}

public function testBuildForm(): void
{
$builder = $this->createMock(FormBuilderInterface::class);
$builder->expects(static::once())->method('setAttribute')
$builder->expects(self::once())->method('setAttribute')
->with('download_path', 'image')
;

Expand Down Expand Up @@ -69,8 +69,8 @@ public function testBuildView(): void
'download_text' => 'link_download',
]);

static::assertSame('/foo/bar.png', $view->vars['download_path']);
static::assertSame('link_download', $view->vars['download_text']);
self::assertSame('/foo/bar.png', $view->vars['download_path']);
self::assertSame('link_download', $view->vars['download_text']);
}

public function testBuildViewWithoutData(): void
Expand All @@ -93,12 +93,12 @@ public function testBuildViewWithoutData(): void
'download_text' => 'link_download',
]);

static::assertNull($view->vars['download_path']);
static::assertSame('link_download', $view->vars['download_text']);
self::assertNull($view->vars['download_path']);
self::assertSame('link_download', $view->vars['download_text']);
}

public function testExtendedTypes(): void
{
static::assertSame([FileType::class], DownloadTypeExtension::getExtendedTypes());
self::assertSame([FileType::class], DownloadTypeExtension::getExtendedTypes());
}
}
10 changes: 5 additions & 5 deletions tests/Extension/ImageTypeExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ public function testConfigureOptions(): void

$result = $resolver->resolve();

static::assertNull($result['image_path']);
self::assertNull($result['image_path']);
}

public function testBuildForm(): void
{
$builder = $this->createMock(FormBuilderInterface::class);
$builder->expects(static::once())->method('setAttribute')
$builder->expects(self::once())->method('setAttribute')
->with('image_path', 'image')
;

Expand Down Expand Up @@ -67,7 +67,7 @@ public function testBuildView(): void
'image_path' => '[image]',
]);

static::assertSame('/foo/bar.png', $view->vars['image_url']);
self::assertSame('/foo/bar.png', $view->vars['image_url']);
}

public function testBuildViewWithoutData(): void
Expand All @@ -89,11 +89,11 @@ public function testBuildViewWithoutData(): void
'image_path' => '[image]',
]);

static::assertNull($view->vars['image_url']);
self::assertNull($view->vars['image_url']);
}

public function testExtendedTypes(): void
{
static::assertSame([FileType::class], ImageTypeExtension::getExtendedTypes());
self::assertSame([FileType::class], ImageTypeExtension::getExtendedTypes());
}
}
4 changes: 1 addition & 3 deletions tests/Fixtures/BarEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@

namespace Nucleos\Form\Tests\Fixtures;

class BarEntity
{
}
class BarEntity {}
4 changes: 1 addition & 3 deletions tests/Fixtures/DummyConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@

use Symfony\Component\Validator\Constraint;

final class DummyConstraint extends Constraint
{
}
final class DummyConstraint extends Constraint {}
4 changes: 1 addition & 3 deletions tests/Fixtures/FooEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@

namespace Nucleos\Form\Tests\Fixtures;

class FooEntity
{
}
class FooEntity {}
18 changes: 9 additions & 9 deletions tests/Form/Handler/AbstractFormHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public function testHandle(): void
$response = $this->createMock(Response::class);

$form = $this->createMock(FormInterface::class);
$form->expects(static::once())->method('handleRequest')
->with(static::equalTo($request))
$form->expects(self::once())->method('handleRequest')
->with(self::equalTo($request))
;
$form->expects(static::once())->method('isValid')
$form->expects(self::once())->method('isValid')
->willReturn(true)
;
$form->expects(static::once())->method('isSubmitted')
$form->expects(self::once())->method('isSubmitted')
->willReturn(true)
;

Expand All @@ -42,7 +42,7 @@ public function testHandle(): void
return $response;
});

static::assertSame($response, $result);
self::assertSame($response, $result);
}

public function testHandleInvalidCallback(): void
Expand All @@ -52,13 +52,13 @@ public function testHandleInvalidCallback(): void
$request = $this->createMock(Request::class);

$form = $this->createMock(FormInterface::class);
$form->expects(static::once())->method('handleRequest')
->with(static::equalTo($request))
$form->expects(self::once())->method('handleRequest')
->with(self::equalTo($request))
;
$form->expects(static::once())->method('isValid')
$form->expects(self::once())->method('isValid')
->willReturn(true)
;
$form->expects(static::once())->method('isSubmitted')
$form->expects(self::once())->method('isSubmitted')
->willReturn(true)
;

Expand Down
10 changes: 5 additions & 5 deletions tests/Model/BatchTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ public function testItIsInstantiable(): void
{
$batchTime = new BatchTime();

static::assertSame('Day: 0, Time: null', $batchTime->__toString());
static::assertSame('Day: 0, Time: null', $batchTime->toString());
self::assertSame('Day: 0, Time: null', $batchTime->__toString());
self::assertSame('Day: 0, Time: null', $batchTime->toString());
}

public function testDay(): void
{
$batchTime = new BatchTime();
$batchTime->setDay(3);

static::assertSame(3, $batchTime->getDay());
self::assertSame(3, $batchTime->getDay());
}

public function testTime(): void
Expand All @@ -45,7 +45,7 @@ public function testTime(): void
$batchTime = new BatchTime();
$batchTime->setTime($time);

static::assertSame($time, $batchTime->getTime());
self::assertSame($time, $batchTime->getTime());
}

public function testSeconds(): void
Expand All @@ -56,6 +56,6 @@ public function testSeconds(): void
$batchTime->setDay(2);
$batchTime->setTime($time);

static::assertSame(224580, $batchTime->getSeconds());
self::assertSame(224580, $batchTime->getSeconds());
}
}
12 changes: 6 additions & 6 deletions tests/Test/AbstractFormHandlerTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testExecutePreProcess(): void
$object = new stdClass();
$request = new Request();

static::assertNull($this->executePreProcess($request, $object));
self::assertNull($this->executePreProcess($request, $object));
}

public function testExecutePreProcessWithError(): void
Expand All @@ -42,7 +42,7 @@ public function testExecutePreProcessWithError(): void

$this->assertError('my error', ['foo' => 'bar']);

static::assertNotNull($this->executePreProcess($request, $object));
self::assertNotNull($this->executePreProcess($request, $object));
}

public function testExecuteProcess(): void
Expand All @@ -52,7 +52,7 @@ public function testExecuteProcess(): void
$object = new stdClass();
$request = new Request();

static::assertTrue($this->executeProcess($request, $object));
self::assertTrue($this->executeProcess($request, $object));
}

public function testExecuteProcessWithError(): void
Expand All @@ -64,7 +64,7 @@ public function testExecuteProcessWithError(): void

$this->assertError('my error', ['foo' => 'bar']);

static::assertFalse($this->executeProcess($request, $object));
self::assertFalse($this->executeProcess($request, $object));
}

public function testExecutePostProcess(): void
Expand All @@ -75,7 +75,7 @@ public function testExecutePostProcess(): void
$request = new Request();
$response = new Response();

static::assertSame($response, $this->executePostProcess($request, $response, $object));
self::assertSame($response, $this->executePostProcess($request, $response, $object));
}

public function testExecutePostProcessWithError(): void
Expand All @@ -88,7 +88,7 @@ public function testExecutePostProcessWithError(): void

$this->assertError('my error', ['foo' => 'bar']);

static::assertNull($this->executePostProcess($request, $response, $object));
self::assertNull($this->executePostProcess($request, $response, $object));
}

protected function createFormHandler(): FormHandlerInterface
Expand Down

0 comments on commit a0a562e

Please sign in to comment.