Skip to content

Commit f768205

Browse files
committed
update stan
1 parent 3ebefa4 commit f768205

File tree

8 files changed

+42
-102
lines changed

8 files changed

+42
-102
lines changed

.phive/phars.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="phpstan" version="1.11.9" installed="1.11.9" location="./tools/phpstan" copy="false"/>
4-
<phar name="psalm" version="5.25.0" installed="5.25.0" location="./tools/psalm" copy="false"/>
3+
<phar name="phpstan" version="2.0.1" installed="2.0.1" location="./tools/phpstan" copy="false"/>
4+
<phar name="psalm" version="5.26.1" installed="5.26.1" location="./tools/psalm" copy="false"/>
55
</phive>

phpstan-baseline.neon

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,37 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Method DebugKit\\\\Mailer\\\\Transport\\\\DebugKitTransport\\:\\:send\\(\\) should return array\\{headers\\: string, message\\: string\\} but returns array\\{headers\\: non\\-empty\\-array\\<string, string\\>, message\\: array\\{text\\: string, html\\: string\\}\\}\\.$#"
4+
message: '#^Method DebugKit\\Mailer\\Transport\\DebugKitTransport\:\:send\(\) should return array\{headers\: string, message\: string\} but returns array\{headers\: non\-empty\-array\<string, string\>, message\: array\{text\: string, html\: string\}\}\.$#'
5+
identifier: return.type
56
count: 1
67
path: src/Mailer/Transport/DebugKitTransport.php
78

89
-
9-
message: "#^Parameter \\#1 \\$request of method DebugKit\\\\ToolbarService\\:\\:saveData\\(\\) expects Cake\\\\Http\\\\ServerRequest, Psr\\\\Http\\\\Message\\\\ServerRequestInterface given\\.$#"
10+
message: '#^Parameter \#1 \$request of method DebugKit\\ToolbarService\:\:saveData\(\) expects Cake\\Http\\ServerRequest, Psr\\Http\\Message\\ServerRequestInterface given\.$#'
11+
identifier: argument.type
1012
count: 1
1113
path: src/Middleware/DebugKitMiddleware.php
1214

1315
-
14-
message: "#^Call to an undefined method Cake\\\\ORM\\\\Locator\\\\LocatorInterface\\:\\:genericInstances\\(\\)\\.$#"
16+
message: '#^PHPDoc tag @property for property DebugKit\\Model\\Table\\PanelsTable\:\:\$Requests contains unresolvable type\.$#'
17+
identifier: propertyTag.unresolvableType
18+
count: 1
19+
path: src/Model/Table/PanelsTable.php
20+
21+
-
22+
message: '#^Call to an undefined method Cake\\ORM\\Locator\\LocatorInterface\:\:genericInstances\(\)\.$#'
23+
identifier: method.notFound
1524
count: 1
1625
path: src/Panel/SqlLogPanel.php
1726

1827
-
19-
message: "#^Dead catch \\- Cake\\\\Core\\\\Exception\\\\CakeException is never thrown in the try block\\.$#"
28+
message: '#^Dead catch \- Cake\\Core\\Exception\\CakeException is never thrown in the try block\.$#'
29+
identifier: catch.neverThrown
2030
count: 1
2131
path: src/ToolbarService.php
2232

2333
-
24-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
34+
message: '#^Unreachable statement \- code above always terminates\.$#'
35+
identifier: deadCode.unreachable
2536
count: 1
2637
path: src/ToolbarService.php

psalm-baseline.xml

