Skip to content

Add phpunit helper #2

@roxblnfk

Description

@roxblnfk

It would be great if you created a helper package for PHPUnit that can assert the type of a given value.

For example:

final class Branch
{
    /**
     * @param T $item
     * @param list<Branch<T>> $children
     * @param Branch<T>|null $parent
     */
    public function __construct(
        public object $item,
        public array $children = [],
        public ?Branch $parent = null,
    ) {}
}


self::assertType('Branch<Edge>', $branch);

This function will check that inside the Branch $branch, in a property of type T, there is an exactly Edge. The same about other fields

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions