public static function of($object) { if ($object === null) { throw new InvalidArgumentException('Object cannot be null. Use fromNullable if you want to pass null.'); } return new self($object); }
/** * @test */ public function shouldFlattenNullValue() { //given $optional = Optional::of(Optional::of(Optional::fromNullable(null))); //when $result = $optional->flatten()->orNull(); //then Assert::that($result)->isNull(); }