File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ public function __toString()
115
115
. ($ param ->isReference () ? '& ' : '' )
116
116
. ($ variadic ? '... ' : '' )
117
117
. '$ ' . $ param ->getName ()
118
- . ($ param ->isOptional () && !$ variadic ? ' = ' . Helpers::dump ($ param ->defaultValue ) : '' );
118
+ . ($ param ->hasDefaultValue () && !$ variadic ? ' = ' . Helpers::dump ($ param ->defaultValue ) : '' );
119
119
}
120
120
$ uses = [];
121
121
foreach ($ this ->uses as $ param ) {
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class Parameter
27
27
private $ typeHint ;
28
28
29
29
/** @var bool */
30
- private $ optional = FALSE ;
30
+ private $ hasDefaultValue = FALSE ;
31
31
32
32
/** @var mixed */
33
33
public $ defaultValue ;
@@ -55,7 +55,7 @@ public static function from(\ReflectionParameter $from)
55
55
}
56
56
}
57
57
}
58
- $ param ->optional = $ from ->isDefaultValueAvailable ();
58
+ $ param ->hasDefaultValue = $ from ->isDefaultValueAvailable ();
59
59
$ param ->defaultValue = $ from ->isDefaultValueAvailable () ? $ from ->getDefaultValue () : NULL ;
60
60
return $ param ;
61
61
}
@@ -133,17 +133,18 @@ public function getTypeHint()
133
133
*/
134
134
public function setOptional ($ state = TRUE )
135
135
{
136
- $ this ->optional = (bool ) $ state ;
136
+ $ this ->hasDefaultValue = (bool ) $ state ;
137
137
return $ this ;
138
138
}
139
139
140
140
141
141
/**
142
+ * @deprecated use hasDefaultValue()
142
143
* @return bool
143
144
*/
144
145
public function isOptional ()
145
146
{
146
- return $ this ->optional ;
147
+ return $ this ->hasDefaultValue ;
147
148
}
148
149
149
150
@@ -165,4 +166,13 @@ public function getDefaultValue()
165
166
return $ this ->defaultValue ;
166
167
}
167
168
169
+
170
+ /**
171
+ * @return bool
172
+ */
173
+ public function hasDefaultValue ()
174
+ {
175
+ return $ this ->hasDefaultValue ;
176
+ }
177
+
168
178
}
You can’t perform that action at this time.
0 commit comments