Skip to content

Commit 09e474d

Browse files
committed
Make $output works with Psalm <6.7
1 parent 215caff commit 09e474d

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

psalm-baseline.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="6.6.1@dae5a05eac03b55e8f50ae00f4cd2ba5d5588d59">
2+
<files psalm-version="6.8.8@1361cd33008feb3ae2b4a93f1860e14e538ec8c2">
33
<file src="src/Handlers/Auth/AuthConfigAnalyzer.php">
44
<MixedArgument>
55
<code><![CDATA[$this->config->get('auth.guards')]]></code>
@@ -36,11 +36,17 @@
3636
</InternalMethod>
3737
</file>
3838
<file src="src/Plugin.php">
39+
<RedundantCondition>
40+
<code><![CDATA[$registration->codebase]]></code>
41+
</RedundantCondition>
3942
<RiskyTruthyFalsyComparison>
4043
<code><![CDATA[glob(dirname(__DIR__) . '/stubs/' . $majorVersion . '/**/*.stubphp')]]></code>
4144
<code><![CDATA[glob(dirname(__DIR__) . '/stubs/' . $majorVersion . '/*.stubphp')]]></code>
4245
<code><![CDATA[glob(dirname(__DIR__) . '/stubs/common/TaintAnalysis/Http/*.stubphp')]]></code>
4346
</RiskyTruthyFalsyComparison>
47+
<TypeDoesNotContainType>
48+
<code><![CDATA[null]]></code>
49+
</TypeDoesNotContainType>
4450
</file>
4551
<file src="src/Providers/ApplicationProvider.php">
4652
<InternalMethod>

src/Plugin.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use Psalm\Plugin\PluginEntryPointInterface;
2626
use Psalm\Plugin\RegistrationInterface;
2727
use Psalm\PluginRegistrationSocket;
28-
use Psalm\Progress\VoidProgress;
28+
use Psalm\Progress\DefaultProgress;
2929
use SimpleXMLElement;
3030
use Symfony\Component\Finder\Finder;
3131

@@ -48,10 +48,14 @@ final class Plugin implements PluginEntryPointInterface
4848
public function __invoke(RegistrationInterface $registration, ?SimpleXMLElement $config = null): void
4949
{
5050
$failOnInternalError = ((string) $config?->failOnInternalError) === 'true';
51-
$output = new VoidProgress();
51+
$output = new DefaultProgress();
5252

5353
if ($registration instanceof PluginRegistrationSocket) {
54-
$output = $registration->codebase->progress;
54+
// $registration->codebase is available/public from Psalm v6.7
55+
// see https://github.com/vimeo/psalm/pull/11297 and https://github.com/vimeo/psalm/releases/tag/6.7.0
56+
if (($registration->codebase ?? null) instanceof \Psalm\Codebase) {
57+
$output = $registration->codebase->progress;
58+
}
5559
}
5660

5761
try {

0 commit comments

Comments
 (0)