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

Update tools #399

Merged
merged 2 commits into from
Dec 3, 2023
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: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ parameters:
count: 1
path: tests/Bridge/Symfony/Bundle/BundleIntegrationTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\TestCase\\:\\:createStub\\(\\)\\.$#"
count: 2
path: tests/EventListener/ORM/LifecycleDateListenerTest.php

-
message: "#^Call to function assert\\(\\) with true will always evaluate to true\\.$#"
count: 1
Expand Down
5 changes: 1 addition & 4 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.7.7@e028ba46ba0d7f9a78bc3201c251e137383e145f">
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591">
<file src="src/Bridge/Symfony/DependencyInjection/Configuration.php">
<ArgumentTypeCoercion>
<code>$rootNode</code>
</ArgumentTypeCoercion>
<PossiblyNullReference>
<code>end</code>
</PossiblyNullReference>
<PossiblyUndefinedMethod>
<code>end</code>
</PossiblyUndefinedMethod>
</file>
<file src="src/EventListener/ORM/ConfirmableListener.php">
<TypeDoesNotContainNull>
Expand Down
4 changes: 2 additions & 2 deletions src/Migration/IdToUuidMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function __construct(Connection $connection, ?LoggerInterface $logger = n
}

/**
* @param null|callable(mixed $id, string $uuid): void $callback
* @param callable(mixed $id, string $uuid): void|null $callback
*/
public function migrate(string $tableName, string $idField = 'id', callable $callback = null): void
{
Expand Down Expand Up @@ -300,7 +300,7 @@ private function addThoseUuidsToTablesWithFK(): void
}

/**
* @param null|callable(mixed $id, string $uuid): void $callback
* @param callable(mixed $id, string $uuid): void|null $callback
*/
private function handleCallback(?callable $callback): void
{
Expand Down
3 changes: 0 additions & 3 deletions src/Model/DeletableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@

interface DeletableInterface
{
/**
* @return DateTime
*/
public function getDeletedAt(): ?DateTime;

public function setDeletedAt(?DateTime $deletedAt): void;
Expand Down
2 changes: 1 addition & 1 deletion tests/Adapter/ORM/EntityManagerTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public function testCreateQueryBuilder(): void

$manager = new DemoEntityManager(EmptyClass::class, $registry);

static::assertSame($queryBuilder, $manager->getQueryBuilder('alias', 'someindex'));
self::assertSame($queryBuilder, $manager->getQueryBuilder('alias', 'someindex'));
}
}
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/NucleosDoctrineBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ public function testGetPath(): void
{
$bundle = new NucleosDoctrineBundle();

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

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

static::assertInstanceOf(NucleosDoctrineExtension::class, $bundle->getContainerExtension());
self::assertInstanceOf(NucleosDoctrineExtension::class, $bundle->getContainerExtension());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testDefaultOptions(): void
],
];

static::assertSame($expected, $config);
self::assertSame($expected, $config);
}

public function testOptions(): void
Expand All @@ -48,6 +48,6 @@ public function testOptions(): void
],
];

static::assertSame($expected, $config);
self::assertSame($expected, $config);
}
}
10 changes: 5 additions & 5 deletions tests/EventListener/ORM/ConfirmableListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testGetSubscribedEvents(): void
{
$listener = new ConfirmableListener();

static::assertSame([
self::assertSame([
Events::loadClassMetadata,
], $listener->getSubscribedEvents());
}
Expand All @@ -37,7 +37,7 @@ public function testLoadClassMetadataWithEmptyClass(): void
$metadata->method('getReflectionClass')
->willReturn(null)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand All @@ -56,7 +56,7 @@ public function testLoadClassMetadataWithInvalidClass(): void
$metadata->method('getReflectionClass')
->willReturn($reflection)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand All @@ -78,7 +78,7 @@ public function testLoadClassMetadataWithValidClass(): void
$metadata->method('hasField')->with('confirmedAt')
->willReturn(false)
;
$metadata->expects(static::once())->method('mapField')->with([
$metadata->expects(self::once())->method('mapField')->with([
'type' => 'datetime',
'fieldName' => 'confirmedAt',
'nullable' => true,
Expand All @@ -104,7 +104,7 @@ public function testLoadClassMetadataWithExistingProperty(): void
$metadata->method('hasField')->with('confirmedAt')
->willReturn(true)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand Down
10 changes: 5 additions & 5 deletions tests/EventListener/ORM/DeletableListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testGetSubscribedEvents(): void
{
$listener = new DeletableListener();

static::assertSame([
self::assertSame([
Events::loadClassMetadata,
], $listener->getSubscribedEvents());
}
Expand All @@ -37,7 +37,7 @@ public function testLoadClassMetadataWithEmptyClass(): void
$metadata->method('getReflectionClass')
->willReturn(null)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand All @@ -56,7 +56,7 @@ public function testLoadClassMetadataWithInvalidClass(): void
$metadata->method('getReflectionClass')
->willReturn($reflection)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand All @@ -78,7 +78,7 @@ public function testLoadClassMetadataWithValidClass(): void
$metadata->method('hasField')->with('deletedAt')
->willReturn(false)
;
$metadata->expects(static::once())->method('mapField')->with([
$metadata->expects(self::once())->method('mapField')->with([
'type' => 'datetime',
'fieldName' => 'deletedAt',
'nullable' => true,
Expand All @@ -104,7 +104,7 @@ public function testLoadClassMetadataWithExistingProperty(): void
$metadata->method('hasField')->with('deletedAt')
->willReturn(true)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand Down
24 changes: 12 additions & 12 deletions tests/EventListener/ORM/LifecycleDateListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testGetSubscribedEvents(): void
{
$listener = new LifecycleDateListener();

static::assertSame([
self::assertSame([
Events::prePersist,
Events::preUpdate,
Events::loadClassMetadata,
Expand All @@ -44,8 +44,8 @@ public function testGetSubscribedEvents(): void
public function testPrePersist(): void
{
$object = $this->createMock(LifecycleDateTimeInterface::class);
$object->expects(static::once())->method('setCreatedAt');
$object->expects(static::once())->method('setUpdatedAt');
$object->expects(self::once())->method('setCreatedAt');
$object->expects(self::once())->method('setUpdatedAt');

$eventArgs = new PrePersistEventArgs($object, $this->createStub(EntityManagerInterface::class));

Expand All @@ -58,7 +58,7 @@ public function testPrePersistForInvalidClass(): void
$object = $this->createMock(stdClass::class);

$entityManager = $this->createMock(EntityManagerInterface::class);
$entityManager->expects(static::never())->method('createQueryBuilder');
$entityManager->expects(self::never())->method('createQueryBuilder');

$listener = new LifecycleDateListener();
$listener->prePersist(new PrePersistEventArgs($object, $entityManager));
Expand All @@ -67,7 +67,7 @@ public function testPrePersistForInvalidClass(): void
public function testPreUpdate(): void
{
$object = $this->createMock(LifecycleDateTimeInterface::class);
$object->expects(static::once())->method('setUpdatedAt');
$object->expects(self::once())->method('setUpdatedAt');

$changeSet = [];

Expand All @@ -80,7 +80,7 @@ public function testPreUpdateForInvalidClass(): void
$object = $this->createMock(stdClass::class);

$entityManager = $this->createMock(EntityManagerInterface::class);
$entityManager->expects(static::never())->method('createQueryBuilder');
$entityManager->expects(self::never())->method('createQueryBuilder');

$changeSet = [];

Expand All @@ -94,7 +94,7 @@ public function testLoadClassMetadataWithEmptyClass(): void
$metadata->method('getReflectionClass')
->willReturn(null)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand All @@ -113,7 +113,7 @@ public function testLoadClassMetadataWithInvalidClass(): void
$metadata->method('getReflectionClass')
->willReturn($reflection)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand All @@ -132,14 +132,14 @@ public function testLoadClassMetadataWithValidClass(): void
$metadata->method('getReflectionClass')
->willReturn($reflection)
;
$metadata->expects($matcher = static::exactly(2))->method('hasField')
$metadata->expects($matcher = self::exactly(2))->method('hasField')
->willReturnCallback($this->withParameter($matcher, [
['createdAt'],
['updatedAt'],
]))
->willReturn(false)
;
$metadata->expects($matcher = static::exactly(2))->method('mapField')
$metadata->expects($matcher = self::exactly(2))->method('mapField')
->willReturnCallback($this->withParameter($matcher, [
[[
'type' => 'datetime',
Expand Down Expand Up @@ -172,14 +172,14 @@ public function testLoadClassMetadataWithExistingProperty(): void
$metadata->method('getReflectionClass')
->willReturn($reflection)
;
$metadata->expects($matcher = static::exactly(2))->method('hasField')
$metadata->expects($matcher = self::exactly(2))->method('hasField')
->willReturnCallback($this->withParameter($matcher, [
['createdAt'],
['updatedAt'],
]))
->willReturn(true)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand Down
14 changes: 7 additions & 7 deletions tests/EventListener/ORM/SortableListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testGetSubscribedEvents(): void
{
$listener = new SortableListener();

static::assertSame([
self::assertSame([
Events::prePersist,
Events::preUpdate,
Events::preRemove,
Expand All @@ -43,7 +43,7 @@ public function testPrePersistForInvalidClass(): void
$object = $this->createMock(stdClass::class);

$entityManager = $this->createMock(EntityManagerInterface::class);
$entityManager->expects(static::never())->method('createQueryBuilder');
$entityManager->expects(self::never())->method('createQueryBuilder');

$listener = new SortableListener();
$listener->prePersist(new PrePersistEventArgs($object, $entityManager));
Expand All @@ -54,7 +54,7 @@ public function testPreRemoveForInvalidClass(): void
$object = $this->createMock(stdClass::class);

$entityManager = $this->createMock(EntityManagerInterface::class);
$entityManager->expects(static::never())->method('createQueryBuilder');
$entityManager->expects(self::never())->method('createQueryBuilder');

$listener = new SortableListener();
$listener->preRemove(new PreRemoveEventArgs($object, $entityManager));
Expand All @@ -66,7 +66,7 @@ public function testLoadClassMetadataWithEmptyClass(): void
$metadata->method('getReflectionClass')
->willReturn(null)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand All @@ -85,7 +85,7 @@ public function testLoadClassMetadataWithInvalidClass(): void
$metadata->method('getReflectionClass')
->willReturn($reflection)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand All @@ -107,7 +107,7 @@ public function testLoadClassMetadataWithValidClass(): void
$metadata->method('hasField')->with('position')
->willReturn(false)
;
$metadata->expects(static::once())->method('mapField')->with([
$metadata->expects(self::once())->method('mapField')->with([
'type' => 'integer',
'fieldName' => 'position',
]);
Expand All @@ -132,7 +132,7 @@ public function testLoadClassMetadataWithExistingProperty(): void
$metadata->method('hasField')->with('position')
->willReturn(true)
;
$metadata->expects(static::never())->method('mapField');
$metadata->expects(self::never())->method('mapField');

$eventArgs = $this->createMock(LoadClassMetadataEventArgs::class);
$eventArgs->method('getClassMetadata')
Expand Down
2 changes: 1 addition & 1 deletion tests/EventListener/ORM/TablePrefixEventListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testGetSubscribedEvents(): void
{
$listener = new TablePrefixEventListener('acme_');

static::assertSame([
self::assertSame([
Events::loadClassMetadata,
], $listener->getSubscribedEvents());
}
Expand Down
Loading
Loading