Commit 9847c914 authored by Jan Kuchař's avatar Jan Kuchař

Merge branch 'loose-comparison-cross-types' into 'master'

test: does comparing across types works as expected?

See merge request !12
parents ea295f89 828a882f
Pipeline #14401 passed with stages
in 33 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