mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-14 15:56:48 +03:00
a252f29847
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).
29 lines
539 B
PHP
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;
|
|
}
|
|
}
|