Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to PHP 8 #4

Merged
merged 9 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ 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 <[email protected]>
*/
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 <[email protected]>
*/
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 <[email protected]>
* @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 <[email protected]>
* @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 <[email protected]>
* @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 <[email protected]>
*/
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