Permalink
Browse files

drop PHP 5.3 compatibility and use short array syntax

  • Loading branch information...
1 parent 838b828 commit 941634bd4faf92f7859b3339a4f59ee3b1b3872d @MatTheCat MatTheCat committed Jan 12, 2016
View
@@ -7,6 +7,8 @@ $finder = \Symfony\Component\Finder\Finder::create()
$config = Symfony\CS\Config\Config::create()
->finder($finder)
+ ->level(\Symfony\CS\FixerInterface::SYMFONY_LEVEL)
+ ->fixers(array('short_array_syntax'))
->setUsingCache(true);
return $config;
View
@@ -1,7 +1,6 @@
language: php
php:
- - 5.3
- 5.4
- 5.5
- 5.6
View
@@ -17,7 +17,7 @@
}
],
"require": {
- "php": ">=5.3.0",
+ "php": ">=5.4.0",
"ext-gd": "*"
},
"require-dev": {
@@ -72,8 +72,8 @@ protected function initialize()
protected static function mergeColors(\SplFixedArray $colors, $limit, $maxDelta)
{
$limit = min(count($colors), $limit);
- $labCache = array();
- $mergedColors = array();
+ $labCache = [];
+ $mergedColors = [];
foreach ($colors as $i => $color) {
if (empty($mergedColors)) {
@@ -189,11 +189,11 @@ protected static function intColorToLab($color)
return self::xyzToLab(
self::srgbToXyz(
self::rgbToSrgb(
- array(
+ [
'R' => ($color >> 16) & 0xFF,
'G' => ($color >> 8) & 0xFF,
'B' => $color & 0xFF,
- )
+ ]
)
)
);
@@ -220,11 +220,11 @@ protected static function rgbToSrgbStep($value)
*/
protected static function rgbToSrgb($rgb)
{
- return array(
+ return [
'R' => self::rgbToSrgbStep($rgb['R']),
'G' => self::rgbToSrgbStep($rgb['G']),
'B' => self::rgbToSrgbStep($rgb['B']),
- );
+ ];
}
/**
@@ -234,11 +234,11 @@ protected static function rgbToSrgb($rgb)
*/
protected static function srgbToXyz($rgb)
{
- return array(
+ return [
'X' => (.4124564 * $rgb['R']) + (.3575761 * $rgb['G']) + (.1804375 * $rgb['B']),
'Y' => (.2126729 * $rgb['R']) + (.7151522 * $rgb['G']) + (.0721750 * $rgb['B']),
'Z' => (.0193339 * $rgb['R']) + (.1191920 * $rgb['G']) + (.9503041 * $rgb['B']),
- );
+ ];
}
/**
@@ -264,10 +264,10 @@ protected static function xyzToLab($xyz)
$Zn = 1.08883;
// http://en.wikipedia.org/wiki/Lab_color_space#CIELAB-CIEXYZ_conversions
- return array(
+ return [
'L' => 116 * self::xyzToLabStep($xyz['Y'] / $Yn) - 16,
'a' => 500 * (self::xyzToLabStep($xyz['X'] / $Xn) - self::xyzToLabStep($xyz['Y'] / $Yn)),
'b' => 200 * (self::xyzToLabStep($xyz['Y'] / $Yn) - self::xyzToLabStep($xyz['Z'] / $Zn)),
- );
+ ];
}
}
@@ -71,7 +71,7 @@ public static function fromGD($image)
$areColorsIndexed = !imageistruecolor($image);
$imageWidth = imagesx($image);
$imageHeight = imagesy($image);
- $palette->colors = array();
+ $palette->colors = [];
for ($x = 0; $x < $imageWidth; ++$x) {
for ($y = 0; $y < $imageHeight; ++$y) {
@@ -94,6 +94,6 @@ public static function fromGD($image)
protected function __construct()
{
- $this->colors = array();
+ $this->colors = [];
}
}
@@ -49,6 +49,6 @@ public function testJpegExtractMultipleColors()
$this->assertInternalType('array', $colors);
$this->assertCount($numColors, $colors);
- $this->assertEquals($colors, array(14024704, 3407872, 15118468));
+ $this->assertEquals($colors, [14024704, 3407872, 15118468]);
}
}

0 comments on commit 941634b

Please sign in to comment.