php-src/ext/standard/tests/array/array_fill_error.phpt
Larry Garfield 96f2f3174b Update array parameter names for named parameters
* The array "subject" of a function gets called $array.

* Further parameters should be self-descriptive if used
  as a named parameter, and a full word, not an abbreviation.

* If there is a "bunch more arrays" variadic, it gets
  called $arrays (because that's what was already there).

* A few functions have a variadic "a bunch more arrays,
  and then a callable", and were already called $rest.
  I left those as is and died a little inside.

* Any callable provided to an array function that acts
  on the array is called $callback. (Nearly all were already,
  I just fixed the one or two outliers.)

* array_multisort() is beyond help so I ran screaming.
2020-09-14 14:56:49 +00:00

21 lines
482 B
PHP

--TEST--
Test array_fill() function : error conditions
--FILE--
<?php
echo "*** Testing array_fill() : error conditions ***\n";
// calling array_fill with negative values for 'num' parameter
$start_key = 0;
$num = -1;
$val = 1;
try {
var_dump( array_fill($start_key,$num,$val) );
} catch (\ValueError $e) {
echo $e->getMessage() . "\n";
}
?>
--EXPECT--
*** Testing array_fill() : error conditions ***
array_fill(): Argument #2 ($count) must be greater than or equal to 0