mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 01:07:23 +01:00
wip toward lvl9
This commit is contained in:
@ -41,11 +41,13 @@ final class Container
|
||||
*/
|
||||
public function get(string $id)
|
||||
{
|
||||
if (array_key_exists($id, $this->instances)) {
|
||||
return $this->instances[$id];
|
||||
if (!array_key_exists($id, $this->instances)) {
|
||||
$this->instances[$id] = $this->build($id);
|
||||
}
|
||||
|
||||
$this->instances[$id] = $this->build($id);
|
||||
if (!is_object($this->instances[$id])) {
|
||||
throw ShouldNotHappen::fromMessage('Cannot resolve a non-object from container');
|
||||
}
|
||||
|
||||
return $this->instances[$id];
|
||||
}
|
||||
|
||||
@ -50,6 +50,8 @@ final class ExceptionTrace
|
||||
|
||||
$property = new ReflectionProperty($t, 'serializableTrace');
|
||||
$property->setAccessible(true);
|
||||
|
||||
/** @var array<array<string>> $trace */
|
||||
$trace = $property->getValue($t);
|
||||
|
||||
$cleanedTrace = [];
|
||||
|
||||
@ -31,7 +31,10 @@ final class HigherOrderCallables
|
||||
*/
|
||||
public function expect(mixed $value): Expectation
|
||||
{
|
||||
return new Expectation($value instanceof Closure ? Reflection::bindCallableWithData($value) : $value);
|
||||
/** @var TValue $value */
|
||||
$value = $value instanceof Closure ? Reflection::bindCallableWithData($value) : $value;
|
||||
|
||||
return new Expectation($value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user