diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 4758ec739..12f91ef14 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -36,6 +36,11 @@ plugin + + + setResourceMap + + Cycle @@ -64,6 +69,9 @@ data[$this->name]]]> pointers[$this->name]]]> + + getName + @@ -183,6 +191,9 @@ options['rating']]]> options['secure']]]> + + ]]> + (bool) $flag (int) $imgSize @@ -235,6 +246,16 @@ $index view]]> + + createDataAlternate + createDataNext + createDataPrev + createDataStylesheet + + + AbstractContainer + AbstractContainer + (string) $conditionalStylesheet @@ -299,6 +320,10 @@ plugin plugin + + AbstractContainer + AbstractContainer + plugin plugin @@ -337,6 +362,10 @@ parent::__call($method, $args) parent::__call($method, $args) + + AbstractContainer + AbstractContainer + (bool) $flag @@ -371,10 +400,22 @@ $content $index + + AbstractContainer + AbstractContainer + is_string($content) + + $indent + + + + + HelperInterface + @@ -464,6 +505,12 @@ (bool) $useNamespaces + + + getAuthenticationService + setAuthenticationService + + $response @@ -479,6 +526,9 @@ plugin + + __construct + (string) $template @@ -674,6 +724,13 @@ plugin + + + HelperInterface + HelperInterface + HelperInterface + + $relFlag @@ -721,6 +778,16 @@ null + + searchRelChapter + searchRelNext + searchRelPrev + searchRelSection + searchRelStart + searchRelSubsection + searchRevSection + searchRevSubsection + (int) $renderFlag @@ -750,6 +817,9 @@ + + bool + @@ -844,6 +914,10 @@ plugin plugin + + escapeLabels + setAddClassToListItem + (bool) $flag (bool) $flag @@ -1027,6 +1101,9 @@ parent::__invoke($name, $item) + + self + (string) $key @@ -1110,6 +1187,10 @@ $return + + __get + __set + (bool) $autoEscape (string) $string @@ -1138,6 +1219,10 @@ AbstractContainer + + getRegistry + unsetRegistry + (string) $key (string) $key @@ -1309,6 +1394,11 @@ $reuseMatchedParams + + + hasRoot + + null|ConfigInterface|ContainerInterface @@ -1332,6 +1422,12 @@ parent::get($name, $options) + + injectEventManager + injectRenderer + injectTranslator + validatePlugin + initializers]]> initializers]]> @@ -1370,6 +1466,11 @@ $captureTo + + getErrorLevel + getResult + setResult + @@ -1398,6 +1499,18 @@ $captureTo + + + ModelInterface + ModelInterface + ModelInterface + ModelInterface + ModelInterface + ModelInterface + ModelInterface + ModelInterface + + gettype($variables) @@ -1445,6 +1558,13 @@ $values + + __construct + setFilterChain + + + $config + @@ -1462,6 +1582,9 @@ $values + + $resolver + is_string($nameOrModel) @@ -1488,6 +1611,9 @@ $children $values + + $resolver + (bool) $mergeUnnamedChildren (string) $callback @@ -1559,6 +1685,9 @@ __vars]]> resolve + + $config + (bool) $renderTrees @@ -1633,6 +1762,9 @@ + + TemplatePathStack + (bool) $flag (bool) $flag @@ -1686,6 +1818,9 @@ plugin + + $e + plugin @@ -1712,6 +1847,20 @@ $offset $offset + + stream_eof + stream_open + stream_read + stream_seek + stream_stat + stream_tell + url_stat + + + $mode + $opened_path + $options + break; break; @@ -2024,6 +2173,11 @@ HtmlFlash + + + $key + + $escape($value) @@ -2530,11 +2684,6 @@ vars()->message]]> - - - data]]> - - 1337 diff --git a/psalm.xml.dist b/psalm.xml.dist index 432aaaa1f..f21b0a73b 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -7,6 +7,7 @@ errorBaseline="psalm-baseline.xml" findUnusedBaselineEntry="true" findUnusedPsalmSuppress="true" + findUnusedCode="true" > @@ -42,6 +43,18 @@ + + + + + + + + + + + + diff --git a/test/Helper/DoctypeTest.php b/test/Helper/DoctypeTest.php index cc283f406..3c40c109b 100644 --- a/test/Helper/DoctypeTest.php +++ b/test/Helper/DoctypeTest.php @@ -13,9 +13,6 @@ class DoctypeTest extends TestCase /** @var Doctype */ public $helper; - /** @var string */ - public $basePath; - /** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. diff --git a/test/Helper/InlineScriptTest.php b/test/Helper/InlineScriptTest.php index 552d782ae..da59f769a 100644 --- a/test/Helper/InlineScriptTest.php +++ b/test/Helper/InlineScriptTest.php @@ -12,17 +12,9 @@ class InlineScriptTest extends TestCase /** @var Helper\InlineScript */ public $helper; - /** @var string */ - public $basePath; - - /** - * Sets up the fixture, for example, open a network connection. - * This method is called before a test is executed. - */ protected function setUp(): void { - $this->basePath = __DIR__ . '/_files/modules'; - $this->helper = new Helper\InlineScript(); + $this->helper = new Helper\InlineScript(); } public function testInlineScriptReturnsObjectInstance(): void diff --git a/test/Helper/Navigation/LinksTest.php b/test/Helper/Navigation/LinksTest.php index 72438e7a6..dad70dd94 100644 --- a/test/Helper/Navigation/LinksTest.php +++ b/test/Helper/Navigation/LinksTest.php @@ -36,7 +36,6 @@ class LinksTest extends AbstractTestCase */ protected $_helper; // phpcs:ignore private Doctype $doctypeHelper; - private string $oldDoctype; protected function setUp(): void { @@ -48,7 +47,6 @@ protected function setUp(): void assert($renderer instanceof PhpRenderer); $helper = $renderer->plugin(Doctype::class); $this->doctypeHelper = $helper; - $this->oldDoctype = $helper->getDoctype(); $this->doctypeHelper->setDoctype( Doctype::HTML4_LOOSE ); diff --git a/test/Helper/PaginationControlTest.php b/test/Helper/PaginationControlTest.php index 29a87ff90..4a0f83e0f 100644 --- a/test/Helper/PaginationControlTest.php +++ b/test/Helper/PaginationControlTest.php @@ -19,7 +19,7 @@ class PaginationControlTest extends TestCase { private PaginationControl $viewHelper; - private \Laminas\Paginator\Paginator $paginator; + private Paginator\Paginator $paginator; private View $view; /** @@ -110,7 +110,7 @@ public function testAcceptsViewPartialInOtherModule(): void { $this->expectException(Exception\RuntimeException::class); $this->expectExceptionMessage( - 'Unable to render template "partial.phtml"; resolver could not resolve to a file' + 'Unable to render template "partial.phtml"; resolver could not resolve to a file', ); $this->viewHelper->__invoke($this->paginator, null, ['partial.phtml', 'test']); } @@ -133,4 +133,15 @@ public function testCanUseObjectForScrollingStyle(): void $this->assertStringContainsString('page count (11) equals pages in range (11)', $output, $output); } + + public function testSetAndGetDefaultScrollingStyle(): void + { + $default = PaginationControl::getDefaultScrollingStyle(); + + PaginationControl::setDefaultScrollingStyle('muppets'); + + self::assertSame('muppets', PaginationControl::getDefaultScrollingStyle()); + + PaginationControl::setDefaultScrollingStyle($default); + } } diff --git a/test/Helper/Placeholder/RegistryTest.php b/test/Helper/Placeholder/RegistryTest.php index 225372d15..a79091bc0 100644 --- a/test/Helper/Placeholder/RegistryTest.php +++ b/test/Helper/Placeholder/RegistryTest.php @@ -122,6 +122,7 @@ public function testSetValueCreateContainer(): void 'Laminas-10793', ]; $container = $this->registry->createContainer('foo', $data); + self::assertInstanceOf(TestAsset\MockContainer::class, $container); $this->assertEquals(['Laminas-10793'], $container->data); } } diff --git a/test/VariablesTest.php b/test/VariablesTest.php index 795ac95ca..3808e0712 100644 --- a/test/VariablesTest.php +++ b/test/VariablesTest.php @@ -109,17 +109,6 @@ public function testRetrievingUndefinedVariableRaisesErrorWhenStrictVarsIsReques $this->assertStringContainsString('does not exist', $this->error); } - /** - * @psalm-return array - */ - public function values(): array - { - return [ - ['foo', 'bar'], - ['xss', '\'value\''], - ]; - } - public function testCallingClearEmptiesObject(): void { $this->vars->assign([