1
0
mirror of https://github.com/danog/amp.git synced 2024-12-13 09:57:25 +01:00
amp/lib/YieldedValue.php
Aaron Piotrowski d496c9db24
Resolve promise with YieldedValue
A suggested alternative to resolving with [$yieldedValue] since static analysis (specifically Psalm) doesn't play well with that API.

Will revert if Psalm changes or we decide to resolve with [$yieldedValue] anyway.
2020-09-24 12:53:29 -05:00

29 lines
370 B
PHP

<?php
namespace Amp;
/**
* @template-covariant TValue
*/
final class YieldedValue
{
/** @var TValue */
private $value;
/**
* @param TValue $value
*/
public function __construct($value)
{
$this->value = $value;
}
/**
* @return TValue
*/
public function unwrap()
{
return $this->value;
}
}