spl_object_hash

Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8
Return hash id for given object
<?php spl_object_hash(object $object): string
<?php         if (is_string($scope) && ($implementation instanceof Closure || $implementation instanceof Scope)) {

            return static::$globalScopes[static::class][$scope] = $implementation;

        } elseif ($scope instanceof Closure) {

            return static::$globalScopes[static::class][spl_object_hash($scope)] = $scope;

        } elseif ($scope instanceof Scope) {

            return static::$globalScopes[static::class][get_class($scope)] = $scope;

        } elseif (is_string($scope) && class_exists($scope) && is_subclass_of($scope, Scope::class)) {
<?php         }



        $uses = array_map(

            fn (mixed $argument) => is_object($argument) ? spl_object_hash($argument) : $argument,

            $callable instanceof Closure ? (new ReflectionClosure($callable))->getClosureUsedVariables() : [],

        );
<?php         $duplicateFooInstance = $manager->instance('foo');

        $duplicateBarInstance = $manager->instance('bar');

        $this->assertEquals(spl_object_hash($fooInstance), spl_object_hash($duplicateFooInstance));

        $this->assertEquals(spl_object_hash($barInstance), spl_object_hash($duplicateBarInstance));

    }
<?php         $duplicateFooInstance = $manager->instance('foo');

        $duplicateBarInstance = $manager->instance('bar');

        $this->assertEquals(spl_object_hash($fooInstance), spl_object_hash($duplicateFooInstance));

        $this->assertEquals(spl_object_hash($barInstance), spl_object_hash($duplicateBarInstance));

    }



    public function test_unresolvable_instances_throw_errors()
<?php         });

        $result = $resolver->resolve('foo');



        $this->assertEquals(spl_object_hash($result), spl_object_hash($resolver->resolve('foo')));

    }



    public function testResolverThrowsExceptionOnUnknownEngine()