Lines changed: 18 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.20.0@3f284e96c9d9be6fe6b15c79416e1d1903dcfef4">
3-
<file src="src/Cache/Engine/DebugEngine.php">
4-
<RiskyTruthyFalsyComparison>
5-
<code>$key</code>
6-
</RiskyTruthyFalsyComparison>
7-
</file>
8-
<file src="src/Controller/MailPreviewController.php">
9-
<RiskyTruthyFalsyComparison>
10-
<code><![CDATA[$this->findPart($email, $partType)]]></code>
11-
</RiskyTruthyFalsyComparison>
12-
</file>
2+
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
133
<file src="src/Database/Log/DebugLog.php">
144
<InternalMethod>
15-
<code>jsonSerialize</code>
5+
<code><![CDATA[jsonSerialize]]></code>
166
</InternalMethod>
177
</file>
188
<file src="src/DebugInclude.php">
@@ -21,119 +11,63 @@
2111
<code><![CDATA[$this->_pluginPaths]]></code>
2212
</PossiblyNullArrayOffset>
2313
</file>
24-
<file src="src/DebugMemory.php">
25-
<RiskyTruthyFalsyComparison>
26-
<code>!$message</code>
27-
</RiskyTruthyFalsyComparison>
28-
</file>
2914
<file src="src/DebugSql.php">
3015
<InternalMethod>
31-
<code>bindings</code>
16+
<code><![CDATA[bindings]]></code>
3217
</InternalMethod>
33-
<RiskyTruthyFalsyComparison>
34-
<code>$file</code>
35-
<code>$file</code>
36-
<code>$file</code>
37-
<code>$line</code>
38-
<code>$line</code>
39-
</RiskyTruthyFalsyComparison>
4018
</file>
4119
<file src="src/DebugTimer.php">
4220
<PossiblyNullArrayOffset>
43-
<code>self::$_timers</code>
21+
<code><![CDATA[self::$_timers]]></code>
4422
</PossiblyNullArrayOffset>
45-
<RiskyTruthyFalsyComparison>
46-
<code>!$message</code>
47-
<code>!$name</code>
48-
<code>!$name</code>
49-
</RiskyTruthyFalsyComparison>
5023
</file>
5124
<file src="src/Mailer/MailPreview.php">
5225
<PossiblyFalseOperand>
53-
<code>$pos</code>
26+
<code><![CDATA[$pos]]></code>
5427
</PossiblyFalseOperand>
5528
</file>
56-
<file src="src/Mailer/PreviewResult.php">
57-
<RiskyTruthyFalsyComparison>
58-
<code><![CDATA[!$mailer->viewBuilder()->getTemplate()]]></code>
59-
</RiskyTruthyFalsyComparison>
60-
</file>
6129
<file src="src/Mailer/Transport/DebugKitTransport.php">
6230
<InvalidReturnStatement>
63-
<code>$result</code>
31+
<code><![CDATA[$result]]></code>
6432
</InvalidReturnStatement>
6533
<MoreSpecificReturnType>
66-
<code>array</code>
34+
<code><![CDATA[array]]></code>
6735
</MoreSpecificReturnType>
6836
<NullArgument>
6937
<code><![CDATA[$this->emailLog]]></code>
7038
</NullArgument>
7139
</file>
72-
<file src="src/Model/Table/LazyTableTrait.php">
73-
<RiskyTruthyFalsyComparison>
74-
<code><![CDATA[strpos($e->getMessage(), 'unable to open')]]></code>
75-
</RiskyTruthyFalsyComparison>
76-
</file>
77-
<file src="src/Panel/DeprecationsPanel.php">
78-
<RiskyTruthyFalsyComparison>
79-
<code>$pluginName</code>
80-
<code>$vendorName</code>
81-
</RiskyTruthyFalsyComparison>
82-
</file>
83-
<file src="src/Panel/EnvironmentPanel.php">
84-
<RiskyTruthyFalsyComparison>
85-
<code>$pluginName</code>
86-
<code>$vendorName</code>
87-
</RiskyTruthyFalsyComparison>
88-
</file>
89-
<file src="src/Panel/IncludePanel.php">
90-
<RiskyTruthyFalsyComparison>
91-
<code>$pluginName</code>
92-
<code>$vendorName</code>
93-
</RiskyTruthyFalsyComparison>
94-
</file>
95-
<file src="src/Panel/LogPanel.php">
96-
<RiskyTruthyFalsyComparison>
97-
<code><![CDATA[Log::getConfig('debug_kit_log_panel')]]></code>
98-
</RiskyTruthyFalsyComparison>
99-
</file>
10040
<file src="src/Panel/PanelRegistry.php">
10141
<LessSpecificImplementedReturnType>
102-
<code>string|null</code>
42+
<code><![CDATA[string|null]]></code>
10343
</LessSpecificImplementedReturnType>
10444
<UnsafeInstantiation>
105-
<code>new $class($this, $config)</code>
45+
<code><![CDATA[new $class($this, $config)]]></code>
10646
</UnsafeInstantiation>
10747
</file>
10848
<file src="src/Panel/PluginsPanel.php">
10949
<InternalClass>
110-
<code>PluginConfig::getAppConfig()</code>
50+
<code><![CDATA[PluginConfig::getAppConfig()]]></code>
11151
</InternalClass>
11252
<InternalMethod>
113-
<code>PluginConfig::getAppConfig()</code>
53+
<code><![CDATA[PluginConfig::getAppConfig()]]></code>
11454
</InternalMethod>
11555
</file>
11656
<file src="src/Panel/SqlLogPanel.php">
11757
<UndefinedInterfaceMethod>
118-
<code>genericInstances</code>
58+
<code><![CDATA[genericInstances]]></code>
11959
</UndefinedInterfaceMethod>
12060
</file>
121-
<file src="src/ToolbarService.php">
122-
<RiskyTruthyFalsyComparison>
123-
<code><![CDATA[!$GLOBALS['FORCE_DEBUGKIT_TOOLBAR']]]></code>
124-
<code>$enabled</code>
125-
</RiskyTruthyFalsyComparison>
126-
</file>
12761
<file src="src/View/Helper/ToolbarHelper.php">
12862
<InternalClass>
129-
<code>new HtmlFormatter()</code>
130-
<code>new HtmlFormatter()</code>
63+
<code><![CDATA[new HtmlFormatter()]]></code>
64+
<code><![CDATA[new HtmlFormatter()]]></code>
13165
</InternalClass>
13266
<InternalMethod>
133-
<code>dump</code>
134-
<code>dump</code>
135-
<code>new HtmlFormatter()</code>
136-
<code>new HtmlFormatter()</code>
67+
<code><![CDATA[dump]]></code>
68+
<code><![CDATA[dump]]></code>
69+
<code><![CDATA[new HtmlFormatter()]]></code>
70+
<code><![CDATA[new HtmlFormatter()]]></code>
13771
</InternalMethod>
13872
</file>
13973
</files>

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030

