magento-lts icon indicating copy to clipboard operation
magento-lts copied to clipboard

phpstan: fixed calls to Mage_Core_Block_Abstract

Open sreichel opened this issue 2 years ago • 1 comments

Description (*)

Some phpstan/docblock fixes ...

Contribution checklist (*)

  • [x] Pull request has a meaningful description of its purpose
  • [x] All commits are accompanied by meaningful commit messages
  • [x] All automated tests passed successfully (all builds are green)
  • [x] Add yourself to contributors list

sreichel avatar Aug 12 '22 03:08 sreichel

Unit Test Results

1 files  ±0  1 suites  ±0   0s :stopwatch: ±0s 0 tests ±0  0 :heavy_check_mark: ±0  0 :zzz: ±0  0 :x: ±0  7 runs  ±0  5 :heavy_check_mark: ±0  2 :zzz: ±0  0 :x: ±0 

Results for commit 73db66ec. ± Comparison against base commit a002f37a.

github-actions[bot] avatar Aug 12 '22 03:08 github-actions[bot]

Unit Test Results

1 files  ±0  1 suites  ±0   0s :stopwatch: ±0s 0 tests ±0  0 :heavy_check_mark: ±0  0 :zzz: ±0  0 :x: ±0  7 runs  ±0  5 :heavy_check_mark: ±0  2 :zzz: ±0  0 :x: ±0 

Results for commit 920a5cb3. ± Comparison against base commit 873050bc.

github-actions[bot] avatar Aug 16 '22 00:08 github-actions[bot]

Unit Test Results

1 files  ±0  1 suites  ±0   0s :stopwatch: ±0s 0 tests ±0  0 :heavy_check_mark: ±0  0 :zzz: ±0  0 :x: ±0  7 runs  ±0  5 :heavy_check_mark: ±0  2 :zzz: ±0  0 :x: ±0 

Results for commit 920a5cb3. ± Comparison against base commit 873050bc.

github-actions[bot] avatar Aug 16 '22 00:08 github-actions[bot]

I'm working on a large PR (#416 - Adminhtml), so it would be nice to have phpstan fixes (along with docblock updates) reviewed.

Just to explain (same for PR #2421) why i'v changed this (or similiar) ...

            if ($root = $this->getLayout()->getBlock('root')) {

to

            /** @var Mage_Page_Block_Html $root */
            $root = $this->getLayout()->getBlock('root');
            if ($root) {

PhpStorm can resolve these classes, because we told it with our phpstorm.meta.files. PHPStan - that only reads DOCblock, compares it to params or returned variables - does not know about class/method-mappings, so we have to make it more explict.

With this changes autocomplete/"jump-to method" should also work for other IDE then Phpstorm (not tested)

sreichel avatar Aug 16 '22 21:08 sreichel

Unit Test Results

1 files  ±0  1 suites  ±0   0s :stopwatch: ±0s 0 tests ±0  0 :heavy_check_mark: ±0  0 :zzz: ±0  0 :x: ±0  7 runs  ±0  5 :heavy_check_mark: ±0  2 :zzz: ±0  0 :x: ±0 

Results for commit ba9ffe06. ± Comparison against base commit 873050bc.

github-actions[bot] avatar Aug 17 '22 08:08 github-actions[bot]