mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-22 19:06:35 +00:00
Color: make mix() first parameter mandatory, closes #3204
This commit is contained in:
parent
60154d8127
commit
2ff25dfbd2
@ -769,6 +769,7 @@ This version features substantial changes to the network system, improving coher
|
|||||||
- `Utils::$online`
|
- `Utils::$online`
|
||||||
- `Utils::$os`
|
- `Utils::$os`
|
||||||
- The following API methods have signature changes:
|
- 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`.
|
- `Internet::simpleCurl()` now requires a `Closure` for its `onSuccess` parameter instead of `callable`.
|
||||||
- The following API methods have been removed:
|
- The following API methods have been removed:
|
||||||
- `Color->setA()`
|
- `Color->setA()`
|
||||||
|
@ -79,15 +79,14 @@ final class Color{
|
|||||||
/**
|
/**
|
||||||
* Mixes the supplied list of colours together to produce a result colour.
|
* Mixes the supplied list of colours together to produce a result colour.
|
||||||
*
|
*
|
||||||
|
* @param Color $color1
|
||||||
* @param Color ...$colors
|
* @param Color ...$colors
|
||||||
*
|
*
|
||||||
* @return Color
|
* @return Color
|
||||||
*/
|
*/
|
||||||
public static function mix(Color ...$colors) : Color{
|
public static function mix(Color $color1, Color ...$colors) : Color{
|
||||||
|
$colors[] = $color1;
|
||||||
$count = count($colors);
|
$count = count($colors);
|
||||||
if($count < 1){
|
|
||||||
throw new \ArgumentCountError("No colors given");
|
|
||||||
}
|
|
||||||
|
|
||||||
$a = $r = $g = $b = 0;
|
$a = $r = $g = $b = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user