From f76820524368abe05fdbc22023401c82167f764b Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Sun, 17 Nov 2024 16:11:26 +0100 Subject: [PATCH] update stan --- .phive/phars.xml | 4 +- phpstan-baseline.neon | 21 +++-- psalm-baseline.xml | 102 ++++------------------- psalm.xml | 1 + src/Controller/MailPreviewController.php | 2 +- src/DebugPanel.php | 2 +- src/Panel/RoutesPanel.php | 6 +- src/Panel/SqlLogPanel.php | 6 +- 8 files changed, 42 insertions(+), 102 deletions(-) diff --git a/.phive/phars.xml b/.phive/phars.xml index 726b7777..d311bfa5 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,5 +1,5 @@ - - + + diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e111c1ab..01701274 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,26 +1,37 @@ parameters: ignoreErrors: - - message: "#^Method DebugKit\\\\Mailer\\\\Transport\\\\DebugKitTransport\\:\\:send\\(\\) should return array\\{headers\\: string, message\\: string\\} but returns array\\{headers\\: non\\-empty\\-array\\, message\\: array\\{text\\: string, html\\: string\\}\\}\\.$#" + message: '#^Method DebugKit\\Mailer\\Transport\\DebugKitTransport\:\:send\(\) should return array\{headers\: string, message\: string\} but returns array\{headers\: non\-empty\-array\, message\: array\{text\: string, html\: string\}\}\.$#' + identifier: return.type count: 1 path: src/Mailer/Transport/DebugKitTransport.php - - message: "#^Parameter \\#1 \\$request of method DebugKit\\\\ToolbarService\\:\\:saveData\\(\\) expects Cake\\\\Http\\\\ServerRequest, Psr\\\\Http\\\\Message\\\\ServerRequestInterface given\\.$#" + message: '#^Parameter \#1 \$request of method DebugKit\\ToolbarService\:\:saveData\(\) expects Cake\\Http\\ServerRequest, Psr\\Http\\Message\\ServerRequestInterface given\.$#' + identifier: argument.type count: 1 path: src/Middleware/DebugKitMiddleware.php - - message: "#^Call to an undefined method Cake\\\\ORM\\\\Locator\\\\LocatorInterface\\:\\:genericInstances\\(\\)\\.$#" + message: '#^PHPDoc tag @property for property DebugKit\\Model\\Table\\PanelsTable\:\:\$Requests contains unresolvable type\.$#' + identifier: propertyTag.unresolvableType + count: 1 + path: src/Model/Table/PanelsTable.php + + - + message: '#^Call to an undefined method Cake\\ORM\\Locator\\LocatorInterface\:\:genericInstances\(\)\.$#' + identifier: method.notFound count: 1 path: src/Panel/SqlLogPanel.php - - message: "#^Dead catch \\- Cake\\\\Core\\\\Exception\\\\CakeException is never thrown in the try block\\.$#" + message: '#^Dead catch \- Cake\\Core\\Exception\\CakeException is never thrown in the try block\.$#' + identifier: catch.neverThrown count: 1 path: src/ToolbarService.php - - message: "#^Unreachable statement \\- code above always terminates\\.$#" + message: '#^Unreachable statement \- code above always terminates\.$#' + identifier: deadCode.unreachable count: 1 path: src/ToolbarService.php diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 666ad535..00ef8c53 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,18 +1,8 @@ - - - - $key - - - - - findPart($email, $partType)]]> - - + - jsonSerialize + @@ -21,119 +11,63 @@ _pluginPaths]]> - - - !$message - - - bindings + - - $file - $file - $file - $line - $line - - self::$_timers + - - !$message - !$name - !$name - - $pos + - - - viewBuilder()->getTemplate()]]> - - - $result + - array + emailLog]]> - - - getMessage(), 'unable to open')]]> - - - - - $pluginName - $vendorName - - - - - $pluginName - $vendorName - - - - - $pluginName - $vendorName - - - - - - - - string|null + - new $class($this, $config) + - PluginConfig::getAppConfig() + - PluginConfig::getAppConfig() + - genericInstances + - - - - $enabled - - - new HtmlFormatter() - new HtmlFormatter() + + - dump - dump - new HtmlFormatter() - new HtmlFormatter() + + + + diff --git a/psalm.xml b/psalm.xml index 60b81594..5b2571a6 100644 --- a/psalm.xml +++ b/psalm.xml @@ -30,5 +30,6 @@ + diff --git a/src/Controller/MailPreviewController.php b/src/Controller/MailPreviewController.php index 5ef5b5d6..529bd074 100644 --- a/src/Controller/MailPreviewController.php +++ b/src/Controller/MailPreviewController.php @@ -273,11 +273,11 @@ protected function findPreview(string $previewName, string $emailName, string $p $plugin = "$plugin."; } - /** @var \DebugKit\Mailer\MailPreview $realClass */ $realClass = App::className($plugin . $previewName, 'Mailer/Preview'); if (!$realClass) { throw new NotFoundException("Mailer preview $previewName not found"); } + /** @var \DebugKit\Mailer\MailPreview $mailPreview */ $mailPreview = new $realClass(); $email = $mailPreview->find($emailName); diff --git a/src/DebugPanel.php b/src/DebugPanel.php index 442e182f..18280d9f 100644 --- a/src/DebugPanel.php +++ b/src/DebugPanel.php @@ -105,7 +105,7 @@ public function initialize(): void /** * Shutdown callback * - * @param \Cake\Event\EventInterface $event The event. + * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event The event. * @return void */ public function shutdown(EventInterface $event): void diff --git a/src/Panel/RoutesPanel.php b/src/Panel/RoutesPanel.php index 80f284a6..ef9ee979 100644 --- a/src/Panel/RoutesPanel.php +++ b/src/Panel/RoutesPanel.php @@ -40,16 +40,14 @@ public function summary(): string /** * Data collection callback. * - * @param \Cake\Event\EventInterface $event The shutdown event. + * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event The shutdown event. * @return void */ public function shutdown(EventInterface $event): void { - /** @var \Cake\Controller\Controller|null $controller */ $controller = $event->getSubject(); - $request = $controller ? $controller->getRequest() : null; $this->_data = [ - 'matchedRoute' => $request ? $request->getParam('_matchedRoute') : null, + 'matchedRoute' => $controller->getRequest()->getParam('_matchedRoute'), ]; } } diff --git a/src/Panel/SqlLogPanel.php b/src/Panel/SqlLogPanel.php index 4eab8a39..dc766849 100644 --- a/src/Panel/SqlLogPanel.php +++ b/src/Panel/SqlLogPanel.php @@ -16,7 +16,6 @@ use Cake\Core\Configure; use Cake\Database\Driver; -use Cake\Datasource\ConnectionInterface; use Cake\Datasource\ConnectionManager; use Cake\ORM\Locator\LocatorAwareTrait; use Cake\ORM\Table; @@ -52,10 +51,7 @@ public function initialize(): void foreach ($configs as $name) { $connection = ConnectionManager::get($name); - if ( - $connection->configName() === 'debug_kit' - || !$connection instanceof ConnectionInterface - ) { + if ($connection->configName() === 'debug_kit') { continue; } $driver = $connection->getDriver();