Skip to content

Commit

Permalink
Fix some psalm issues (#1433)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed May 9, 2021
1 parent 2798e05 commit b59f9e5
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 235 deletions.
5 changes: 3 additions & 2 deletions src/Filter/CallbackFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ public function getRenderSettings(): array

protected function association(ProxyQueryInterface $query, FilterData $data): array
{
$alias = $query->entityJoin($this->getParentAssociationMappings());
$alias = $this->getOption('alias', $query->entityJoin($this->getParentAssociationMappings()));
\assert(\is_string($alias));

return [$this->getOption('alias', $alias), $this->getFieldName()];
return [$alias, $this->getFieldName()];
}
}
20 changes: 5 additions & 15 deletions tests/DependencyInjection/SonataDoctrineORMAdminExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,16 @@

class SonataDoctrineORMAdminExtensionTest extends TestCase
{
/**
* @var ContainerBuilder
*/
protected $configuration;

protected function tearDown(): void
{
unset($this->configuration);
}

public function testEntityManagerSetFactory(): void
{
$this->configuration = new ContainerBuilder();
$this->configuration->setParameter('kernel.bundles', ['SimpleThingsEntityAuditBundle' => true]);
$configuration = new ContainerBuilder();
$configuration->setParameter('kernel.bundles', ['SimpleThingsEntityAuditBundle' => true]);
$loader = new SonataDoctrineORMAdminExtension();
$loader->load([], $this->configuration);
$loader->load([], $configuration);

$definition = $this->configuration->getDefinition('sonata.admin.entity_manager');
$definition = $configuration->getDefinition('sonata.admin.entity_manager');

$this->assertNotNull($definition->getFactory());
$this->assertNotFalse($this->configuration->getParameter('sonata_doctrine_orm_admin.audit.force'));
$this->assertNotFalse($configuration->getParameter('sonata_doctrine_orm_admin.audit.force'));
}
}
4 changes: 2 additions & 2 deletions tests/Filter/FilterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ private function createExprStub(): Expr
$expr = $this->createStub(Expr::class);

$expr->method('orX')->willReturnCallback(
static function ($x = null): Orx {
static function (): Orx {
return new Orx(\func_get_args());
}
);

$expr->method('andX')->willReturnCallback(
static function ($x = null): Andx {
static function (): Andx {
return new Andx(\func_get_args());
}
);
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Entity/ContainerEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class ContainerEntity
{
/**
* @var int
* @var int|null
*/
protected $plainField;

Expand Down
29 changes: 25 additions & 4 deletions tests/Fixtures/Entity/Embeddable/EmbeddedEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,32 @@
class EmbeddedEntity
{
/**
* @var bool
* @var bool|null
*/
protected $plainField;
public $plainField;

/**
* @var SubEmbeddedEntity
* @var SubEmbeddedEntity|null
*/
protected $subEmbeddedEntity;
private $subEmbeddedEntity;

public function setPlainField(bool $plainField): void
{
$this->plainField = $plainField;
}

public function getPlaingField(): ?bool
{
return $this->plainField;
}

public function setSubEmbeddedEntity(SubEmbeddedEntity $subEmbeddedEntity): void
{
$this->subEmbeddedEntity = $subEmbeddedEntity;
}

public function getSubEmbeddedEntity(): ?SubEmbeddedEntity
{
return $this->subEmbeddedEntity;
}
}
14 changes: 12 additions & 2 deletions tests/Fixtures/Entity/Embeddable/SubEmbeddedEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@
class SubEmbeddedEntity
{
/**
* @var bool
* @var bool|null
*/
protected $plainField;
private $plainField;

public function setPlainField(bool $plainField): void
{
$this->plainField = $plainField;
}

public function getPlaingField(): ?bool
{
return $this->plainField;
}
}
76 changes: 0 additions & 76 deletions tests/Fixtures/Entity/ORM/Menu.php

This file was deleted.

38 changes: 0 additions & 38 deletions tests/Fixtures/Entity/ORM/Product.php

This file was deleted.

38 changes: 0 additions & 38 deletions tests/Fixtures/Entity/ORM/Store.php

This file was deleted.

49 changes: 0 additions & 49 deletions tests/Fixtures/Entity/ORM/StoreProduct.php

This file was deleted.

12 changes: 11 additions & 1 deletion tests/Fixtures/Entity/ORM/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ class User
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(name="id", type="integer")
*
* @var int
* @var int|null
*/
private $id;

public function setId(int $id): void
{
$this->id = $id;
}

public function getId(): ?int
{
return $this->id;
}
}
24 changes: 22 additions & 2 deletions tests/Fixtures/Entity/ORM/UserBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class UserBrowser
* @ORM\GeneratedValue(strategy="NONE")
* @ORM\Column(type="integer")
*
* @var int
* @var int|null
*/
private $userId;

Expand All @@ -34,7 +34,27 @@ class UserBrowser
* @ORM\GeneratedValue(strategy="NONE")
* @ORM\Column(type="integer")
*
* @var int
* @var int|null
*/
private $browserId;

public function setUserId(int $userId): void
{
$this->userId = $userId;
}

public function getUserId(): ?int
{
return $this->userId;
}

public function setBrowserId(int $browserId): void
{
$this->browserId = $browserId;
}

public function getBrowserId(): ?int
{
return $this->browserId;
}
}
Loading

0 comments on commit b59f9e5

Please sign in to comment.