From 29b5b7b73ca641ed543fb460104261631a37cf56 Mon Sep 17 00:00:00 2001 From: DDEV User Date: Sun, 30 Aug 2026 07:39:37 +0200 Subject: [PATCH] fix(tests,phpstan): CSP delete-form assertion and drop non-generic EventDispatcherTrait annotations --- phpstan-baseline.neon | 48 ++++++++++++++++--- src/Identifier/SocialIdentifier.php | 3 -- src/Model/Behavior/SocialBehavior.php | 3 -- .../SimpleCrudTraitIntegrationTest.php | 8 ++-- 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1550fe42..81ba24ac 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -12,12 +12,6 @@ parameters: count: 1 path: src/Controller/Component/LoginComponent.php - - - message: '#^Call to function method_exists\(\) with Authentication\\Authenticator\\AuthenticatorInterface and ''getIdentifier'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: src/Controller/Component/LoginComponent.php - - message: '#^Parameter \#1 \$request of method CakeDC\\Users\\Middleware\\SocialAuthMiddleware\:\:goNext\(\) expects Cake\\Http\\ServerRequest, Psr\\Http\\Message\\ServerRequestInterface given\.$#' identifier: argument.type @@ -60,6 +54,18 @@ parameters: count: 1 path: src/Model/Behavior/LinkSocialBehavior.php + - + message: '#^Access to an undefined property Cake\\Datasource\\EntityInterface\:\:\$id\.$#' + identifier: property.notFound + count: 5 + path: src/Model/Behavior/OneTimeLoginLinkBehavior.php + + - + message: '#^Access to an undefined property Cake\\Datasource\\EntityInterface\:\:\$login_token_date\.$#' + identifier: property.notFound + count: 1 + path: src/Model/Behavior/OneTimeLoginLinkBehavior.php + - message: '#^Access to an undefined property Cake\\Datasource\\EntityInterface\:\:\$active\.$#' identifier: property.notFound @@ -78,6 +84,12 @@ parameters: count: 1 path: src/Model/Behavior/RegisterBehavior.php + - + message: '#^Call to an undefined method Cake\\Datasource\\EntityInterface\:\:tokenExpired\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Model/Behavior/RegisterBehavior.php + - message: '#^Call to an undefined method Cake\\ORM\\Table\:\:validationRegister\(\)\.$#' identifier: method.notFound @@ -90,6 +102,24 @@ parameters: count: 1 path: src/Model/Behavior/SocialAccountBehavior.php + - + message: '#^Access to an undefined property Cake\\Datasource\\EntityInterface\:\:\$active\.$#' + identifier: property.notFound + count: 2 + path: src/Model/Behavior/SocialAccountBehavior.php + + - + message: '#^Access to an undefined property Cake\\Datasource\\EntityInterface\:\:\$token\.$#' + identifier: property.notFound + count: 1 + path: src/Model/Behavior/SocialAccountBehavior.php + + - + message: '#^Access to an undefined property Cake\\Datasource\\EntityInterface\:\:\$user\.$#' + identifier: property.notFound + count: 1 + path: src/Model/Behavior/SocialAccountBehavior.php + - message: '#^Method CakeDC\\Users\\Model\\Behavior\\SocialAccountBehavior\:\:resendValidation\(\) should return CakeDC\\Users\\Model\\Entity\\User but returns array\.$#' identifier: return.type @@ -102,6 +132,12 @@ parameters: count: 1 path: src/Model/Behavior/SocialAccountBehavior.php + - + message: '#^Parameter \#1 \$socialAccount of method CakeDC\\Users\\Model\\Behavior\\SocialAccountBehavior\:\:_activateAccount\(\) expects CakeDC\\Users\\Model\\Entity\\SocialAccount, Cake\\Datasource\\EntityInterface given\.$#' + identifier: argument.type + count: 1 + path: src/Model/Behavior/SocialAccountBehavior.php + - message: '#^Access to an undefined property Cake\\ORM\\Table\:\:\$SocialAccounts\.$#' identifier: property.notFound diff --git a/src/Identifier/SocialIdentifier.php b/src/Identifier/SocialIdentifier.php index bf05da41..2a369a88 100644 --- a/src/Identifier/SocialIdentifier.php +++ b/src/Identifier/SocialIdentifier.php @@ -21,9 +21,6 @@ class SocialIdentifier extends AbstractIdentifier { - /** - * @use \Cake\Event\EventDispatcherTrait<\CakeDC\Users\Identifier\SocialIdentifier> - */ use EventDispatcherTrait; use LocatorAwareTrait; diff --git a/src/Model/Behavior/SocialBehavior.php b/src/Model/Behavior/SocialBehavior.php index 7ad6258a..47116eb9 100644 --- a/src/Model/Behavior/SocialBehavior.php +++ b/src/Model/Behavior/SocialBehavior.php @@ -31,9 +31,6 @@ */ class SocialBehavior extends BaseTokenBehavior { - /** - * @use \Cake\Event\EventDispatcherTrait<\CakeDC\Users\Model\Behavior\SocialBehavior> - */ use EventDispatcherTrait; use RandomStringTrait; diff --git a/tests/TestCase/Controller/Traits/Integration/SimpleCrudTraitIntegrationTest.php b/tests/TestCase/Controller/Traits/Integration/SimpleCrudTraitIntegrationTest.php index 017d0af5..1a5e09ed 100644 --- a/tests/TestCase/Controller/Traits/Integration/SimpleCrudTraitIntegrationTest.php +++ b/tests/TestCase/Controller/Traits/Integration/SimpleCrudTraitIntegrationTest.php @@ -59,7 +59,7 @@ public function testCrud() $this->assertResponseContains('View'); $this->assertResponseContains('Change password'); $this->assertResponseContains('Edit'); - $this->assertResponseContains('method="post" style="display:none;" action="/users/delete/00000000-0000-0000-0000-000000000001"'); + $this->assertResponseContains('method="post" hidden="hidden" action="/users/delete/00000000-0000-0000-0000-000000000001"'); $this->assertResponseContains('>Delete<'); $this->assertResponseContains('user-6'); @@ -69,7 +69,7 @@ public function testCrud() $this->assertResponseContains('View'); $this->assertResponseContains('Change password'); $this->assertResponseContains('Edit'); - $this->assertResponseContains('method="post" style="display:none;" action="/users/delete/00000000-0000-0000-0000-000000000006"'); + $this->assertResponseContains('method="post" hidden="hidden" action="/users/delete/00000000-0000-0000-0000-000000000006"'); $this->get('/users/change-password/00000000-0000-0000-0000-000000000006'); $this->assertFlashMessage('Changing another user\'s password is not allowed'); @@ -101,7 +101,7 @@ public function testCrud() $this->assertResponseContains('Active'); - $this->assertResponseContains('method="post" style="display:none;" action="/users/delete/00000000-0000-0000-0000-000000000006"'); + $this->assertResponseContains('method="post" hidden="hidden" action="/users/delete/00000000-0000-0000-0000-000000000006"'); $this->assertResponseContains('List Users'); $this->enableSecurityToken(); @@ -124,7 +124,7 @@ public function testCrud() $this->assertResponseContains('Edit User'); $this->assertResponseContains('New User'); $this->assertResponseContains('List Users'); - $this->assertResponseContains('method="post" style="display:none;" action="/users/delete/00000000-0000-0000-0000-000000000006"'); + $this->assertResponseContains('method="post" hidden="hidden" action="/users/delete/00000000-0000-0000-0000-000000000006"'); $this->post('/users/delete/00000000-0000-0000-0000-000000000006'); $this->assertRedirect('/users/index');