Skip to content

Magento\Framework\App\CacheInterface::load annotation is wrong #31450

Open
@mpchadwick

Description

@mpchadwick

Preconditions (*)

Install any version of Magento
Magento 2.4-develop

Steps to reproduce (*)

Implement code such as

public function __construct(
    \Magento\Framework\App\CacheInterface $cache
) {
    $this->cache = $cache;
}

public function doSomething($identifier)
{
    $cached = $this->cache->load($identifier);
    if ($cached !== false) {
}

Run a CI tool against the code (in our case Scrutinizer)

Expected result (*)

No errors reported by CI tool. Magento\Framework\App\CacheInterface can return a bool and this is the best way to validate if anything is in the cache (see: https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/blob/1.14.1/Cm/Cache/Backend/Redis.php#L473 / https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/blob/1.14.1/Cm/Cache/Backend/Redis.php#L488)

Actual result (*)

CI tool reports violation as Magento\Framework\App\CacheInterface::load annotation indicates only a string can be returned.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Area: FrameworkComponent: Framework/CacheIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

Status

Pull Request In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions