Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
php = "8.5"
3 changes: 3 additions & 0 deletions src/Option/None.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Closure;
use EmptyIterator;
use NoDiscard;
use Override;
use RuntimeException;
use Throwable;
Expand Down Expand Up @@ -78,12 +79,14 @@
$this->expect('Unwrapping a `None` value');
}

#[NoDiscard]

Check failure on line 82 in src/Option/None.php

View workflow job for this annotation

GitHub Actions / PHPStan and PHPUnit (PHP 8.4 on ubuntu-latest)

Attribute class NoDiscard does not exist.
#[Override]
public function unwrapOr(mixed $default): mixed
{
return $default;
}

#[NoDiscard]

Check failure on line 89 in src/Option/None.php

View workflow job for this annotation

GitHub Actions / PHPStan and PHPUnit (PHP 8.4 on ubuntu-latest)

Attribute class NoDiscard does not exist.
#[Override]
public function unwrapOrElse(Closure $default): mixed
{
Expand Down
5 changes: 5 additions & 0 deletions src/Option/Some.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace WizDevelop\PhpMonad\Option;

use Closure;
use NoDiscard;
use Override;
use Throwable;
use Traversable;
Expand Down Expand Up @@ -80,6 +81,7 @@
/**
* @throws void
*/
#[NoDiscard]

Check failure on line 84 in src/Option/Some.php

View workflow job for this annotation

GitHub Actions / PHPStan and PHPUnit (PHP 8.4 on ubuntu-latest)

Attribute class NoDiscard does not exist.
#[Override]
public function unwrap(): mixed
{
Expand All @@ -89,6 +91,7 @@
/**
* @return T
*/
#[NoDiscard]

Check failure on line 94 in src/Option/Some.php

View workflow job for this annotation

GitHub Actions / PHPStan and PHPUnit (PHP 8.4 on ubuntu-latest)

Attribute class NoDiscard does not exist.
#[Override]
public function unwrapOr(mixed $default): mixed
{
Expand All @@ -98,6 +101,7 @@
/**
* @return T
*/
#[NoDiscard]

Check failure on line 104 in src/Option/Some.php

View workflow job for this annotation

GitHub Actions / PHPStan and PHPUnit (PHP 8.4 on ubuntu-latest)

Attribute class NoDiscard does not exist.
#[Override]
public function unwrapOrElse(Closure $default): mixed
{
Expand All @@ -110,6 +114,7 @@
* @return T
* @throws never
*/
#[NoDiscard]

Check failure on line 117 in src/Option/Some.php

View workflow job for this annotation

GitHub Actions / PHPStan and PHPUnit (PHP 8.4 on ubuntu-latest)

Attribute class NoDiscard does not exist.
#[Override]
public function unwrapOrThrow(Throwable $exception): mixed
{
Expand Down
4 changes: 4 additions & 0 deletions src/Result/Err.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Closure;
use EmptyIterator;
use NoDiscard;
use Override;
use RuntimeException;
use Throwable;
Expand Down Expand Up @@ -103,6 +104,7 @@
/**
* @return E
*/
#[NoDiscard]

Check failure on line 107 in src/Result/Err.php

View workflow job for this annotation

GitHub Actions / PHPStan and PHPUnit (PHP 8.4 on ubuntu-latest)

Attribute class NoDiscard does not exist.
#[Override]
public function unwrapErr(): mixed
{
Expand All @@ -114,6 +116,7 @@
* @param U $default
* @return U
*/
#[NoDiscard]

Check failure on line 119 in src/Result/Err.php

View workflow job for this annotation

GitHub Actions / PHPStan and PHPUnit (PHP 8.4 on ubuntu-latest)

Attribute class NoDiscard does not exist.
#[Override]
public function unwrapOr(mixed $default): mixed
{
Expand All @@ -125,6 +128,7 @@
* @param Closure(E): U $default
* @return U
*/
#[NoDiscard]

Check failure on line 131 in src/Result/Err.php

View workflow job for this annotation

GitHub Actions / PHPStan and PHPUnit (PHP 8.4 on ubuntu-latest)

Attribute class NoDiscard does not exist.
#[Override]
public function unwrapOrElse(Closure $default): mixed
{
Expand Down
5 changes: 5 additions & 0 deletions src/Result/Ok.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace WizDevelop\PhpMonad\Result;

use Closure;
use NoDiscard;
use Override;
use RuntimeException;
use Throwable;
Expand Down Expand Up @@ -92,6 +93,7 @@
/**
* @return T
*/
#[NoDiscard]

Check failure on line 96 in src/Result/Ok.php

View workflow job for this annotation

GitHub Actions / PHPStan and PHPUnit (PHP 8.4 on ubuntu-latest)

Attribute class NoDiscard does not exist.
#[Override]
public function unwrap(): mixed
{
Expand All @@ -107,12 +109,14 @@
throw new RuntimeException(sprintf('Unwrapping err on `Ok`: %s', serialize($this->value)));
}

#[NoDiscard]
#[Override]
public function unwrapOr(mixed $default): mixed
{
return $this->value;
}

#[NoDiscard]
#[Override]
public function unwrapOrElse(Closure $default): mixed
{
Expand All @@ -125,6 +129,7 @@
* @return T
* @throws never
*/
#[NoDiscard]
#[Override]
public function unwrapOrThrow(Throwable $exception): mixed
{
Expand Down
2 changes: 0 additions & 2 deletions tests/Unit/Option/OrThrowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#[TestDox('Option - OrThrow メソッドのテスト')]
#[CoversClass(Option::class)]
#[CoversClass(Option\Some::class)]
#[CoversClass(Option\None::class)]
final class OrThrowTest extends TestCase
{
#[Test]
Expand Down
2 changes: 0 additions & 2 deletions tests/Unit/Result/OrThrowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#[TestDox('Result - OrThrow メソッドのテスト')]
#[CoversClass(Result::class)]
#[CoversClass(Result\Ok::class)]
#[CoversClass(Result\Err::class)]
final class OrThrowTest extends TestCase
{
#[Test]
Expand Down
Loading