Skip to content

Commit

Permalink
Fix static analysis (#8087)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Jul 22, 2023
1 parent d81d26c commit 18227f8
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/Block/AdminPreviewBlockService.php
Expand Up @@ -39,7 +39,6 @@ public function __construct(
public function execute(BlockContextInterface $blockContext, ?Response $response = null): Response
{
$template = $blockContext->getTemplate();
\assert(\is_string($template));

$admin = $this->getAdmin($blockContext->getSetting('code'));
$this->handleFilters($admin, $blockContext);
Expand Down
1 change: 0 additions & 1 deletion src/Block/AdminStatsBlockService.php
Expand Up @@ -36,7 +36,6 @@ public function __construct(
public function execute(BlockContextInterface $blockContext, ?Response $response = null): Response
{
$template = $blockContext->getTemplate();
\assert(null !== $template);

$admin = $this->pool->getAdminByAdminCode($blockContext->getSetting('code'));

Expand Down
4 changes: 3 additions & 1 deletion src/Twig/CanonicalizeRuntime.php
Expand Up @@ -17,6 +17,7 @@
use Symfony\Component\HttpFoundation\RequestStack;
use Twig\Extension\RuntimeExtensionInterface;

/** @psalm-suppress UndefinedClass */
final class CanonicalizeRuntime implements RuntimeExtensionInterface
{
/**
Expand All @@ -26,7 +27,7 @@ final class CanonicalizeRuntime implements RuntimeExtensionInterface
*/
public function __construct(
private RequestStack $requestStack,
private ?SonataFormCanonicalizeRuntime $canonicalizeRuntime
private ?SonataFormCanonicalizeRuntime $canonicalizeRuntime = null // @phpstan-ignore-line
) {
}

Expand All @@ -42,6 +43,7 @@ public function getCanonicalizedLocaleForMoment(): ?string
return null;
}

// @phpstan-ignore-next-line
return $this->canonicalizeRuntime->getCanonicalizedLocaleForMoment();
}

Expand Down
4 changes: 1 addition & 3 deletions tests/App/AppKernel.php
Expand Up @@ -108,10 +108,8 @@ protected function configureContainer(ContainerBuilder $containerBuilder, Loader

$loader->load(sprintf('%s/config/services.yml', $this->getProjectDir()));

/**
/*
* TODO: Remove when support for SonataBlockBundle 4 is dropped.
*
* @psalm-suppress DeprecatedClass
*/
$containerBuilder->loadFromExtension('sonata_block', class_exists(HttpCacheHandler::class) ? ['http_cache' => false] : []);
}
Expand Down
Expand Up @@ -832,10 +832,8 @@ private function setUpContainer(): void
$this->container->setAlias('translator', 'translator.default');

$blockExtension = new SonataBlockExtension();
/**
/*
* TODO: remove "http_cache" parameter when support for SonataBlockBundle 4 is dropped.
*
* @psalm-suppress DeprecatedClass
*/
$blockExtension->load(
[
Expand Down
Expand Up @@ -565,10 +565,8 @@ private function getContainer(): ContainerBuilder
->setClass(FileLocatorInterface::class);

$blockExtension = new SonataBlockExtension();
/**
/*
* TODO: remove "http_cache" parameter when support for SonataBlockBundle 4 is dropped.
*
* @psalm-suppress DeprecatedClass
*/
$blockExtension->load(
[
Expand Down
4 changes: 2 additions & 2 deletions tests/Show/ShowMapperTest.php
Expand Up @@ -57,12 +57,12 @@ final class ShowMapperTest extends TestCase
/**
* @var array<string, array<string, mixed>>
*/
private array $groups;
private array $groups = [];

/**
* @var array<string, bool>
*/
private array $listShowFields;
private array $listShowFields = [];

protected function setUp(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Translator/Extractor/AdminExtractorTest.php
Expand Up @@ -32,7 +32,7 @@ final class AdminExtractorTest extends TestCase
/**
* @var AdminInterface<object>&MockObject
*/
private AdminInterface$fooAdmin;
private AdminInterface $fooAdmin;

/**
* @var AdminInterface<object>&MockObject
Expand Down

0 comments on commit 18227f8

Please sign in to comment.