diff --git a/.phive/phars.xml b/.phive/phars.xml index 726b7777c..d311bfa5e 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,5 +1,5 @@ - - + + diff --git a/composer.json b/composer.json index b381bcf54..7622716bd 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ }, "require": { "php": ">=8.1", - "cakephp/cakephp": "dev-5.next as 5.1.0", + "cakephp/cakephp": "^5.1", "composer/composer": "^2.0", "doctrine/sql-formatter": "^1.1.3" }, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e111c1abb..01701274c 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 666ad5359..00ef8c537 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 60b81594c..5b2571a6f 100644 --- a/psalm.xml +++ b/psalm.xml @@ -30,5 +30,6 @@ + diff --git a/src/Controller/MailPreviewController.php b/src/Controller/MailPreviewController.php index 5ef5b5d6d..529bd074a 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 442e182f3..18280d9f0 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/EnvironmentPanel.php b/src/Panel/EnvironmentPanel.php index 7257203c6..e18b7b7ff 100644 --- a/src/Panel/EnvironmentPanel.php +++ b/src/Panel/EnvironmentPanel.php @@ -62,6 +62,7 @@ protected function _prepare(): array 'error_reporting' => ini_get('error_reporting'), 'upload_max_filesize' => ini_get('upload_max_filesize'), 'post_max_size' => ini_get('post_max_size'), + 'zend.assertions' => ini_get('zend.assertions'), ]; // CakePHP Data @@ -90,8 +91,13 @@ protected function _prepare(): array $var = get_defined_constants(true); $return['app'] = array_diff_key($var['user'], $return['cake'], $hiddenCakeConstants); + $includePaths = $this->_debug->includePaths(); + foreach ($includePaths as $k => $v) { + $includePaths[$k] = Debugger::exportVarAsNodes($v); + } + // Included files data - $return['includePaths'] = $this->_debug->includePaths(); + $return['includePaths'] = $includePaths; $return['includedFiles'] = $this->prepareIncludedFiles(); return $return; diff --git a/src/Panel/RoutesPanel.php b/src/Panel/RoutesPanel.php index 80f284a60..ef9ee979a 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 4eab8a393..dc7668499 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(); diff --git a/templates/element/environment_panel.php b/templates/element/environment_panel.php index e6582c0f2..c84912499 100644 --- a/templates/element/environment_panel.php +++ b/templates/element/environment_panel.php @@ -34,6 +34,13 @@

CakePHP Version:

+ +
+ You should set zend.assertions to 1 + in your php.ini for your development environment. +
+ +

Application Constants

diff --git a/webroot/css/style.css b/webroot/css/style.css index e74337bf9..d6d1e894e 100644 --- a/webroot/css/style.css +++ b/webroot/css/style.css @@ -281,13 +281,9 @@ strong { text-align: left; } -/* Override styles in cake's default css */ -.c-debug-table .cake-debug-string { - margin-right: 48px; -} -/* correct height to fit with environment panel */ .c-debug-table .cake-debug-copy { - padding: 5px 6px; + position: static; + margin-left: 10px; } .c-debug-table .duplicate-route td {