Skip to content

Commit a448b24

Browse files
authored
TrinaryLogic: detect logic errors
1 parent d532879 commit a448b24

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

src/TrinaryLogic.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,28 @@ private static function create(int $value): self
5353
return self::$registry[$value];
5454
}
5555

56+
/**
57+
* @phpstan-assert-if-true =false $this->no()
58+
* @phpstan-assert-if-true =false $this->maybe()
59+
*/
5660
public function yes(): bool
5761
{
5862
return $this->value === self::YES;
5963
}
6064

65+
/**
66+
* @phpstan-assert-if-true =false $this->no()
67+
* @phpstan-assert-if-true =false $this->yes()
68+
*/
6169
public function maybe(): bool
6270
{
6371
return $this->value === self::MAYBE;
6472
}
6573

74+
/**
75+
* @phpstan-assert-if-true =false $this->maybe()
76+
* @phpstan-assert-if-true =false $this->yes()
77+
*/
6678
public function no(): bool
6779
{
6880
return $this->value === self::NO;

src/Type/AcceptsResult.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,28 @@ public function __construct(
2626
{
2727
}
2828

29+
/**
30+
* @phpstan-assert-if-true =false $this->no()
31+
* @phpstan-assert-if-true =false $this->maybe()
32+
*/
2933
public function yes(): bool
3034
{
3135
return $this->result->yes();
3236
}
3337

38+
/**
39+
* @phpstan-assert-if-true =false $this->no()
40+
* @phpstan-assert-if-true =false $this->yes()
41+
*/
3442
public function maybe(): bool
3543
{
3644
return $this->result->maybe();
3745
}
3846

47+
/**
48+
* @phpstan-assert-if-true =false $this->maybe()
49+
* @phpstan-assert-if-true =false $this->yes()
50+
*/
3951
public function no(): bool
4052
{
4153
return $this->result->no();

src/Type/IsSuperTypeOfResult.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,28 @@ public function __construct(
2626
{
2727
}
2828

29+
/**
30+
* @phpstan-assert-if-true =false $this->no()
31+
* @phpstan-assert-if-true =false $this->maybe()
32+
*/
2933
public function yes(): bool
3034
{
3135
return $this->result->yes();
3236
}
3337

38+
/**
39+
* @phpstan-assert-if-true =false $this->no()
40+
* @phpstan-assert-if-true =false $this->yes()
41+
*/
3442
public function maybe(): bool
3543
{
3644
return $this->result->maybe();
3745
}
3846

47+
/**
48+
* @phpstan-assert-if-true =false $this->maybe()
49+
* @phpstan-assert-if-true =false $this->yes()
50+
*/
3951
public function no(): bool
4052
{
4153
return $this->result->no();

0 commit comments

Comments
 (0)