Skip to content

Commit

Permalink
Enable unused baseline entry detection and unused suppression detection
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Jan 25, 2024
1 parent 9cb3e32 commit 9c77aef
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 22 deletions.
18 changes: 4 additions & 14 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.18.0@b113f3ed0259fd6e212d87c3df80eec95a6abf19">
<files psalm-version="5.20.0@3f284e96c9d9be6fe6b15c79416e1d1903dcfef4">
<file src="src/Helper/AbstractHtmlElement.php">
<MissingConstructor>
<code>$closingBracket</code>
Expand Down Expand Up @@ -206,7 +206,6 @@
<code>$attributes[$itemKey]</code>
<code>$href</code>
<code>$index</code>
<code>$item</code>
<code><![CDATA[$this->autoEscape ? $this->escapeAttribute($attributes[$itemKey]) : $attributes[$itemKey]]]></code>
<code><![CDATA[$this->autoEscape ? $this->escapeAttribute($value) : $value]]></code>
<code>$value</code>
Expand Down Expand Up @@ -404,6 +403,9 @@
<MixedAssignment>
<code>$options</code>
</MixedAssignment>
<RiskyTruthyFalsyComparison>
<code>$content</code>
</RiskyTruthyFalsyComparison>
</file>
<file src="src/Helper/HtmlPage.php">
<MixedAssignment>
Expand Down Expand Up @@ -1319,7 +1321,6 @@
<code><![CDATA[$container->get('EventManager')]]></code>
<code><![CDATA[$container->get('MvcTranslator')]]></code>
<code><![CDATA[$container->get('Translator')]]></code>
<code><![CDATA[$container->get(TranslatorInterface::class)]]></code>
</MixedArgument>
<MixedAssignment>
<code>$container</code>
Expand All @@ -1328,16 +1329,6 @@
<MixedInferredReturnType>
<code>($name is class-string ? T : HelperInterface|callable)</code>
</MixedInferredReturnType>
<MixedMethodCall>
<code>get</code>
<code>get</code>
<code>get</code>
<code>get</code>
<code>has</code>
<code>has</code>
<code>has</code>
<code>has</code>
</MixedMethodCall>
<MixedReturnStatement>
<code>parent::get($name, $options)</code>
</MixedReturnStatement>
Expand Down Expand Up @@ -1556,7 +1547,6 @@
<code>$variables</code>
</PossibleRawObjectIteration>
<PossiblyInvalidArgument>
<code><![CDATA[$this->__file]]></code>
<code>$values</code>
</PossiblyInvalidArgument>
<PossiblyInvalidPropertyAssignmentValue>
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
findUnusedBaselineEntry="true"
findUnusedPsalmSuppress="true"
>
<projectFiles>
<directory name="bin"/>
Expand Down
3 changes: 1 addition & 2 deletions src/Helper/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function __invoke($name = null, $params = [], $options = [], $reuseMatche
* @param RouteStackInterface $router
* @return Url
* @throws Exception\InvalidArgumentException For invalid router types.
* @psalm-suppress RedundantConditionGivenDocblockType, DocblockTypeContradiction
* @psalm-suppress DocblockTypeContradiction
*/
public function setRouter($router)
{
Expand All @@ -133,7 +133,6 @@ public function setRouter($router)
*
* @param RouteMatch $routeMatch
* @return Url
* @psalm-suppress RedundantConditionGivenDocblockType, DocblockTypeContradiction
*/
public function setRouteMatch($routeMatch)
{
Expand Down
6 changes: 0 additions & 6 deletions test/Resolver/TemplatePathStackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public function testMayDisableLfiProtection(): void

public function testStreamWrapperDisabledByDefault(): void
{
/** @psalm-suppress DeprecatedMethod */
$this->assertFalse($this->stack->useStreamWrapper());
}

Expand All @@ -118,9 +117,7 @@ public function testMayEnableStreamWrapper(): void
if (! $flag) {
$this->markTestSkipped('Short tags are disabled; cannot test');
}
/** @psalm-suppress DeprecatedMethod */
$this->stack->setUseStreamWrapper(true);
/** @psalm-suppress DeprecatedMethod */
$this->assertTrue($this->stack->useStreamWrapper());
}

Expand Down Expand Up @@ -169,7 +166,6 @@ public function testReturnsPathWithStreamProtocolWhenStreamWrapperEnabled(): voi
if (! $flag) {
$this->markTestSkipped('Short tags are disabled; cannot test');
}
/** @psalm-suppress DeprecatedMethod */
$this->stack->setUseStreamWrapper(true)
->addPath($this->baseDir . '/_templates');
$expected = 'laminas.view://' . realpath($this->baseDir . '/_templates/test.phtml');
Expand Down Expand Up @@ -226,7 +222,6 @@ public function testAllowsSettingOptions($options): void
$this->assertFalse($this->stack->isLfiProtectionOn());

$expected = (bool) ini_get('short_open_tag');
/** @psalm-suppress DeprecatedMethod */
$this->assertSame($expected, $this->stack->useStreamWrapper());

$this->assertSame($options['default_suffix'] ?? null, $this->stack->getDefaultSuffix());
Expand All @@ -245,7 +240,6 @@ public function testAllowsPassingOptionsToConstructor($options): void
$this->assertFalse($stack->isLfiProtectionOn());

$expected = (bool) ini_get('short_open_tag');
/** @psalm-suppress DeprecatedMethod */
$this->assertSame($expected, $stack->useStreamWrapper());

$this->assertEquals(array_reverse($this->paths), $stack->getPaths()->toArray());
Expand Down

0 comments on commit 9c77aef

Please sign in to comment.