File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Tests/Utils/PassedParameters Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,8 @@ public function testGetParameterFunctionCallPositionalMissingParamName()
108108 }
109109
110110 /**
111- * Test retrieving the parameter details from a function call with only named parameters
112- * without passing a valid name.
111+ * Test receiving an expected exception when trying to retrieve the parameter details
112+ * from a function call with only named parameters without passing a valid name.
113113 *
114114 * @return void
115115 */
@@ -124,6 +124,24 @@ public function testGetParameterFunctionCallMissingParamName()
124124 PassedParameters::getParameter (self ::$ phpcsFile , $ stackPtr , 2 );
125125 }
126126
127+ /**
128+ * Test receiving an expected exception when trying to retrieve the parameter details
129+ * from a function call with only positional parameters without passing a valid name with
130+ * the requested parameter offset not being set.
131+ *
132+ * @return void
133+ */
134+ public function testGetParameterFunctionCallPositionalMissingParamNameNonExistentParam ()
135+ {
136+ $ this ->expectPhpcsException (
137+ 'To allow for support for PHP 8 named parameters, the $paramNames parameter must be passed. '
138+ );
139+
140+ $ stackPtr = $ this ->getTargetToken ('/* testAllParamsPositional */ ' , \T_STRING );
141+
142+ PassedParameters::getParameter (self ::$ phpcsFile , $ stackPtr , 10 );
143+ }
144+
127145 /**
128146 * Test retrieving the details for a specific parameter from a function call or construct.
129147 *
You can’t perform that action at this time.
0 commit comments