Commit b7eac287 authored by Jan Kuchař's avatar Jan Kuchař

feature: support for non-strict comparision: failing test

parent 84c38d31
<?php
declare(strict_types=1);
require __DIR__ . '/../bootstrap.php';
/**
* @method static Enum1 VALUE1()
* @method static Enum1 VALUE2()
*/
class Enum1 extends \Grifart\Enum\Enum
{
use Grifart\Enum\AutoInstances;
protected const VALUE1 = 'value1';
protected const VALUE2 = 'value2';
}
$val1 = Enum1::VALUE1();
$val2 = Enum1::VALUE2();
/** intentionally non-strict @noinspection TypeUnsafeComparisonInspection PhpNonStrictObjectEqualityInspection */
\Tester\Assert::true($val1 == Enum1::VALUE1());
/** intentionally non-strict @noinspection TypeUnsafeComparisonInspection PhpNonStrictObjectEqualityInspection */
\Tester\Assert::true($val2 == Enum1::VALUE2());
/** intentionally non-strict @noinspection TypeUnsafeComparisonInspection PhpNonStrictObjectEqualityInspection */
\Tester\Assert::true($val1 != Enum1::VALUE2());
/** intentionally non-strict @noinspection TypeUnsafeComparisonInspection PhpNonStrictObjectEqualityInspection */
\Tester\Assert::true($val2 != Enum1::VALUE1());
$switchResult = 0;
switch ($val1) {
case Enum1::VALUE1():
$switchResult = 1;
break;
case Enum1::VALUE2():
$switchResult = 2;
break;
default:
$switchResult = 3;
break;
}
\Tester\Assert::same(1, $switchResult);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment