Skip to content

Commit 0b47b88

Browse files
mpdudegithub-actions[bot]
authored andcommitted
Fix CS with PHP-CS-Fixer
1 parent 9491c45 commit 0b47b88

6 files changed

Lines changed: 16 additions & 20 deletions

File tree

tests/Doctrine/TranslatableClassMetadataTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22

33
namespace Webfactory\Bundle\PolyglotBundle\Tests\Doctrine;
44

5-
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
65
use Doctrine\Persistence\Mapping\RuntimeReflectionService;
7-
use PHPUnit\Framework\TestCase;
86
use Webfactory\Bundle\PolyglotBundle\Doctrine\TranslatableClassMetadata;
97
use Webfactory\Bundle\PolyglotBundle\Tests\Fixtures\Entity\TestEntity;
10-
use Webfactory\Bundle\PolyglotBundle\Tests\Fixtures\Entity\TestEntityTranslation;
118
use Webfactory\Bundle\PolyglotBundle\Tests\Functional\DatabaseFunctionalTestCase;
12-
use Webfactory\Doctrine\ORMTestInfrastructure\ORMInfrastructure;
139

1410
class TranslatableClassMetadataTest extends DatabaseFunctionalTestCase
1511
{

tests/Fixtures/Query.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ class Query
1919
*
2020
* @var string
2121
*/
22-
protected $sql = null;
22+
protected $sql;
2323

2424
/**
2525
* The assigned parameters.
2626
*
2727
* @var mixed[]
2828
*/
29-
protected $params = null;
29+
protected $params;
3030

3131
/**
3232
* Currently not used:
3333
* - types
3434
*
35-
* @param string $sql - sql
35+
* @param string $sql - sql
3636
* @param mixed[] $params - params
3737
*/
3838
public function __construct($sql, array $params)
@@ -69,6 +69,7 @@ public function getParams()
6969
public function __toString()
7070
{
7171
$template = '"%s" with parameters [%s]';
72-
return sprintf($template, $this->getSql(), implode(', ', $this->getParams()));
72+
73+
return \sprintf($template, $this->getSql(), implode(', ', $this->getParams()));
7374
}
7475
}

tests/Fixtures/QueryLogger.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,26 @@
33
namespace Webfactory\Bundle\PolyglotBundle\Tests\Fixtures;
44

55
use Psr\Log\AbstractLogger;
6+
use Stringable;
67

78
class QueryLogger extends AbstractLogger
89
{
910
public bool $enabled = true;
1011
private array $queries = [];
1112

12-
public function log($level, \Stringable|string $message, array $context = []): void
13+
public function log($level, Stringable|string $message, array $context = []): void
1314
{
1415
if (!$this->enabled) {
1516
return;
1617
}
1718

1819
if (str_starts_with($message, 'Executing')) {
1920
$this->queries[] = new Query($context['sql'], $context['params'] ?? []);
20-
} else if ('Beginning transaction' === $message) {
21+
} elseif ('Beginning transaction' === $message) {
2122
$this->queries[] = new Query('"START TRANSACTION"', []);
22-
} else if ('Committing transaction' === $message) {
23+
} elseif ('Committing transaction' === $message) {
2324
$this->queries[] = new Query('"COMMIT"', []);
24-
} else if ('Rolling back transaction' === $message) {
25+
} elseif ('Rolling back transaction' === $message) {
2526
$this->queries[] = new Query('"ROLLBACK"', []);
2627
}
2728
}

tests/Functional/CascadePersistTranslationsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public function adding_and_persisting_translations(): void
2525
$entity->addTranslation('de_DE', 'text de_DE');
2626

2727
self::import([$entity]);
28-
// $this->entityManager->persist($entity);
29-
// $this->entityManager->flush();
28+
// $this->entityManager->persist($entity);
29+
// $this->entityManager->flush();
3030

3131
// note the absent call to $this->entityManager->persist() for the translation entity
3232

tests/Functional/DatabaseFunctionalTestCase.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
use Doctrine\ORM\EntityManager;
66
use Doctrine\ORM\Tools\SchemaTool;
7-
use PHPUnit\Framework\Attributes\Test;
87
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
9-
use Webfactory\Bundle\PolyglotBundle\Tests\Fixtures\Entity\TestEntity;
108
use Webfactory\Bundle\PolyglotBundle\Tests\Fixtures\Query;
119
use Webfactory\Bundle\PolyglotBundle\Tests\Fixtures\QueryLogger;
1210

@@ -34,7 +32,7 @@ protected static function setupSchema(array $classes): void
3432

3533
protected static function import(object|array $objects): void
3634
{
37-
if (is_object($objects)) {
35+
if (\is_object($objects)) {
3836
$objects = [$objects];
3937
}
4038
$container = static::getContainer();
@@ -43,10 +41,10 @@ protected static function import(object|array $objects): void
4341
$classes = [];
4442
foreach ($objects as $object) {
4543
$entityManager->persist($object);
46-
#$classes[get_class($object)] = true;
44+
// $classes[get_class($object)] = true;
4745
}
4846

49-
#self::setupSchema(array_keys($classes));
47+
// self::setupSchema(array_keys($classes));
5048
$entityManager->flush();
5149
}
5250

tests/Functional/IntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class IntegrationTest extends DatabaseFunctionalTestCase
1515
protected function setUp(): void
1616
{
1717
parent::setUp();
18-
18+
1919
self::setupSchema([TestEntity::class, TestEntityTranslation::class]);
2020
$this->defaultLocaleProvider = self::getContainer()->get(DefaultLocaleProvider::class);
2121
}

0 commit comments

Comments
 (0)