Commit 828a882f authored by Jan Kuchař's avatar Jan Kuchař

test: does comparing across types works as expected?

parent ea295f89
Pipeline #14400 passed with stages
in 36 seconds
<?php declare(strict_types=1);
use Grifart\Enum\MissingValueDeclarationException;
require __DIR__ . '/../bootstrap.php';
/**
......
<?php declare(strict_types=1);
require __DIR__ . '/../bootstrap.php';
/**
* @method static Enum1 VALUE()
*/
class Enum1 extends \Grifart\Enum\Enum
{
use Grifart\Enum\AutoInstances;
private const VALUE = 'value';
}
/**
* @method static Enum2 VALUE()
*/
class Enum2 extends \Grifart\Enum\Enum
{
use Grifart\Enum\AutoInstances;
private const VALUE = 'value';
}
\Tester\Assert::true(Enum1::VALUE()->toScalar() === Enum2::VALUE()->toScalar());
// everything same, but type of value is different
\Tester\Assert::false(Enum1::VALUE() === Enum2::VALUE());
/** @noinspection PhpNonStrictObjectEqualityInspection TypeUnsafeComparisonInspection */
\Tester\Assert::false(Enum1::VALUE() == Enum2::VALUE());
<?php declare(strict_types=1);
use Grifart\Enum\MissingValueDeclarationException;
require __DIR__ . '/../bootstrap.php';
/**
......
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