Problem/Motivation

See #3404246: [META] Fix strict type errors detected by phpstan.

There are 112 violations in usages of \Drupal\Core\Config\Schema\SchemaCheckTrait.

Steps to reproduce

Add checkFunctionArgumentTypes: true to phpstan.neon.dist

./vendor/bin/phpstan analyse -c core/phpstan.neon.dist | grep "SchemaCheckTrait" -B1 -C6

Proposed resolution

Use ConstraintViolationInterface instead of ConstraintViolation in the trait.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3542137

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

mstrelan created an issue. See original summary.

mstrelan’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative
   ├ Failed asserting that two strings are equal.
       ┊ ---·Expected
       ┊ +++·Actual
       ┊ @@ @@
       ┊ -'REPEATABLE-READ'
       ┊ +'READ-COMMITTED'
       │
       │ /builds/issue/drupal-3542137/core/modules/mysql/tests/src/Functional/InstallerIsolationLevelExistingSettingsTest.php:58

Seems un-related to this change and this change seems straight forward so marking.

mstrelan’s picture

Rebased for a green pipeline

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record

I think the type change on the trait is probably OK since it's so new and not used, but we should add a CR just in case.

mstrelan’s picture

Status: Needs work » Needs review
Issue tags: -Needs change record

Added the CR. Note it only affects classes that extend a base class using the trait and override this method.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

CR reads fine.

  • longwave committed 3e9f2844 on 11.x
    Issue #3542137 by mstrelan: Fix strict type issues in SchemaCheckTrait
    
longwave’s picture

Status: Reviewed & tested by the community » Fixed

Not sure this really needed a change record, but I'll publish it seeing as there is one.

Committed 3e9f284 and pushed to 11.x. Thanks!

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

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

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.