3131
<DocblockTypeContradiction errorLevel="info" />
3232
<RedundantConditionGivenDocblockType errorLevel="info" />
33+
<RiskyTruthyFalsyComparison errorLevel="info" />
3334
</issueHandlers>
3435
</psalm>

src/Controller/MailPreviewController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,11 @@ protected function findPreview(string $previewName, string $emailName, string $p
273273
$plugin = "$plugin.";
274274
}
275275

276-
/** @var \DebugKit\Mailer\MailPreview $realClass */
277276
$realClass = App::className($plugin . $previewName, 'Mailer/Preview');
278277
if (!$realClass) {
279278
throw new NotFoundException("Mailer preview $previewName not found");
280279
}
280+
/** @var \DebugKit\Mailer\MailPreview $mailPreview */
281281
$mailPreview = new $realClass();
282282

283283
$email = $mailPreview->find($emailName);

src/DebugPanel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function initialize(): void
105105
/**
106106
* Shutdown callback
107107
*
108-
* @param \Cake\Event\EventInterface $event The event.
108+
* @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event The event.
109109
* @return void
110110
*/
111111
public function shutdown(EventInterface $event): void

src/Panel/RoutesPanel.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@ public function summary(): string
4040
/**
4141
* Data collection callback.
4242
*
43-
* @param \Cake\Event\EventInterface $event The shutdown event.
43+
* @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event The shutdown event.
4444
* @return void
4545
*/
4646
public function shutdown(EventInterface $event): void
4747
{
48-
/** @var \Cake\Controller\Controller|null $controller */
4948
$controller = $event->getSubject();
50-
$request = $controller ? $controller->getRequest() : null;
5149
$this->_data = [
52-
'matchedRoute' => $request ? $request->getParam('_matchedRoute') : null,
50+
'matchedRoute' => $controller->getRequest()->getParam('_matchedRoute'),
5351
];
5452
}
5553
}

src/Panel/SqlLogPanel.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
use Cake\Core\Configure;
1818
use Cake\Database\Driver;
19-
use Cake\Datasource\ConnectionInterface;
2019
use Cake\Datasource\ConnectionManager;
2120
use Cake\ORM\Locator\LocatorAwareTrait;
2221
use Cake\ORM\Table;
@@ -52,10 +51,7 @@ public function initialize(): void
5251

5352
foreach ($configs as $name) {
5453
$connection = ConnectionManager::get($name);
55-
if (
56-
$connection->configName() === 'debug_kit'
57-
|| !$connection instanceof ConnectionInterface
58-
) {
54+
if ($connection->configName() === 'debug_kit') {
5955
continue;
6056
}
6157
$driver = $connection->getDriver();

0 commit comments

Comments
 (0)