Skip to content

Commit

Permalink
Fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
eerison committed Aug 23, 2022
1 parent 695d2cb commit 1130c52
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Admin/SharedBlockAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
namespace Sonata\PageBundle\Admin;

use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\BlockBundle\Block\Service\EditableBlockService;
use Sonata\BlockBundle\Model\BlockInterface;
use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery;
use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQueryInterface as ORMProxyInterface;
use Sonata\PageBundle\Model\PageBlockInterface;

/**
Expand All @@ -38,14 +38,19 @@ protected function generateBaseRouteName(bool $isChildAdmin = false): string
return sprintf('%s_%s', parent::generateBaseRouteName($isChildAdmin), 'shared');
}

/**
* @param ORMProxyInterface<PageBlockInterface> $query
* @return ORMProxyInterface<PageBlockInterface>
*/
protected function configureQuery(ProxyQueryInterface $query): ProxyQueryInterface
{
\assert($query instanceof ProxyQuery);
\assert($query instanceof ORMProxyInterface);

// Filter on blocks without page and parents
$rootAlias = current($query->getRootAliases());
$query->andWhere($query->expr()->isNull($rootAlias.'.page'));
$query->andWhere($query->expr()->isNull($rootAlias.'.parent'));
$queryBuilder = $query->getQueryBuilder();
$rootAlias = current($queryBuilder->getRootAliases());
$queryBuilder->andWhere($queryBuilder->expr()->isNull($rootAlias.'.page'));
$queryBuilder->andWhere($queryBuilder->expr()->isNull($rootAlias.'.parent'));

return $query;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/PageAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public static function getSubscribedServices(): array
}

/**
* @param ProxyQueryInterface<object> $query
*
* @throws AccessDeniedException
*/
public function batchActionSnapshot(ProxyQueryInterface $query): RedirectResponse
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/SnapshotAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public static function getSubscribedServices(): array
}

/**
* @param ProxyQueryInterface<object> $query
*
* @throws AccessDeniedException
*/
public function batchActionToggleEnabled(ProxyQueryInterface $query): RedirectResponse
Expand Down
1 change: 1 addition & 0 deletions tests/Page/TemplateManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public function testTemplateShowingBreadcrumbIntoThePage(): void
$container->set('sonata.page.cms.snapshot', $cmsSnapshotManagerMock);

$twig = $container->get('twig');
\assert($twig instanceof Environment);

$manager = new TemplateManager($twig, []);
$response = $manager->renderResponse('test');
Expand Down

0 comments on commit 1130c52

Please sign in to comment.