Skip to content

Commit

Permalink
Merge pull request #4 from duboism/port_php8
Browse files Browse the repository at this point in the history
Port to PHP 8
  • Loading branch information
CloCkWeRX authored Nov 26, 2024
2 parents e05e9c8 + 0e7a3ab commit 8d7f765
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
operating-system: ['ubuntu-latest', 'macos-latest']
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Get source code
uses: actions/checkout@v4
Expand Down
24 changes: 12 additions & 12 deletions Image/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function changeLightness($degree = 10)
* @static
* @author Jason Lotito <jason@lehighweb.com>
*/
function getTextColor($color, $light = '#FFFFFF', $dark = '#000000')
static function getTextColor($color, $light = '#FFFFFF', $dark = '#000000')
{
$color = Image_Color::_splitColor($color);
if ($color[1] > hexdec('66')) {
Expand Down Expand Up @@ -312,7 +312,7 @@ function _setColors($col1, $col2)
* @static
* @author Jason Lotito <jason@lehighweb.com>
*/
function _splitColor($color)
static function _splitColor($color)
{
$color = str_replace('#', '', $color);
$c[] = hexdec(substr($color, 0, 2));
Expand All @@ -327,7 +327,7 @@ function _splitColor($color)
* @deprecated Function deprecated after 1.0.1
* @see rgb2hex().
*/
function _returnColor ( $color )
static function _returnColor ( $color )
{
return Image_Color::rgb2hex($color);
}
Expand All @@ -342,7 +342,7 @@ function _returnColor ( $color )
* @author Jason Lotito <jason@lehighweb.com>
* @see hex2rgb()
*/
function rgb2hex($color)
static function rgb2hex($color)
{
return sprintf('%02X%02X%02X',$color[0],$color[1],$color[2]);
}
Expand All @@ -359,7 +359,7 @@ function rgb2hex($color)
* @author Jason Lotito <jason@lehighweb.com>
* @see rgb2hex()
*/
function hex2rgb($hex)
static function hex2rgb($hex)
{
$return = Image_Color::_splitColor($hex);
$return['hex'] = $hex;
Expand All @@ -379,7 +379,7 @@ function hex2rgb($hex)
* @uses hsv2hex() to convert the HSV value to Hex.
* @uses hex2rgb() to convert the Hex value to RGB.
*/
function hsv2rgb($h, $s, $v)
static function hsv2rgb($h, $s, $v)
{
return Image_Color::hex2rgb(Image_Color::hsv2hex($h, $s, $v));
}
Expand All @@ -399,7 +399,7 @@ function hsv2rgb($h, $s, $v)
* @author Jurgen Schwietering <jurgen@schwietering.com>
* @uses rgb2hex() to convert the return value to a hex string.
*/
function hsv2hex($h, $s, $v)
static function hsv2hex($h, $s, $v)
{
$s /= 256.0;
$v /= 256.0;
Expand Down Expand Up @@ -470,7 +470,7 @@ function hsv2hex($h, $s, $v)
* @uses ImageColorAllocate() to allocate the color.
* @uses color2RGB() to parse the color into RGB values.
*/
function allocateColor(&$img, $color) {
static function allocateColor(&$img, $color) {
$color = Image_Color::color2RGB($color);

return ImageColorAllocate($img, $color[0], $color[1], $color[2]);
Expand All @@ -490,11 +490,11 @@ function allocateColor(&$img, $color) {
* @uses hex2rgb() to convert colors begining with the # character.
* @uses namedColor2RGB() to convert everything not starting with a #.
*/
function color2RGB($color)
static function color2RGB($color)
{
$c = array();

if ($color{0} == '#') {
if ($color[0] == '#') {
$c = Image_Color::hex2rgb($color);
} else {
$c = Image_Color::namedColor2RGB($color);
Expand All @@ -514,7 +514,7 @@ function color2RGB($color)
* @static
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
*/
function namedColor2RGB($color)
static function namedColor2RGB($color)
{
static $colornames;

Expand Down Expand Up @@ -680,7 +680,7 @@ function namedColor2RGB($color)
* @access public
* @static
*/
function percentageColor2RGB($color)
static function percentageColor2RGB($color)
{
// remove spaces
$color = str_replace(' ', '', $color);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"type": "library",
"require" : {
"php": ">=5.6, < 8.0"
"php": ">=5.6"
},
"require-dev": {
"yoast/phpunit-polyfills": "^2.0"
Expand Down

0 comments on commit 8d7f765

Please sign in to comment.