Files
php-uuid/tests/TestCase.php
T
Marco Pivetta a252f29847 Import used functions and constants via use statement to disallow ambiguity for compiler/static-analysis
As documented in https://wiki.php.net/rfc/use_global_elements, the engine (by default) does a local namespace
lookup, then falls back to global namespace when first calling a global function referenced in namespaced code,
unless that function is referenced via fully qualified name (FQN).

By using the FQN, the actual symbol can be looked up at compile-time, both by the PHP engine and by static analysis
tooling, allowing for compiler (in particular) optimizations to replace known hot-path functions with specialized opcodes.

Sadly, no actual benchmark at hand: the improvements can be minimal or massive, depending on where this library is
used (tight loops being most relevant).
2020-02-03 13:15:35 -06:00

29 lines
539 B
PHP

<?php
declare(strict_types=1);
namespace Ramsey\Uuid\Test;
use AspectMock\Test as AspectMock;
use Mockery;
use PHPUnit\Framework\TestCase as PhpUnitTestCase;
use function current;
use function pack;
use function unpack;
class TestCase extends PhpUnitTestCase
{
protected function tearDown(): void
{
parent::tearDown();
AspectMock::clean();
Mockery::close();
}
public static function isLittleEndianSystem(): bool
{
return current(unpack('v', pack('S', 0x00FF))) === 0x00FF;
}
}