Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MethodName.php

class MethodName

@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

@internal This class is not covered by the backward compatibility promise for PHPUnit

Hierarchy

  • class \PHPUnit\Framework\MockObject\Rule\MethodName

Expanded class hierarchy of MethodName

1 file declares its use of MethodName
Matcher.php in vendor/phpunit/phpunit/src/Framework/MockObject/Runtime/Matcher.php
1 string reference to 'MethodName'
Crap4j::process in vendor/phpunit/php-code-coverage/src/Report/Crap4j.php

File

vendor/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/MethodName.php, line 24

Namespace

PHPUnit\Framework\MockObject\Rule
View source
final class MethodName {
    private readonly Constraint $constraint;
    
    /**
     * @throws InvalidArgumentException
     */
    public function __construct(Constraint|string $constraint) {
        if (is_string($constraint)) {
            $constraint = new MethodNameConstraint($constraint);
        }
        $this->constraint = $constraint;
    }
    public function toString() : string {
        return 'method name ' . $this->constraint
            ->toString();
    }
    
    /**
     * @throws ExpectationFailedException
     */
    public function matches(BaseInvocation $invocation) : bool {
        return $this->matchesName($invocation->methodName());
    }
    
    /**
     * @throws ExpectationFailedException
     */
    public function matchesName(string $methodName) : bool {
        return (bool) $this->constraint
            ->evaluate($methodName, '', true);
    }

}

Members

Title Sort descending Modifiers Object type Summary
MethodName::$constraint private property
MethodName::matches public function
MethodName::matchesName public function
MethodName::toString public function
MethodName::__construct public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal