From cfff7100ed939f3a87caaa6463a5f4244d93ad00 Mon Sep 17 00:00:00 2001 From: Alexandre Lemaire Date: Wed, 17 Aug 2022 15:42:05 -0400 Subject: [PATCH 1/7] Removes a territorial assertion. --- src/Helper/Layout.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Helper/Layout.php b/src/Helper/Layout.php index 982913e5a..87121288a 100644 --- a/src/Helper/Layout.php +++ b/src/Helper/Layout.php @@ -102,9 +102,7 @@ protected function getViewModelHelper() /** * @psalm-suppress DeprecatedMethod */ - $renderer = $this->getView(); - assert($renderer instanceof PhpRenderer); - $helper = $renderer->plugin('view_model'); + $helper = $this->getView()->plugin('view_model'); assert($helper instanceof ViewModel); $this->viewModelHelper = $helper; } From 5a7f1b271363c17f38061b4413c1bac33491d8ef Mon Sep 17 00:00:00 2001 From: Alexandre Lemaire Date: Wed, 17 Aug 2022 15:48:41 -0400 Subject: [PATCH 2/7] Suppresses PossiblyNullReference and UndefinedInterfaceMethod --- src/Helper/Layout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Helper/Layout.php b/src/Helper/Layout.php index 87121288a..e47d24ab6 100644 --- a/src/Helper/Layout.php +++ b/src/Helper/Layout.php @@ -100,7 +100,7 @@ protected function getViewModelHelper() { if (! $this->viewModelHelper) { /** - * @psalm-suppress DeprecatedMethod + * @psalm-suppress PossiblyNullReference, UndefinedInterfaceMethod */ $helper = $this->getView()->plugin('view_model'); assert($helper instanceof ViewModel); From b501125fae36bcd7a4d9a7625c7062b33bb40129 Mon Sep 17 00:00:00 2001 From: Alexandre Lemaire Date: Wed, 17 Aug 2022 15:52:37 -0400 Subject: [PATCH 3/7] CS fix. --- src/Helper/Layout.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Helper/Layout.php b/src/Helper/Layout.php index e47d24ab6..9ff25ab4f 100644 --- a/src/Helper/Layout.php +++ b/src/Helper/Layout.php @@ -6,7 +6,6 @@ use Laminas\View\Exception; use Laminas\View\Model\ModelInterface as Model; -use Laminas\View\Renderer\PhpRenderer; use function assert; use function sprintf; From 57979639a23f4f3af3d4c066d049301eeb21c41e Mon Sep 17 00:00:00 2001 From: Alexandre Lemaire Date: Wed, 17 Aug 2022 16:00:39 -0400 Subject: [PATCH 4/7] Minimizes changes to baseline, minus assertion (introduces redundant variable) --- src/Helper/Layout.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Helper/Layout.php b/src/Helper/Layout.php index 9ff25ab4f..27018aaf9 100644 --- a/src/Helper/Layout.php +++ b/src/Helper/Layout.php @@ -99,9 +99,10 @@ protected function getViewModelHelper() { if (! $this->viewModelHelper) { /** - * @psalm-suppress PossiblyNullReference, UndefinedInterfaceMethod + * @psalm-suppress DeprecatedMethod */ - $helper = $this->getView()->plugin('view_model'); + $renderer = $this->getView(); + $helper = $renderer->plugin('view_model'); assert($helper instanceof ViewModel); $this->viewModelHelper = $helper; } From 5bfea2979961f865358438266850723b536547c4 Mon Sep 17 00:00:00 2001 From: Alexandre Lemaire Date: Wed, 17 Aug 2022 16:33:01 -0400 Subject: [PATCH 5/7] Issues added to psalm baseline. --- psalm-baseline.xml | 6 ++++++ src/Helper/Layout.php | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 620c1d730..6ba23d62b 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -712,9 +712,15 @@ + + plugin + (string) $template + + plugin + diff --git a/src/Helper/Layout.php b/src/Helper/Layout.php index 27018aaf9..812178c91 100644 --- a/src/Helper/Layout.php +++ b/src/Helper/Layout.php @@ -6,6 +6,7 @@ use Laminas\View\Exception; use Laminas\View\Model\ModelInterface as Model; +use Laminas\View\Renderer\PhpRenderer; use function assert; use function sprintf; @@ -98,9 +99,6 @@ public function setTemplate($template) protected function getViewModelHelper() { if (! $this->viewModelHelper) { - /** - * @psalm-suppress DeprecatedMethod - */ $renderer = $this->getView(); $helper = $renderer->plugin('view_model'); assert($helper instanceof ViewModel); From a85611de63086cb91e9b1f950147ba202ddbfd1c Mon Sep 17 00:00:00 2001 From: Alexandre Lemaire Date: Wed, 17 Aug 2022 16:57:44 -0400 Subject: [PATCH 6/7] Get this CS fix back in here. --- src/Helper/Layout.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Helper/Layout.php b/src/Helper/Layout.php index 812178c91..c8fde2986 100644 --- a/src/Helper/Layout.php +++ b/src/Helper/Layout.php @@ -6,7 +6,6 @@ use Laminas\View\Exception; use Laminas\View\Model\ModelInterface as Model; -use Laminas\View\Renderer\PhpRenderer; use function assert; use function sprintf; From 945016e3bf5f0d0faf458238f1ffe4d95b67d9e8 Mon Sep 17 00:00:00 2001 From: Alexandre Lemaire Date: Wed, 17 Aug 2022 17:03:09 -0400 Subject: [PATCH 7/7] CS Fix, deferring to project rules; wasn't being shown on composer cs-check on PHP 8.1 --- src/Helper/Layout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Helper/Layout.php b/src/Helper/Layout.php index c8fde2986..a1a4335b1 100644 --- a/src/Helper/Layout.php +++ b/src/Helper/Layout.php @@ -99,7 +99,7 @@ protected function getViewModelHelper() { if (! $this->viewModelHelper) { $renderer = $this->getView(); - $helper = $renderer->plugin('view_model'); + $helper = $renderer->plugin('view_model'); assert($helper instanceof ViewModel); $this->viewModelHelper = $helper; }