diff --git a/src/Illuminate/Contracts/Support/HasOnceHash.php b/src/Illuminate/Contracts/Support/HasOnceHash.php new file mode 100644 index 000000000000..e9ec6e59463f --- /dev/null +++ b/src/Illuminate/Contracts/Support/HasOnceHash.php @@ -0,0 +1,13 @@ + is_object($argument) ? spl_object_hash($argument) : $argument, + static function (mixed $argument) { + if ($argument instanceof HasOnceHash) { + return $argument->onceHash(); + } + + if (is_object($argument)) { + return spl_object_hash($argument); + } + + return $argument; + }, $callable instanceof Closure ? (new ReflectionClosure($callable))->getClosureUsedVariables() : [], );