diff --git a/src/Kunstmaan/AdminBundle/EventListener/ToolbarListener.php b/src/Kunstmaan/AdminBundle/EventListener/ToolbarListener.php index 7e625e307e..47ff6a8d20 100644 --- a/src/Kunstmaan/AdminBundle/EventListener/ToolbarListener.php +++ b/src/Kunstmaan/AdminBundle/EventListener/ToolbarListener.php @@ -13,8 +13,8 @@ use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; -use Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken; use Twig\Environment; class ToolbarListener implements EventSubscriberInterface @@ -144,10 +144,10 @@ public function onKernelResponse(ResponseEvent $event) // Only enable toolbar when we can find an authenticated user in the session from the kunstmaan_admin.admin_firewall_name config value. $authenticated = false; - /* @var PostAuthenticationGuardToken $token */ if ($session->isStarted() && $session->has(sprintf('_security_%s', $this->adminFirewallName))) { + /** @var TokenInterface $token */ $token = unserialize($session->get(sprintf('_security_%s', $this->adminFirewallName))); - $authenticated = $token->isAuthenticated(); + $authenticated = null !== $token; } // Do not capture redirects or modify XML HTTP Requests diff --git a/src/Kunstmaan/AdminBundle/Helper/Security/Acl/Permission/PermissionAdmin.php b/src/Kunstmaan/AdminBundle/Helper/Security/Acl/Permission/PermissionAdmin.php index 2cf224aa02..802a698276 100644 --- a/src/Kunstmaan/AdminBundle/Helper/Security/Acl/Permission/PermissionAdmin.php +++ b/src/Kunstmaan/AdminBundle/Helper/Security/Acl/Permission/PermissionAdmin.php @@ -214,7 +214,7 @@ public function getPossiblePermissions() */ public function bindRequest(Request $request) { - $changes = $request->request->get('permission-hidden-fields'); + $changes = $request->request->all('permission-hidden-fields'); if (empty($changes)) { return true; diff --git a/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/Permission/PermissionAdminTest.php b/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/Permission/PermissionAdminTest.php index 756096d984..bd1c801b10 100644 --- a/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/Permission/PermissionAdminTest.php +++ b/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/Permission/PermissionAdminTest.php @@ -276,9 +276,7 @@ public function getInitializedPermissionAdmin(): PermissionAdmin public function testBindRequestReturnsTrueWhenNoChanges() { $object = $this->getInitializedPermissionAdmin(); - $request = $this->createMock(Request::class); - $request->request = $this->createMock(Request::class); - $request->request->expects($this->once())->method('get')->willReturn(''); + $request = new Request(); $object->bindRequest($request); } @@ -290,9 +288,7 @@ public function testBindRequest() $object = $this->getInitializedPermissionAdmin(); $token = $this->createMock(PreAuthenticatedToken::class); $token->expects($this->once())->method('getUser')->willReturn(new User()); - $request = $this->createMock(Request::class); - $request->request = $this->createMock(Request::class); - $request->request->expects($this->any())->method('get')->will($this->onConsecutiveCalls(['ADMIN' => ['ADD' => ['VIEW']]], true)); + $request = new Request([], ['permission-hidden-fields' => ['ADMIN' => ['ADD' => ['VIEW']]], 'applyRecursive' => true]); $mirror = new \ReflectionClass(PermissionAdmin::class); $property = $mirror->getProperty('tokenStorage'); diff --git a/src/Kunstmaan/ConfigBundle/Resources/config/routing.yml b/src/Kunstmaan/ConfigBundle/Resources/config/routing.yml index d2ccd50d0b..2a89ba53f8 100644 --- a/src/Kunstmaan/ConfigBundle/Resources/config/routing.yml +++ b/src/Kunstmaan/ConfigBundle/Resources/config/routing.yml @@ -1,4 +1,4 @@ kunstmaanconfigbundle_default: path: /%kunstmaan_admin.admin_prefix%/settings/config/{internalName} defaults: - _controller: kunstmaan_config.controller.config:indexAction + _controller: kunstmaan_config.controller.config::indexAction diff --git a/src/Kunstmaan/NodeBundle/Resources/config/routing.yml b/src/Kunstmaan/NodeBundle/Resources/config/routing.yml index 4d12a6739e..e1eaa80bff 100644 --- a/src/Kunstmaan/NodeBundle/Resources/config/routing.yml +++ b/src/Kunstmaan/NodeBundle/Resources/config/routing.yml @@ -11,4 +11,4 @@ KunstmaanNodeBundle_nodes: KunstmaanNodeBundle_urlchooser_replace: prefix: /%kunstmaan_admin.admin_prefix%/url-replace path: /replace - defaults: { _controller: kunstmaan_node.url_replace.controller:replaceURLAction } + defaults: { _controller: kunstmaan_node.url_replace.controller::replaceURLAction } diff --git a/src/Kunstmaan/PagePartBundle/PagePartAdmin/PagePartAdmin.php b/src/Kunstmaan/PagePartBundle/PagePartAdmin/PagePartAdmin.php index 81aa26ef67..27219b4687 100644 --- a/src/Kunstmaan/PagePartBundle/PagePartAdmin/PagePartAdmin.php +++ b/src/Kunstmaan/PagePartBundle/PagePartAdmin/PagePartAdmin.php @@ -186,7 +186,7 @@ public function preBindRequest(Request $request) // Create the objects for the new pageparts $this->newPageParts = []; - $newRefIds = $request->request->get($this->context . '_new'); + $newRefIds = $request->request->all($this->context . '_new'); if (\is_array($newRefIds)) { foreach ($newRefIds as $newId) { @@ -197,7 +197,7 @@ public function preBindRequest(Request $request) // Sort pageparts again $sequences = $request->request->all($this->context . '_sequence'); - if (!\is_null($sequences)) { + if ($sequences !== []) { $tempPageparts = $this->pageParts; $this->pageParts = []; foreach ($sequences as $sequence) {