Skip to content

Commit 40586a0

Browse files
authored
Merge pull request #1063 from cakephp/5.x-add-psalm
re-add psalm v7
2 parents 3c309fd + 95f9618 commit 40586a0

File tree

7 files changed

+28
-79
lines changed

7 files changed

+28
-79
lines changed

.phive/phars.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
33
<phar name="phpstan" version="2.1.31" installed="2.1.31" location="./tools/phpstan" copy="false"/>
4+
<phar name="psalm" version="7.0.0-beta16" installed="7.0.0-beta16" location="./tools/psalm" copy="false"/>
45
</phive>

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@
6363
"cs-check": "phpcs",
6464
"cs-fix": "phpcbf",
6565
"phpstan": "tools/phpstan analyse",
66-
"stan": "@phpstan",
66+
"stan": [
67+
"tools/phpstan analyse",
68+
"tools/psalm"
69+
],
6770
"stan-baseline": "tools/phpstan --generate-baseline",
71+
"psalm-baseline": "tools/psalm --set-baseline=psalm-baseline.xml",
6872
"stan-setup": "phive install",
6973
"test": "phpunit"
7074
},

psalm-baseline.xml

Lines changed: 10 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
3-
<file src="src/Database/Log/DebugLog.php">
4-
<InternalMethod>
5-
<code><![CDATA[getContext]]></code>
6-
<code><![CDATA[jsonSerialize]]></code>
7-
</InternalMethod>
8-
</file>
9-
<file src="src/DebugInclude.php">
10-
<PossiblyNullArrayOffset>
11-
<code><![CDATA[$this->_composerPaths]]></code>
12-
<code><![CDATA[$this->_pluginPaths]]></code>
13-
</PossiblyNullArrayOffset>
14-
</file>
15-
<file src="src/DebugSql.php">
16-
<InternalMethod>
17-
<code><![CDATA[bindings]]></code>
18-
</InternalMethod>
19-
</file>
20-
<file src="src/DebugTimer.php">
21-
<PossiblyNullArrayOffset>
22-
<code><![CDATA[self::$_timers]]></code>
23-
</PossiblyNullArrayOffset>
24-
</file>
25-
<file src="src/Mailer/MailPreview.php">
26-
<PossiblyFalseOperand>
27-
<code><![CDATA[$pos]]></code>
28-
</PossiblyFalseOperand>
2+
<files psalm-version="7.0.0-beta16@491dd740b8862db7d4fe8c1f6c161055c32ad651">
3+
<file src="src/Mailer/PreviewResult.php">
4+
<ImpureMethodCall>
5+
<code><![CDATA[$mailer->render()]]></code>
6+
<code><![CDATA[$mailer->reset()]]></code>
7+
<code><![CDATA[$mailer->viewBuilder()]]></code>
8+
<code><![CDATA[$mailer->viewBuilder()]]></code>
9+
<code><![CDATA[$mailer->viewBuilder()->setTemplate($method)]]></code>
10+
<code><![CDATA[$message->getHeaders($extra)]]></code>
11+
</ImpureMethodCall>
2912
</file>
3013
<file src="src/Mailer/Transport/DebugKitTransport.php">
3114
<InvalidReturnStatement>
3215
<code><![CDATA[$result]]></code>
3316
</InvalidReturnStatement>
34-
<MoreSpecificReturnType>
35-
<code><![CDATA[array]]></code>
36-
</MoreSpecificReturnType>
3717
<NullArgument>
3818
<code><![CDATA[$this->emailLog]]></code>
3919
</NullArgument>
4020
</file>
41-
<file src="src/Panel/PanelRegistry.php">
42-
<LessSpecificImplementedReturnType>
43-
<code><![CDATA[string|null]]></code>
44-
</LessSpecificImplementedReturnType>
45-
<UnsafeInstantiation>
46-
<code><![CDATA[new $class($this, $config)]]></code>
47-
</UnsafeInstantiation>
48-
</file>
49-
<file src="src/Panel/PluginsPanel.php">
50-
<InternalClass>
51-
<code><![CDATA[PluginConfig::getAppConfig()]]></code>
52-
</InternalClass>
53-
<InternalMethod>
54-
<code><![CDATA[PluginConfig::getAppConfig()]]></code>
55-
</InternalMethod>
56-
</file>
57-
<file src="src/Panel/SqlLogPanel.php">
58-
<UndefinedInterfaceMethod>
59-
<code><![CDATA[genericInstances]]></code>
60-
</UndefinedInterfaceMethod>
61-
</file>
62-
<file src="src/View/Helper/ToolbarHelper.php">
63-
<InternalClass>
64-
<code><![CDATA[new HtmlFormatter()]]></code>
65-
<code><![CDATA[new HtmlFormatter()]]></code>
66-
</InternalClass>
67-
<InternalMethod>
68-
<code><![CDATA[dump]]></code>
69-
<code><![CDATA[dump]]></code>
70-
<code><![CDATA[new HtmlFormatter()]]></code>
71-
<code><![CDATA[new HtmlFormatter()]]></code>
72-
</InternalMethod>
73-
</file>
7421
</files>

psalm.xml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<?xml version="1.0"?>
22
<psalm
3-
reportMixedIssues="false"
3+
errorLevel="6"
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xmlns="https://getpsalm.org/schema/config"
66
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
77
autoloader="tests/bootstrap.php"
8-
usePhpDocMethodsWithoutMagicCall="true"
9-
errorBaseline="psalm-baseline.xml"
108
findUnusedPsalmSuppress="true"
119
findUnusedBaselineEntry="true"
1210
findUnusedCode="false"
11+
errorBaseline="psalm-baseline.xml"
1312
>
1413
<projectFiles>
1514
<directory name="src" />
@@ -19,17 +18,9 @@
1918
</projectFiles>
2019

2120
<issueHandlers>
22-
<LessSpecificReturnType errorLevel="info" />
23-
24-
<MissingClosureReturnType errorLevel="info" />
25-
26-
<PropertyNotSetInConstructor errorLevel="info" />
27-
<MissingConstructor errorLevel="info" />
28-
<MissingClosureParamType errorLevel="info" />
29-
<MissingParamType errorLevel="info" />
30-
31-
<DocblockTypeContradiction errorLevel="info" />
32-
<RedundantConditionGivenDocblockType errorLevel="info" />
33-
<RiskyTruthyFalsyComparison errorLevel="info" />
21+
<MissingPureAnnotation errorLevel="suppress" />
22+
<MissingTemplateParam errorLevel="suppress" />
23+
<MissingOverrideAttribute errorLevel="suppress"/>
24+
<MissingPureAnnotation errorLevel="suppress"/>
3425
</issueHandlers>
3526
</psalm>

src/Mailer/AbstractResult.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
/**
1818
* A simple structure for representing the results of a sent email
19+
*
20+
* @psalm-external-mutation-free
1921
*/
2022
abstract class AbstractResult
2123
{

src/Mailer/PreviewResult.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* Represents the result of a preview for a given mailer
21+
*
22+
* @psalm-external-mutation-free
2123
*/
2224
class PreviewResult extends AbstractResult
2325
{

src/Mailer/SentMailResult.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
/**
1818
* Represents the result of an already sent email
19+
*
20+
* @psalm-external-mutation-free
1921
*/
2022
class SentMailResult extends AbstractResult
2123
{

0 commit comments

Comments
 (0)