Parameters which have default values should be placed at the end.
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:
// $a must always be passed; it's default value is never used.functionsomeFunction($a=5,$b){}
Loading history...
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()
41
{
42
return $this->propertyPath;
43
}
44
45
/**
46
* Get the value that caused the assertion to fail.
47
*
48
* @return mixed
49
*/
50
public function getValue()
51
{
52
return $this->value;
53
}
54
55
/**
56
* Get the constraints that applied to the failed assertion.
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: