UsesTrait
final class UsesTrait extends AbstractConstraint
Constraint that accepts classes that extend given class.
Traits
Implementation of an inheritance constraint class.
Methods
Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
Returns the description of the failure.
Returns short description of what we examine, e.g. 'impements interface'.
Returns short negated description of what we examine, e.g. 'does not impement interface'.
Checks if $subject may be used as an argument to inheritance().
Returns a custom string representation of the constraint object when it appears in context of an $operator expression.
Returns the description of the failure when this constraint appears in context of an $operator expression.
No description
Details
        in 
AbstractConstraint at line 38
                    protected        
    __construct(string $expected)
        
    
    Initializes the constraint.
        in 
AbstractConstraint at line 46
        final                    string
    toString()
        
    
    Returns a string representation of the constraint.
        in 
AbstractConstraint at line 57
        final                    bool
    matches(mixed $other)
        
    
    Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
        in 
AbstractConstraint at line 77
        final                    string
    failureDescription(mixed $other)
        
    
    Returns the description of the failure.
The beginning of failure messages is "Failed asserting that" in most cases. This method should return the second part of that sentence.
        in 
ConstraintImplementationTrait at line 49
                    protected        string
    verb()
        
    
    Returns short description of what we examine, e.g. 'impements interface'.
        in 
ConstraintImplementationTrait at line 57
                    protected        string
    negatedVerb()
        
    
    Returns short negated description of what we examine, e.g. 'does not impement interface'.
        in 
ConstraintImplementationTrait at line 67
                    protected        array
    inheritance(string $class)
        
    
    No description
        in 
ConstraintImplementationTrait at line 78
                    protected        bool
    supports(string $subject)
        
    
    Checks if $subject may be used as an argument to inheritance().
        in 
AbstractConstraint at line 121
        final            protected        string
    toStringInContext(Operator $operator, mixed $role)
        
    
    Returns a custom string representation of the constraint object when it appears in context of an $operator expression.
The purpose of this method is to provide meaningful descriptive string in context of operators such as LogicalNot. Native PHPUnit constraints are supported out of the box by LogicalNot, but externally developed ones had no way to provide correct strings in this context.
The method shall return empty string, when it does not handle customization by itself.
        in 
AbstractConstraint at line 146
        final            protected        string
    failureDescriptionInContext(Operator $operator, mixed $role, mixed $other)
        
    
    Returns the description of the failure when this constraint appears in context of an $operator expression.
The purpose of this method is to provide meaningful failue description in context of operators such as LogicalNot. Native PHPUnit constraints are supported out of the box by LogicalNot, but externally developed ones had no way to provide correct messages in this context.
The method shall return empty string, when it does not handle customization by itself.
        in 
ConstraintImplementationTrait at line 39
                static            ConstraintImplementationTrait
    create(string $expected)
        
    
    No description