-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
248 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Typhoon\Reflection\Metadata; | ||
|
||
/** | ||
* @internal | ||
* @psalm-internal Typhoon\Reflection | ||
* @template TMetadata of RootMetadata | ||
*/ | ||
final class MetadataCacheItem | ||
{ | ||
/** | ||
* @param TMetadata|\Closure(): TMetadata $metadata | ||
*/ | ||
public function __construct( | ||
private RootMetadata|\Closure $metadata, | ||
) {} | ||
|
||
/** | ||
* @return TMetadata | ||
*/ | ||
public function get(): RootMetadata | ||
{ | ||
if ($this->metadata instanceof \Closure) { | ||
$this->metadata = ($this->metadata)(); | ||
} | ||
|
||
return $this->metadata; | ||
} | ||
|
||
public function changed(): bool | ||
{ | ||
return $this->get()->changeDetector->changed(); | ||
} | ||
|
||
public function __serialize(): array | ||
{ | ||
return ['metadata' => $this->get()]; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.