Problem/Motivation

GitLab CI reports a single issue during the phpstan test:

 ------ ------------------------------------------------------------------------------ 
  Line   src/Plugin/Validation/Constraint/AlternativeUserEmailsValidator.php           
 ------ ------------------------------------------------------------------------------ 
  39     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
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

ptmkenny created an issue. See original summary.

ptmkenny’s picture

ptmkenny’s picture

Status: Active » Needs review

I opted to make the constructor final rather than the entire class, because it may be that someone builds on top of this module and wants to extend the validator class.

ptmkenny’s picture

Assigned: Unassigned » jonathanshaw
jonathanshaw’s picture

I'm happy with that. A pit puzzled by where this static is, I can't see one :)

ptmkenny’s picture

Assigned: jonathanshaw » Unassigned
Status: Needs review » Active

Ok, great. I think the point of this rule is "lock down the class somehow so that people don't extend it haphazardly, making debugging harder." But to do that they have confusingly named rules... =)

  • ptmkenny committed bc0c8194 on 1.0.x
    Issue #3426543 by ptmkenny, jonathanshaw: Fix the CI phpstan test
    
ptmkenny’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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