1 | <?php |
||
16 | class InvalidArgumentException extends \InvalidArgumentException implements AssertionFailedException |
||
17 | { |
||
18 | private $propertyPath; |
||
19 | private $value; |
||
20 | private $constraints; |
||
21 | |||
22 | public function __construct($message, $code, $propertyPath = null, $value, array $constraints = array()) |
||
|
|||
23 | { |
||
24 | parent::__construct($message, $code); |
||
25 | |||
26 | $this->propertyPath = $propertyPath; |
||
27 | $this->value = $value; |
||
28 | $this->constraints = $constraints; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * User controlled way to define a sub-property causing |
||
33 | * the failure of a currently asserted objects. |
||
34 | * |
||
35 | * Useful to transport information about the nature of the error |
||
36 | * back to higher layers. |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | public function getPropertyPath() |
||
44 | |||
45 | /** |
||
46 | * Get the value that caused the assertion to fail. |
||
47 | * |
||
48 | * @return mixed |
||
49 | */ |
||
50 | public function getValue() |
||
54 | |||
55 | /** |
||
56 | * Get the constraints that applied to the failed assertion. |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | public function getConstraints() |
||
64 | } |
||
65 | |||
66 |
If you place a parameter with a default value before a parameter with a default value, the default value of the first parameter will never be used as it will always need to be passed anyway: