Skip to content

Commit 4d0b0d9

Browse files
authored
Merge pull request #21 from Innmind/no-discard
Add `NoDiscard` attributes
2 parents 887e51e + 1e2f062 commit 4d0b0d9

5 files changed

Lines changed: 13 additions & 0 deletions

File tree

psalm.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
<directory name="vendor" />
1515
</ignoreFiles>
1616
</projectFiles>
17+
<issueHandlers>
18+
<UndefinedAttributeClass errorLevel="suppress" />
19+
</issueHandlers>
1720
</psalm>

src/Continuation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ private function __construct(
2929
*
3030
* @return self<A>
3131
*/
32+
#[\NoDiscard]
3233
public static function of(mixed $value): self
3334
{
3435
return new self(State::continue, $value);
@@ -41,6 +42,7 @@ public static function of(mixed $value): self
4142
*
4243
* @return self<U>
4344
*/
45+
#[\NoDiscard]
4446
public function continue(mixed $value): self
4547
{
4648
return new self(State::continue, $value);
@@ -53,6 +55,7 @@ public function continue(mixed $value): self
5355
*
5456
* @return self<U>
5557
*/
58+
#[\NoDiscard]
5659
public function stop(mixed $value): self
5760
{
5861
return new self(State::stop, $value);
@@ -67,6 +70,7 @@ public function stop(mixed $value): self
6770
*
6871
* @return R
6972
*/
73+
#[\NoDiscard]
7074
public function match(
7175
callable $continue,
7276
callable $stop,

src/Factory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
final class Factory
1313
{
14+
#[\NoDiscard]
1415
public static function build(
1516
Processes $processes,
1617
Halt $halt,

src/Ping.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ private function __construct(
2121
*
2222
* @return Attempt<R|C>
2323
*/
24+
#[\NoDiscard]
2425
public function __invoke(mixed $carry, callable $ping): Attempt
2526
{
2627
return ($this->implementation)($carry, $ping);
@@ -29,6 +30,7 @@ public function __invoke(mixed $carry, callable $ping): Attempt
2930
/**
3031
* @internal
3132
*/
33+
#[\NoDiscard]
3234
public static function of(Ping\Implementation $implementation): self
3335
{
3436
return new self($implementation);

src/Watch.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ private function __construct(
2626
) {
2727
}
2828

29+
#[\NoDiscard]
2930
public function __invoke(Path $file): Ping
3031
{
3132
return Ping::of(($this->implementation)($file));
3233
}
3334

35+
#[\NoDiscard]
3436
public static function of(
3537
Processes $processes,
3638
Halt $halt,
@@ -54,6 +56,7 @@ public static function of(
5456
);
5557
}
5658

59+
#[\NoDiscard]
5760
public static function logger(self $watch, LoggerInterface $logger): self
5861
{
5962
return new self(Logger::psr(

0 commit comments

Comments
 (0)