Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: add composer assets
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Apr 24, 2025
commit 82fa55b1fd8cfb302a38b94c84c42464d80b20bd
6 changes: 3 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1745,34 +1745,34 @@
},
{
"name": "laravel/serializable-closure",
"version": "v1.3.5",
"version_normalized": "1.3.5.0",
"version": "v2.0.4",
"version_normalized": "2.0.4.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/serializable-closure.git",
"reference": "1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c"
"reference": "b352cf0534aa1ae6b4d825d1e762e35d43f8a841"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c",
"reference": "1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/b352cf0534aa1ae6b4d825d1e762e35d43f8a841",
"reference": "b352cf0534aa1ae6b4d825d1e762e35d43f8a841",
"shasum": ""
},
"require": {
"php": "^7.3|^8.0"
"php": "^8.1"
},
"require-dev": {
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
"nesbot/carbon": "^2.61|^3.0",
"pestphp/pest": "^1.21.3",
"phpstan/phpstan": "^1.8.2",
"symfony/var-dumper": "^5.4.11|^6.2.0|^7.0.0"
"illuminate/support": "^10.0|^11.0|^12.0",
"nesbot/carbon": "^2.67|^3.0",
"pestphp/pest": "^2.36|^3.0",
"phpstan/phpstan": "^2.0",
"symfony/var-dumper": "^6.2.0|^7.0.0"
},
"time": "2024-09-23T13:33:08+00:00",
"time": "2025-03-19T13:51:03+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
"dev-master": "2.x-dev"
}
},
"installation-source": "dist",
Expand Down
6 changes: 3 additions & 3 deletions composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@
'dev_requirement' => false,
),
'laravel/serializable-closure' => array(
'pretty_version' => 'v1.3.5',
'version' => '1.3.5.0',
'reference' => '1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c',
'pretty_version' => 'v2.0.4',
'version' => '2.0.4.0',
'reference' => 'b352cf0534aa1ae6b4d825d1e762e35d43f8a841',
'type' => 'library',
'install_path' => __DIR__ . '/../laravel/serializable-closure',
'aliases' => array(),
Expand Down
17 changes: 2 additions & 15 deletions laravel/serializable-closure/src/SerializableClosure.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Closure;
use Laravel\SerializableClosure\Exceptions\InvalidSignatureException;
use Laravel\SerializableClosure\Exceptions\PhpVersionNotSupportedException;
use Laravel\SerializableClosure\Serializers\Signed;
use Laravel\SerializableClosure\Signers\Hmac;

Expand All @@ -25,10 +24,6 @@ class SerializableClosure
*/
public function __construct(Closure $closure)
{
if (\PHP_VERSION_ID < 70400) {
throw new PhpVersionNotSupportedException();
}

$this->serializable = Serializers\Signed::$signer
? new Serializers\Signed($closure)
: new Serializers\Native($closure);
Expand All @@ -41,10 +36,6 @@ public function __construct(Closure $closure)
*/
public function __invoke()
{
if (\PHP_VERSION_ID < 70400) {
throw new PhpVersionNotSupportedException();
}

return call_user_func_array($this->serializable, func_get_args());
}

Expand All @@ -55,10 +46,6 @@ public function __invoke()
*/
public function getClosure()
{
if (\PHP_VERSION_ID < 70400) {
throw new PhpVersionNotSupportedException();
}

return $this->serializable->getClosure();
}

Expand Down Expand Up @@ -111,7 +98,7 @@ public static function resolveUseVariablesUsing($resolver)
/**
* Get the serializable representation of the closure.
*
* @return array
* @return array{serializable: \Laravel\SerializableClosure\Serializers\Signed|\Laravel\SerializableClosure\Contracts\Serializable}
*/
public function __serialize()
{
Expand All @@ -123,7 +110,7 @@ public function __serialize()
/**
* Restore the closure after serialization.
*
* @param array $data
* @param array{serializable: \Laravel\SerializableClosure\Serializers\Signed|\Laravel\SerializableClosure\Contracts\Serializable} $data
* @return void
*
* @throws \Laravel\SerializableClosure\Exceptions\InvalidSignatureException
Expand Down
24 changes: 16 additions & 8 deletions laravel/serializable-closure/src/Serializers/Native.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Laravel\SerializableClosure\Support\SelfReference;
use Laravel\SerializableClosure\UnsignedSerializableClosure;
use ReflectionObject;
use ReflectionProperty;
use UnitEnum;

class Native implements Serializable
Expand Down Expand Up @@ -274,7 +275,7 @@ public static function wrapClosures(&$data, $storage)

$property->setAccessible(true);

if (PHP_VERSION >= 7.4 && ! $property->isInitialized($instance)) {
if (! $property->isInitialized($instance)) {
continue;
}

Expand Down Expand Up @@ -374,11 +375,7 @@ protected function mapPointers(&$data)

$property->setAccessible(true);

if (PHP_VERSION >= 7.4 && ! $property->isInitialized($data)) {
continue;
}

if (PHP_VERSION >= 8.1 && $property->isReadOnly()) {
if (! $property->isInitialized($data) || $property->isReadOnly()) {
continue;
}

Expand Down Expand Up @@ -494,13 +491,13 @@ protected function mapByReference(&$data)
}

foreach ($reflection->getProperties() as $property) {
if ($property->isStatic() || ! $property->getDeclaringClass()->isUserDefined()) {
if ($property->isStatic() || ! $property->getDeclaringClass()->isUserDefined() || $this->isVirtualProperty($property)) {
continue;
}

$property->setAccessible(true);

if (PHP_VERSION >= 7.4 && ! $property->isInitialized($instance)) {
if (! $property->isInitialized($instance) || ($property->isReadOnly() && $property->class !== $reflection->name)) {
continue;
}

Expand All @@ -515,4 +512,15 @@ protected function mapByReference(&$data)
} while ($reflection = $reflection->getParentClass());
}
}

/**
* Determine is virtual property.
*
* @param \ReflectionProperty $property
* @return bool
*/
protected function isVirtualProperty(ReflectionProperty $property): bool
{
return method_exists($property, 'isVirtual') && $property->isVirtual();
}
}
2 changes: 1 addition & 1 deletion laravel/serializable-closure/src/Serializers/Signed.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __serialize()
/**
* Restore the closure after serialization.
*
* @param array $signature
* @param array{serializable: string, hash: string} $signature
* @return void
*
* @throws \Laravel\SerializableClosure\Exceptions\InvalidSignatureException
Expand Down
2 changes: 1 addition & 1 deletion laravel/serializable-closure/src/Signers/Hmac.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function sign($serialized)
/**
* Verify the given signature.
*
* @param array $signature
* @param array{serializable: string, hash: string} $signature
* @return bool
*/
public function verify($signature)
Expand Down
2 changes: 2 additions & 0 deletions laravel/serializable-closure/src/Support/ClosureStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class ClosureStream
{
/**
* The stream protocol.
*
* @var string
*/
const STREAM_PROTO = 'laravel-serializable-closure';

Expand Down
Loading