Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293641

Add void return typehints to protected test helper methods

$
0
0

Problem/Motivation

See #3455549: Add return typehints to protected test helper methods

Steps to reproduce

Proposed resolution

Use \Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector to add void return type to protected test methods. This rule may need manipulating to skip public methods.

private function shouldSkipClassMethod(ClassMethod $classMethod) : bool
{
    // Add this to skip public methods.
    if ($classMethod->isPublic()) {
        return \true;
    }
     
    // The rest of the method body remains here ...

    //  Comment out this bit.
    // if ($classMethod->isProtected()) {
    //     return !$this->classModifierChecker->isInsideFinalClass($classMethod);
    // }

    return $this->classModifierChecker->isInsideAbstractClass($classMethod) && $classMethod->getStmts() === [];
}

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 293641

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>