Skip to content

Commit

Permalink
Merge pull request #30 from spatie/analysis-WN2Evj
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
freekmurze committed Apr 28, 2020
2 parents e7daa24 + d816a5a commit d6eb77f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Hex.php
Expand Up @@ -22,7 +22,7 @@ public static function fromString(string $string)
{
Validate::hexColorString($string);

list($red, $green, $blue) = str_split(ltrim($string, '#'), 2);
[$red, $green, $blue] = str_split(ltrim($string, '#'), 2);

return new static($red, $green, $blue);
}
Expand All @@ -42,7 +42,7 @@ public function blue(): string
return $this->blue;
}

public function toHex(): Hex
public function toHex(): self
{
return new self($this->red, $this->green, $this->blue);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Rgb.php
Expand Up @@ -26,7 +26,7 @@ public static function fromString(string $string)
preg_match('/rgb\( *(\d{1,3} *, *\d{1,3} *, *\d{1,3}) *\)/i', $string, $matches);

$channels = explode(',', $matches[1]);
list($red, $green, $blue) = array_map('trim', $channels);
[$red, $green, $blue] = array_map('trim', $channels);

return new static($red, $green, $blue);
}
Expand Down Expand Up @@ -55,7 +55,7 @@ public function toHex(): Hex
);
}

public function toRgb(): Rgb
public function toRgb(): self
{
return new self($this->red, $this->green, $this->blue);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Rgba.php
Expand Up @@ -31,7 +31,7 @@ public static function fromString(string $string)
preg_match('/rgba\( *(\d{1,3} *, *\d{1,3} *, *\d{1,3} *, *[0-1](\.\d{1,2})?) *\)/i', $string, $matches);

$channels = explode(',', $matches[1]);
list($red, $green, $blue, $alpha) = array_map('trim', $channels);
[$red, $green, $blue, $alpha] = array_map('trim', $channels);

return new static($red, $green, $blue, $alpha);
}
Expand Down Expand Up @@ -66,7 +66,7 @@ public function toRgb(): Rgb
return new Rgb($this->red, $this->green, $this->blue);
}

public function toRgba(float $alpha = 1): Rgba
public function toRgba(float $alpha = 1): self
{
return new self($this->red, $this->green, $this->blue, $alpha);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/FactoryTest.php
Expand Up @@ -2,12 +2,12 @@

namespace Spatie\Color\Test;

use PHPUnit\Framework\TestCase;
use Spatie\Color\Exceptions\InvalidColorValue;
use Spatie\Color\Factory;
use Spatie\Color\Hex;
use Spatie\Color\Rgb;
use Spatie\Color\Rgba;
use Spatie\Color\Factory;
use PHPUnit\Framework\TestCase;
use Spatie\Color\Exceptions\InvalidColorValue;

class FactoryTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/HexTest.php
Expand Up @@ -2,9 +2,9 @@

namespace Spatie\Color\Test;

use Spatie\Color\Hex;
use PHPUnit\Framework\TestCase;
use Spatie\Color\Exceptions\InvalidColorValue;
use Spatie\Color\Hex;

class HexTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/RgbTest.php
Expand Up @@ -2,9 +2,9 @@

namespace Spatie\Color\Test;

use Spatie\Color\Rgb;
use PHPUnit\Framework\TestCase;
use Spatie\Color\Exceptions\InvalidColorValue;
use Spatie\Color\Rgb;

class RgbTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/RgbaTest.php
Expand Up @@ -2,9 +2,9 @@

namespace Spatie\Color\Test;

use Spatie\Color\Rgba;
use PHPUnit\Framework\TestCase;
use Spatie\Color\Exceptions\InvalidColorValue;
use Spatie\Color\Rgba;

class RgbaTest extends TestCase
{
Expand Down

0 comments on commit d6eb77f

Please sign in to comment.