@@ -62,7 +62,7 @@ public function setParent($parent)
62
62
* If replaceArgument() has been used to replace an argument, this method
63
63
* will return the replacement value.
64
64
*
65
- * @param int $index
65
+ * @param int|string $index
66
66
*
67
67
* @return mixed The argument value
68
68
*
@@ -74,13 +74,7 @@ public function getArgument($index)
74
74
return $ this ->arguments ['index_ ' .$ index ];
75
75
}
76
76
77
- $ lastIndex = count (array_filter (array_keys ($ this ->arguments ), 'is_int ' )) - 1 ;
78
-
79
- if ($ index < 0 || $ index > $ lastIndex ) {
80
- throw new OutOfBoundsException (sprintf ('The index "%d" is not in the range [0, %d]. ' , $ index , $ lastIndex ));
81
- }
82
-
83
- return $ this ->arguments [$ index ];
77
+ return parent ::getArgument ($ index );
84
78
}
85
79
86
80
/**
@@ -91,8 +85,8 @@ public function getArgument($index)
91
85
* certain conventions when you want to overwrite the arguments of the
92
86
* parent definition, otherwise your arguments will only be appended.
93
87
*
94
- * @param int $index
95
- * @param mixed $value
88
+ * @param int|string $index
89
+ * @param mixed $value
96
90
*
97
91
* @return self the current instance
98
92
*
@@ -105,7 +99,7 @@ public function replaceArgument($index, $value)
105
99
} elseif (0 === strpos ($ index , '$ ' )) {
106
100
$ this ->arguments [$ index ] = $ value ;
107
101
} else {
108
- throw new InvalidArgumentException ('$index must be an integer . ' );
102
+ throw new InvalidArgumentException ('The argument must be an existing index or the name of a constructor \' s parameter . ' );
109
103
}
110
104
111
105
return $ this ;
0 commit comments