PHP Classes

File: tests/src/Depends.php

Recommend this page to a friend!
  Packages of Rodolfo Berrios Arce   Parameter   tests/src/Depends.php   Download  
File: tests/src/Depends.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Parameter
Validate function parameters with PHP attributes
Author: By
Last change:
Date: 1 year ago
Size: 1,288 bytes
 

Contents

Class file image Download
<?php

/*
 * This file is part of Chevere.
 *
 * (c) Rodolfo Berrios <rodolfo@chevere.org>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Chevere\Tests\src;

use Chevere\Parameter\Attributes\BoolAttr;
use Chevere\Parameter\Attributes\NullAttr;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Attributes\UnionAttr;
use stdClass;

final class Depends
{
    public function useNone($file = 'default')
    {
    }

    // public function useNull(null $file = null)
    // {
    // }

    public function useObject(stdClass $file)
    {
    }

    public function useString(
        #[StringAttr('/^[a-z]+$/', description: 'A string')]
        string $string = 'default'
    ) {
    }

    public function useUnion(string|int $union)
    {
    }

    public function useMixed(mixed $mixed)
    {
    }

    public function useWrongUnionAttr(
        #[UnionAttr(
            new BoolAttr(),
            new NullAttr(),
        )]
        string|int $union
    ) {
    }

    public function useIntersection(stdClass&Depends $intersection)
    {
    }

    public function useInvalidAttribute(
        #[StringAttr()]
        int $int
    ) {
    }
}