Problem/Motivation

phpstan reports,

------ ---------------------------------------------
Line src/ConditionalFieldsElementAlterHelper.php
------ ---------------------------------------------
140 Variable $parent might not be defined.
------ ---------------------------------------------
------ ----------------------------------------------------------------------
Line src/ConditionalFieldsFormHelper.php
------ ----------------------------------------------------------------------
346 \Drupal calls should be avoided in classes, use dependency injection
instead
359 Variable $first_field might not be defined.
362 Variable $storage might not be defined.
363 Variable $field_name might not be defined.
370 Variable $field_name might not be defined.
597 Variable $field_name might not be defined.
810 Variable $error_key_arr on left side of ?? always exists and is not
nullable.
------ ----------------------------------------------------------------------

Steps to reproduce

https://git.drupalcode.org/project/conditional_fields/-/jobs/3780550

Proposed resolution

Define the variables before they are used.

Remaining tasks

make a MR

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

benstallings created an issue. See original summary.

benstallings’s picture

Assigned: benstallings » Unassigned
Status: Active » Needs review
joelpittet’s picture

Status: Needs review » Closed (duplicate)

This is a duplicate of #3617084: Fix the PHPCS and PHPStan errors reported by GitLab CI, the problem is that the assumption was keeping D9 support made the constructor promotion go away. Thanks for trying to fix this @benstallings, ultimately went in a different direction.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.