PHP code example of ulrack / enum

1. Go to this page and download the library: Download ulrack/enum library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ulrack / enum example snippets



/**
 * Copyright (C) GrizzIT, Inc. All rights reserved.
 * See LICENSE for license details.
 */

namespace MyProject\MyPackage\Common;

use Ulrack\Enum\Enum;

/**
 * @method static EnumMock FOO()
 * @method static EnumMock BAR()
 */
class MyEnum extends Enum
{
    const FOO = 'foo';
    const BAR = 'bar';
}


/**
 * Copyright (C) GrizzIT, Inc. All rights reserved.
 * See LICENSE for license details.
 */

namespace MyProject\MyPackage\Namespace;

use MyProject\MyPackage\Common\MyEnum;

class MyImplementation
{
    /**
     * Constructor
     *
     * @param MyEnum $option
     */
    public function __construct(MyEnum $option)
    {
        $this->option = (string) $option;
    }
}

new MyImplementation(MyEnum::FOO());