From 4631a515d15faf18da7768c6930e7060f8b4e529 Mon Sep 17 00:00:00 2001 From: Erison Silva Date: Mon, 22 Aug 2022 11:07:09 +0200 Subject: [PATCH] Fix phpstan --- src/Admin/SharedBlockAdmin.php | 8 ++++++-- src/Controller/PageAdminController.php | 2 ++ src/Controller/SnapshotAdminController.php | 2 ++ tests/Page/TemplateManagerTest.php | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Admin/SharedBlockAdmin.php b/src/Admin/SharedBlockAdmin.php index e412b9d48..25474fff3 100644 --- a/src/Admin/SharedBlockAdmin.php +++ b/src/Admin/SharedBlockAdmin.php @@ -14,11 +14,12 @@ 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 DatagridProxyInterface; use Sonata\PageBundle\Model\PageBlockInterface; /** @@ -38,9 +39,12 @@ protected function generateBaseRouteName(bool $isChildAdmin = false): string return sprintf('%s_%s', parent::generateBaseRouteName($isChildAdmin), 'shared'); } + /** + * @return DatagridProxyInterface + */ protected function configureQuery(ProxyQueryInterface $query): ProxyQueryInterface { - \assert($query instanceof ProxyQuery); + \assert($query instanceof DatagridProxyInterface); // Filter on blocks without page and parents $rootAlias = current($query->getRootAliases()); diff --git a/src/Controller/PageAdminController.php b/src/Controller/PageAdminController.php index 3dd9c2f0d..1d1dc2ce3 100644 --- a/src/Controller/PageAdminController.php +++ b/src/Controller/PageAdminController.php @@ -54,6 +54,8 @@ public static function getSubscribedServices(): array } /** + * @param ProxyQueryInterface $query + * * @throws AccessDeniedException */ public function batchActionSnapshot(ProxyQueryInterface $query): RedirectResponse diff --git a/src/Controller/SnapshotAdminController.php b/src/Controller/SnapshotAdminController.php index 231564920..519a2e9c2 100644 --- a/src/Controller/SnapshotAdminController.php +++ b/src/Controller/SnapshotAdminController.php @@ -35,6 +35,8 @@ public static function getSubscribedServices(): array } /** + * @param ProxyQueryInterface $query + * * @throws AccessDeniedException */ public function batchActionToggleEnabled(ProxyQueryInterface $query): RedirectResponse diff --git a/tests/Page/TemplateManagerTest.php b/tests/Page/TemplateManagerTest.php index 34039bb79..c394ec662 100644 --- a/tests/Page/TemplateManagerTest.php +++ b/tests/Page/TemplateManagerTest.php @@ -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');