Optional::isEqualTo()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
1
<?php
2
3
namespace Dgame\Optional;
4
5
/**
6
 * Interface Optional
7
 * @package Dgame\Optional
8
 */
9
interface Optional
10
{
11
    /**
12
     * @param mixed $value
13
     *
14
     * @return bool
15
     */
16
    public function isSome(&$value = null): bool;
17
18
    /**
19
     * @return bool
20
     */
21
    public function isNone(): bool;
22
23
    /**
24
     * @return mixed
25
     */
26
    public function unwrap();
27
28
    /**
29
     * @param mixed $value
30
     *
31
     * @return mixed
32
     */
33
    public function default($value);
34
35
    /**
36
     * @param callable $callback
37
     *
38
     * @return Optional
0 ignored issues
show
Documentation introduced by
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
39
     */
40
    public function ensure(callable $callback): self;
41
42
    /**
43
     * @return Optional
0 ignored issues
show
Documentation introduced by
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
44
     */
45
    public function ensureNotFalse(): self;
46
47
    /**
48
     * @param mixed $value
49
     *
50
     * @return bool
51
     */
52
    public function isEqualTo($value): bool;
53
54
    /**
55
     * @param mixed $value
56
     *
57
     * @return bool
58
     */
59
    public function isNotEqualTo($value): bool;
60
61
    /**
62
     * @param mixed $value
63
     *
64
     * @return bool
65
     */
66
    public function isIdenticalTo($value): bool;
67
68
    /**
69
     * @param mixed $value
70
     *
71
     * @return bool
72
     */
73
    public function isNotIdenticalTo($value): bool;
74
75
    /**
76
     * @param callable $callback
77
     */
78
    public function do(callable $callback);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
79
}
80