Skip to content

Commit 8d7f765

Browse files
authored
Merge pull request #4 from duboism/port_php8
Port to PHP 8
2 parents e05e9c8 + 0e7a3ab commit 8d7f765

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
operating-system: ['ubuntu-latest', 'macos-latest']
26-
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
26+
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
2727
steps:
2828
- name: Get source code
2929
uses: actions/checkout@v4

Image/Color.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function changeLightness($degree = 10)
273273
* @static
274274
* @author Jason Lotito <[email protected]>
275275
*/
276-
function getTextColor($color, $light = '#FFFFFF', $dark = '#000000')
276+
static function getTextColor($color, $light = '#FFFFFF', $dark = '#000000')
277277
{
278278
$color = Image_Color::_splitColor($color);
279279
if ($color[1] > hexdec('66')) {
@@ -312,7 +312,7 @@ function _setColors($col1, $col2)
312312
* @static
313313
* @author Jason Lotito <[email protected]>
314314
*/
315-
function _splitColor($color)
315+
static function _splitColor($color)
316316
{
317317
$color = str_replace('#', '', $color);
318318
$c[] = hexdec(substr($color, 0, 2));
@@ -327,7 +327,7 @@ function _splitColor($color)
327327
* @deprecated Function deprecated after 1.0.1
328328
* @see rgb2hex().
329329
*/
330-
function _returnColor ( $color )
330+
static function _returnColor ( $color )
331331
{
332332
return Image_Color::rgb2hex($color);
333333
}
@@ -342,7 +342,7 @@ function _returnColor ( $color )
342342
* @author Jason Lotito <[email protected]>
343343
* @see hex2rgb()
344344
*/
345-
function rgb2hex($color)
345+
static function rgb2hex($color)
346346
{
347347
return sprintf('%02X%02X%02X',$color[0],$color[1],$color[2]);
348348
}
@@ -359,7 +359,7 @@ function rgb2hex($color)
359359
* @author Jason Lotito <[email protected]>
360360
* @see rgb2hex()
361361
*/
362-
function hex2rgb($hex)
362+
static function hex2rgb($hex)
363363
{
364364
$return = Image_Color::_splitColor($hex);
365365
$return['hex'] = $hex;
@@ -379,7 +379,7 @@ function hex2rgb($hex)
379379
* @uses hsv2hex() to convert the HSV value to Hex.
380380
* @uses hex2rgb() to convert the Hex value to RGB.
381381
*/
382-
function hsv2rgb($h, $s, $v)
382+
static function hsv2rgb($h, $s, $v)
383383
{
384384
return Image_Color::hex2rgb(Image_Color::hsv2hex($h, $s, $v));
385385
}
@@ -399,7 +399,7 @@ function hsv2rgb($h, $s, $v)
399399
* @author Jurgen Schwietering <[email protected]>
400400
* @uses rgb2hex() to convert the return value to a hex string.
401401
*/
402-
function hsv2hex($h, $s, $v)
402+
static function hsv2hex($h, $s, $v)
403403
{
404404
$s /= 256.0;
405405
$v /= 256.0;
@@ -470,7 +470,7 @@ function hsv2hex($h, $s, $v)
470470
* @uses ImageColorAllocate() to allocate the color.
471471
* @uses color2RGB() to parse the color into RGB values.
472472
*/
473-
function allocateColor(&$img, $color) {
473+
static function allocateColor(&$img, $color) {
474474
$color = Image_Color::color2RGB($color);
475475

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

497-
if ($color{0} == '#') {
497+
if ($color[0] == '#') {
498498
$c = Image_Color::hex2rgb($color);
499499
} else {
500500
$c = Image_Color::namedColor2RGB($color);
@@ -514,7 +514,7 @@ function color2RGB($color)
514514
* @static
515515
* @author Sebastian Bergmann <[email protected]>
516516
*/
517-
function namedColor2RGB($color)
517+
static function namedColor2RGB($color)
518518
{
519519
static $colornames;
520520

@@ -680,7 +680,7 @@ function namedColor2RGB($color)
680680
* @access public
681681
* @static
682682
*/
683-
function percentageColor2RGB($color)
683+
static function percentageColor2RGB($color)
684684
{
685685
// remove spaces
686686
$color = str_replace(' ', '', $color);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"type": "library",
3535
"require" : {
36-
"php": ">=5.6, < 8.0"
36+
"php": ">=5.6"
3737
},
3838
"require-dev": {
3939
"yoast/phpunit-polyfills": "^2.0"

0 commit comments

Comments
 (0)