Download the PHP package donatj/php-dnf-solver without Composer
On this page you can find all versions of the php package donatj/php-dnf-solver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download donatj/php-dnf-solver
More information about donatj/php-dnf-solver
Files in donatj/php-dnf-solver
Package php-dnf-solver
Short Description PHP DNF (Disjunctive Normal Form) Signature Compatibility Solver
License MIT
Informations about the package php-dnf-solver
PHP DNF Solver
PHP DNF (Disjunctive Normal Form) Signature Compatibility Solver - see: https://wiki.php.net/rfc/dnf_types
Requirements
- php: ^8.1.0 || ^8.2.0 || ^8.3.0
Installing
Install the latest version with:
Examples
Example Parameter Satisfaction Check
Outputs:
Example DNF Building
Outputs:
Documentation
Class: \donatj\PhpDnfSolver\DNF
Method: DNF::getFromReflectionType
Helper to convert a ReflectionType into it's DNF representation
Example sources include
- ReflectionFunctionAbstract::getParameters()[…]->getType()
- ReflectionParameter::getType()
- ReflectionMethod::getReturnType()
- ReflectionProperty::getType()
Method: DNF::reflectionTypeSatisfiesReflectionType
Helper to quickly check if a ReflectionType satisfies another ReflectionType
Parameters:
- \ReflectionType
$satisfyingType
- The type which must be satisfied (e.g. a parameter type) - \ReflectionType
$satisfiedType
- The type which must satisfy the other (e.g. a return type)
Method: DNF::getFromVarType
Helper to quickly get a DNF representation of a (ReflectionParameter or ReflectionProperty)'s return type
Method: DNF::getFromReturnType
Helper to quickly get a DNF representation of a ReflectionFunctionAbstract (ReflectionFunction /
ReflectionMethod)'s return type
Class: \donatj\PhpDnfSolver\Exceptions\InvalidArgumentException
Class: \donatj\PhpDnfSolver\Exceptions\LogicException
Class: \donatj\PhpDnfSolver\Types\AndClause
Represents an "and clause" - a set of types which must all be satisfied - e.g. "A&B&C"
Method: AndClause->__construct
Parameters:
- \donatj\PhpDnfSolver\SingularDnfTypeInterface
$types
- The list of types to be satisfied
Method: AndClause->dnf
Return the canonical string representation of the DNF representation of this type
Method: AndClause->isSatisfiedBy
Tests if this type is satisfied by the given type
For example, if this type is "A|(B&C)" and the given type matches just "A", this method returns true.
If the given type matches just "B", this method returns false.
If the given type matches "B&C", this method returns true.
Method: AndClause->count
Returns the number of types in this DNF type
Method: AndClause->getTypes
Returns:
- \donatj\PhpDnfSolver\SingularDnfTypeInterface[]
Class: \donatj\PhpDnfSolver\Types\BuiltInType
Represents a "built in type" as defined by ReflectionNamedType::isBuiltin()
This includes:
- int
- float
- string
- bool
- array
- iterable
Method: BuiltInType->__construct
Parameters:
- string
$name
- The name of the built-in type
Method: BuiltInType->dnf
Return the canonical string representation of the DNF representation of this type
Method: BuiltInType->getTypeName
Returns the fully qualified type name of this type
Method: BuiltInType->isSatisfiedBy
Tests if this type is satisfied by the given type
For example, if this type is "A|(B&C)" and the given type matches just "A", this method returns true.
If the given type matches just "B", this method returns false.
If the given type matches "B&C", this method returns true.
Method: BuiltInType->count
Always 1 for singular types
Returns the number of types in this DNF type
Class: \donatj\PhpDnfSolver\Types\CallableType
Represents a "callable" type
This includes:
- callable
- Closure
- Invokable classes
Method: CallableType->dnf
Return the canonical string representation of the DNF representation of this type
Method: CallableType->isSatisfiedBy
Tests if this type is satisfied by the given type
For example, if this type is "A|(B&C)" and the given type matches just "A", this method returns true.
If the given type matches just "B", this method returns false.
If the given type matches "B&C", this method returns true.
Method: CallableType->getTypeName
Returns the fully qualified type name of this type
Method: CallableType->count
Always 1 for singular types
Returns the number of types in this DNF type
Class: \donatj\PhpDnfSolver\Types\OrClause
Represents a "or" clause - a set of types where any one of them must be satisfied - e.g. "A|B|(C&D)"
Method: OrClause->__construct
Parameters:
- \donatj\PhpDnfSolver\Types\AndClause | \donatj\PhpDnfSolver\SingularDnfTypeInterface
$types
- The list of types to be satisfied. Does not accept an OrClause as DNF defines that as invalid.
Method: OrClause->dnf
Return the canonical string representation of the DNF representation of this type
Method: OrClause->isSatisfiedBy
Tests if this type is satisfied by the given type
For example, if this type is "A|(B&C)" and the given type matches just "A", this method returns true.
If the given type matches just "B", this method returns false.
If the given type matches "B&C", this method returns true.
Method: OrClause->count
Returns the number of types in this DNF type
Method: OrClause->getTypes
Returns:
- \donatj\PhpDnfSolver\Types\AndClause[]
Class: \donatj\PhpDnfSolver\Types\UserDefinedType
Represents a "user defined type" - a class, interface, or trait, etc.
Method: UserDefinedType->__construct
Parameters:
- class-string
$className
- The name of the class, interface, or trait to be satisfied
Throws: \donatj\PhpDnfSolver\Exceptions\InvalidArgumentException
- if the user defined type does not exist after triggering registered autoloaders
Method: UserDefinedType->dnf
Return the canonical string representation of the DNF representation of this type
Method: UserDefinedType->getTypeName
Returns the fully qualified type name of this type
Returns:
- class-string
Method: UserDefinedType->isSatisfiedBy
Tests if this type is satisfied by the given type
For example, if this type is "A|(B&C)" and the given type matches just "A", this method returns true.
If the given type matches just "B", this method returns false.
If the given type matches "B&C", this method returns true.
Method: UserDefinedType->count
Always 1 for singular types
Returns the number of types in this DNF type