diff --git a/.phpstan.dist.baseline.neon b/.phpstan.dist.baseline.neon index beaf6ae12e8..a4c1b8adbc0 100644 --- a/.phpstan.dist.baseline.neon +++ b/.phpstan.dist.baseline.neon @@ -117,22 +117,7 @@ parameters: - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php - - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php - - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php - - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 4 + count: 3 path: app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php - @@ -190,11 +175,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Permissions/Usernroles.php - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" count: 1 @@ -202,7 +182,7 @@ parameters: - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 2 + count: 1 path: app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php - @@ -210,11 +190,6 @@ parameters: count: 3 path: app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php - - message: "#^Parameter \\#1 \\$collection of method Mage_Adminhtml_Block_Widget_Grid\\:\\:setCollection\\(\\) expects Varien_Data_Collection_Db, Mage_Reports_Model_Resource_Report_Collection given\\.$#" count: 1 @@ -290,16 +265,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Grid.php - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php - - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php - - message: "#^Return type \\(int\\) of method Mage_Adminhtml_Block_Review_Grid_Filter_Type\\:\\:getCondition\\(\\) should be compatible with return type \\(array\\|null\\) of method Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select\\:\\:getCondition\\(\\)$#" count: 1 @@ -475,11 +440,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Shipping/Carrier/Tablerate/Grid.php - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php - - message: "#^Property Mage_Adminhtml_Block_Store_Switcher_Form_Renderer_Fieldset\\:\\:\\$_element \\(Varien_Data_Form_Element_Fieldset\\) does not accept Varien_Data_Form_Element_Abstract\\.$#" count: 1 @@ -560,11 +520,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php - - message: "#^Method Mage_Core_Model_Email_Template\\:\\:getProcessedTemplate\\(\\) invoked with 2 parameters, 0\\-1 required\\.$#" count: 1 @@ -590,11 +545,6 @@ parameters: count: 2 path: app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php - - message: "#^Method Mage_Adminhtml_Block_Widget_Container\\:\\:_addButtonChildBlock\\(\\) should return Mage_Adminhtml_Block_Widget_Button but returns Mage_Core_Block_Abstract\\|false\\.$#" count: 1 @@ -7370,11 +7320,6 @@ parameters: count: 1 path: app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Layout.php - - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" - count: 1 - path: app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php - - message: "#^Variable \\$productsOptions might not be defined\\.$#" count: 1 diff --git a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php index 669070bf002..5ca118fdb90 100644 --- a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php @@ -93,7 +93,7 @@ protected function _prepareForm() 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true), ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); } else { $fieldset->addField('store_id', 'hidden', [ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php index 19a13b39984..580bc63a1d2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php @@ -87,7 +87,7 @@ protected function _prepareForm() 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true), ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); } else { $fieldset->addField('store_id', 'hidden', [ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php index 7c96ef14fc2..3992765164d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php @@ -80,7 +80,7 @@ protected function _prepareForm() 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true), 'disabled' => $isElementDisabled, ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); } else { $fieldset->addField('store_id', 'hidden', [ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php index e54cbf69ec5..decfbf46129 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php @@ -96,7 +96,7 @@ function(v, elem){ ); // @codingStandardsIgnoreEnd } - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $form->getElement('website_id')->setRenderer($renderer); $customerStoreId = null; diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php index 1338916611e..29709db48b0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php @@ -127,7 +127,7 @@ protected function _prepareForm() 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm() ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); } diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php index 0332a3d4e6c..471c4243e53 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php @@ -131,7 +131,7 @@ protected function _prepareForm() 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm() ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); } diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php b/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php index 0f4abe26579..696f66f401b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php @@ -98,7 +98,7 @@ protected function _prepareForm() 'name' => 'stores[]', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm() ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); $fieldset->addField('position', 'text', [ diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php b/app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php index a3eebf4e4c7..6d95780d277 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php @@ -56,7 +56,7 @@ protected function _prepareForm() 'name' => 'select_stores[]', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(), ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); } diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php index a13bea753ce..46ad61ce963 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php @@ -86,7 +86,7 @@ protected function _prepareForm() 'name' => 'stores[]', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(), ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); $review->setSelectStores($review->getStores()); } else { diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php index bfb9dd78f3b..83f30cd493a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php @@ -74,7 +74,7 @@ protected function _prepareForm() 'value' => $model->getStoreId(), 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(), ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); } else { $fieldset->addField('store_id', 'hidden', [ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php b/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php index b98619c2573..e54b65c40f5 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php @@ -33,7 +33,7 @@ protected function _prepareForm() 'name' => 'store_id', 'required' => true, ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); } else { $fieldset->addField('store_id', 'hidden', [ diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php index 434cdc6c4c1..ee88670a29c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php @@ -145,7 +145,7 @@ protected function _prepareForm() 'disabled' => true, 'value' => $formValues['store_id'], ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $element->setRenderer($renderer); if ($noStoreError) { $element->setAfterElementHtml($noStoreError); diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form.php b/app/code/core/Mage/Adminhtml/Block/Widget/Form.php index aa953698ccb..bd68ad8d93d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Form.php @@ -238,8 +238,16 @@ protected function _getAdditionalElementTypes() * @param Varien_Data_Form_Element_Abstract $element * @return string */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass protected function _getAdditionalElementHtml($element) { return ''; } + + protected function getStoreSwitcherRenderer(): Mage_Adminhtml_Block_Store_Switcher_Form_Renderer_Fieldset_Element + { + /** @var Mage_Adminhtml_Block_Store_Switcher_Form_Renderer_Fieldset_Element $renderer */ + $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + return $renderer; + } } diff --git a/app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php b/app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php index b4d841d8982..39948f8b9aa 100644 --- a/app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php +++ b/app/code/core/Mage/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php @@ -138,7 +138,7 @@ protected function _prepareForm() 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true), ]); - $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'); + $renderer = $this->getStoreSwitcherRenderer(); $field->setRenderer($renderer); }