Skip to content

Commit

Permalink
Force consistency with an editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Jun 2, 2020
1 parent d8546e4 commit 77bba83
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 20 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
12 changes: 6 additions & 6 deletions src/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct($red = 0, $green = 0, $blue = 0, $alpha = null)
* @return Color
* @todo Add parsing of CSS-like strings: rgb(), rgba(), hsl()
*/
public static function parseString($str)
public static function parseString($str): Color
{
$str = str_replace('#', '', $str);
if (strlen($str) == 6) {
Expand All @@ -71,7 +71,7 @@ public static function parseString($str)
* @param float $l Light
* @return Color
*/
public static function fromHsl($h, $s, $l)
public static function fromHsl($h, $s, $l): Color
{
$fromFloat = function (array $rgb) {
foreach ($rgb as &$v) {
Expand Down Expand Up @@ -110,7 +110,7 @@ public static function fromHsl($h, $s, $l)
* @return int Returns the index of the specified color+alpha in the palette of the image,
* or index of allocated color if the color does not exist in the image's palette.
*/
public function getIndex($image)
public function getIndex($image): int
{
$index = $this->hasAlphaChannel()
? imagecolorexactalpha(
Expand All @@ -132,7 +132,7 @@ public function getIndex($image)
/**
* @return bool TRUE when alpha channel is specified, FALSE otherwise
*/
public function hasAlphaChannel()
public function hasAlphaChannel(): bool
{
return $this->alpha !== null;
}
Expand All @@ -142,6 +142,6 @@ public function hasAlphaChannel()
*/
public function toArray()
{
return array($this->red, $this->green, $this->blue);
return [$this->red, $this->green, $this->blue];
}
}
}
2 changes: 1 addition & 1 deletion src/HorizontalAlignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ abstract class HorizontalAlignment
const Left = 'left';
const Right = 'right';
const Center = 'center';
}
}
6 changes: 3 additions & 3 deletions src/Struct/Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ public function __construct($x, $y)
/**
* @return int
*/
public function getX()
public function getX(): int
{
return $this->x;
}

/**
* @return int
*/
public function getY()
public function getY(): int
{
return $this->y;
}
}
}
14 changes: 7 additions & 7 deletions src/Struct/Rectangle.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,48 +31,48 @@ public function __construct($x, $y, $width, $height)
/**
* @return int
*/
public function getWidth()
public function getWidth(): int
{
return $this->width;
}

/**
* @return int
*/
public function getHeight()
public function getHeight(): int
{
return $this->height;
}

/**
* @return int
*/
public function getLeft()
public function getLeft(): int
{
return $this->getX();
}

/**
* @return int
*/
public function getTop()
public function getTop(): int
{
return $this->getY();
}

/**
* @return int
*/
public function getRight()
public function getRight(): int
{
return $this->getX() + $this->width;
}

/**
* @return int
*/
public function getBottom()
public function getBottom(): int
{
return $this->getY() + $this->height;
}
}
}
2 changes: 1 addition & 1 deletion src/TextWrapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ abstract class TextWrapping
{
const NoWrap = 1;
const WrapWithOverflow = 2;
}
}
2 changes: 1 addition & 1 deletion src/VerticalAlignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ abstract class VerticalAlignment
const Top = 'top';
const Bottom = 'bottom';
const Center = 'center';
}
}
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ protected function assertImageEquals($name, $im)

$this->assertEquals($this->sha1ImageResource($name), $sha1);
}
}
}

0 comments on commit 77bba83

Please sign in to comment.