Color: make mix() first parameter mandatory, closes #3204

This commit is contained in:
Dylan K. Taylor 2019-12-04 18:39:14 +00:00
parent 60154d8127
commit 2ff25dfbd2
2 changed files with 4 additions and 4 deletions

View File

@ -769,6 +769,7 @@ This version features substantial changes to the network system, improving coher
- `Utils::$online`
- `Utils::$os`
- The following API methods have signature changes:
- `Color::mix()` now requires the first parameter. Previously, it was possible to pass zero arguments, which would raise an `ArgumentCountError` (not static analysis friendly).
- `Internet::simpleCurl()` now requires a `Closure` for its `onSuccess` parameter instead of `callable`.
- The following API methods have been removed:
- `Color->setA()`

View File

@ -79,15 +79,14 @@ final class Color{
/**
* Mixes the supplied list of colours together to produce a result colour.
*
* @param Color $color1
* @param Color ...$colors
*
* @return Color
*/
public static function mix(Color ...$colors) : Color{
public static function mix(Color $color1, Color ...$colors) : Color{
$colors[] = $color1;
$count = count($colors);
if($count < 1){
throw new \ArgumentCountError("No colors given");
}
$a = $r = $g = $b = 0;