$source !== 'recipes' is a comparison of incompatible types

Created on 21 January 2025, 3 months ago

Problem/Motivation

In \Drupal\project_browser\Element\ProjectBrowser::getDrupalSettings the variable $source, which is provided as a string, gets replaced with a ProjectBrowserSourceInterface object. Later, that variable is used to compare it with a string. This will never produce the expected result.

Steps to reproduce

Enable the recipe source and xdebug line 132 in \Drupal\project_browser\Element\ProjectBrowser, you will see that an object gets compared with the string recipe.

Proposed resolution

Do not override the variable with a different type, PhpStan will complain about that anyway. Use a different variable instead.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024