1 | <?php |
||
19 | abstract class Assert |
||
20 | { |
||
21 | /** @var string */ |
||
22 | protected static $lazyAssertionExceptionClass = 'Assert\LazyAssertionException'; |
||
23 | |||
24 | /** @var string */ |
||
25 | protected static $assertionClass = 'Assert\Assertion'; |
||
26 | |||
27 | /** |
||
28 | * Start validation on a value, returns {@link AssertionChain} |
||
29 | * |
||
30 | * The invocation of this method starts an assertion chain |
||
31 | * that is happening on the passed value. |
||
32 | * |
||
33 | * @example |
||
34 | * |
||
35 | * Assert::that($value)->notEmpty()->integer(); |
||
36 | * Assert::that($value)->nullOr()->string()->startsWith("Foo"); |
||
37 | * |
||
38 | * The assertion chain can be stateful, that means be careful when you reuse |
||
39 | * it. You should never pass around the chain. |
||
40 | * |
||
41 | * @param mixed $value |
||
42 | * @param string $defaultMessage |
||
|
|||
43 | * @param string $defaultPropertyPath |
||
44 | * |
||
45 | * @return \Assert\AssertionChain |
||
46 | */ |
||
47 | public static function that($value, $defaultMessage = null, $defaultPropertyPath = null) |
||
54 | |||
55 | /** |
||
56 | * Start validation on a set of values, returns {@link AssertionChain} |
||
57 | * |
||
58 | * @param mixed $values |
||
59 | * @param string $defaultMessage |
||
60 | * @param string $defaultPropertyPath |
||
61 | * |
||
62 | * @return \Assert\AssertionChain |
||
63 | */ |
||
64 | public static function thatAll($values, $defaultMessage = null, $defaultPropertyPath = null) |
||
68 | |||
69 | /** |
||
70 | * Start validation and allow NULL, returns {@link AssertionChain} |
||
71 | * |
||
72 | * @param mixed $value |
||
73 | * @param string $defaultMessage |
||
74 | * @param string $defaultPropertyPath |
||
75 | * |
||
76 | * @return \Assert\AssertionChain |
||
77 | */ |
||
78 | public static function thatNullOr($value, $defaultMessage = null, $defaultPropertyPath = null) |
||
82 | |||
83 | /** |
||
84 | * Create a lazy assertion object. |
||
85 | * |
||
86 | * @return \Assert\LazyAssertion |
||
87 | */ |
||
88 | public static function lazy() |
||
95 | } |
||
96 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.