From 7b4428efa30b85de3cfb90dfdeedea35da1fdfc9 Mon Sep 17 00:00:00 2001 From: Mathieu Dubois Date: Wed, 2 Oct 2024 01:35:23 +0200 Subject: [PATCH 1/8] Add GitHub actions We test up to PHP 7.4 for now --- .github/workflows/main.yaml | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..32b53e5 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,49 @@ +name: Main + +on: + workflow_dispatch: + push: + branches: + - main + - master + - release/** + pull_request: + branches: + - main + - master + - release/** + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + run: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: ['ubuntu-latest', 'macos-latest'] + php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4'] + steps: + - name: Get source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: none + ini-values: post_max_size=256M, max_execution_time=180 + - run: sudo pear list + - run: sudo pear channel-update pear.php.net + - run: sudo pear upgrade --force pear/pear + - run: sudo pear list + - run: sudo pear install --force package.xml + - run: sudo pear list + - run: sudo pear package + - run: sudo pear package-validate + - run: sudo pear install --force *.tgz + - run: sudo pear list + - run: composer install + - run: ./vendor/bin/phpunit tests From d2baa200d15a38a303e8be6a5439f62608a3bcee Mon Sep 17 00:00:00 2001 From: Mathieu Dubois Date: Wed, 2 Oct 2024 02:20:20 +0200 Subject: [PATCH 2/8] Add PHP 8 in composer --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e652261..cf4684b 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ }, "type": "library", "require" : { - "php": ">=5.6, < 8.0" + "php": ">=5.6" }, "require-dev": { "yoast/phpunit-polyfills": "^2.0" From 4f4a607afbb505d702fdaa6d446d4fbc5dfe63f3 Mon Sep 17 00:00:00 2001 From: Mathieu Dubois Date: Wed, 2 Oct 2024 01:40:10 +0200 Subject: [PATCH 3/8] Add PHP 8 to CI --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 32b53e5..4d97ab5 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -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'] steps: - name: Get source code uses: actions/checkout@v4 From 0fd9ba23b11d39943d6785d83632ac131bd33103 Mon Sep 17 00:00:00 2001 From: Mathieu Dubois Date: Sun, 29 Sep 2024 21:59:41 +0200 Subject: [PATCH 4/8] fix: Array and string offset access syntax with curly braces is no longer supported --- Image/Color.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Image/Color.php b/Image/Color.php index 2721693..1b91e03 100644 --- a/Image/Color.php +++ b/Image/Color.php @@ -494,7 +494,7 @@ function color2RGB($color) { $c = array(); - if ($color{0} == '#') { + if ($color[0] == '#') { $c = Image_Color::hex2rgb($color); } else { $c = Image_Color::namedColor2RGB($color); From 4e05affd3308d8ebb66f235461bf113e9f3c2205 Mon Sep 17 00:00:00 2001 From: Mathieu Dubois Date: Wed, 2 Oct 2024 01:47:56 +0200 Subject: [PATCH 5/8] Correctly declare methods as static --- Image/Color.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Image/Color.php b/Image/Color.php index 1b91e03..4f1ba3e 100644 --- a/Image/Color.php +++ b/Image/Color.php @@ -273,7 +273,7 @@ function changeLightness($degree = 10) * @static * @author Jason Lotito */ - 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')) { @@ -312,7 +312,7 @@ function _setColors($col1, $col2) * @static * @author Jason Lotito */ - function _splitColor($color) + static function _splitColor($color) { $color = str_replace('#', '', $color); $c[] = hexdec(substr($color, 0, 2)); @@ -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); } @@ -342,7 +342,7 @@ function _returnColor ( $color ) * @author Jason Lotito * @see hex2rgb() */ - function rgb2hex($color) + static function rgb2hex($color) { return sprintf('%02X%02X%02X',$color[0],$color[1],$color[2]); } @@ -359,7 +359,7 @@ function rgb2hex($color) * @author Jason Lotito * @see rgb2hex() */ - function hex2rgb($hex) + static function hex2rgb($hex) { $return = Image_Color::_splitColor($hex); $return['hex'] = $hex; @@ -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)); } @@ -399,7 +399,7 @@ function hsv2rgb($h, $s, $v) * @author Jurgen Schwietering * @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; @@ -490,7 +490,7 @@ 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(); @@ -514,7 +514,7 @@ function color2RGB($color) * @static * @author Sebastian Bergmann */ - function namedColor2RGB($color) + static function namedColor2RGB($color) { static $colornames; @@ -680,7 +680,7 @@ function namedColor2RGB($color) * @access public * @static */ - function percentageColor2RGB($color) + static function percentageColor2RGB($color) { // remove spaces $color = str_replace(' ', '', $color); From fb8a227fa72ce02d37f2e0673fc2c09eeddba1cd Mon Sep 17 00:00:00 2001 From: Mathieu Dubois Date: Wed, 2 Oct 2024 04:59:06 +0200 Subject: [PATCH 6/8] Another bunch of static methods --- Image/Color.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Image/Color.php b/Image/Color.php index 4f1ba3e..fce329b 100644 --- a/Image/Color.php +++ b/Image/Color.php @@ -470,7 +470,7 @@ static 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]); From 2f4e356fb8267ae63452bda79331e8c35d267a5f Mon Sep 17 00:00:00 2001 From: Mathieu Dubois Date: Mon, 25 Nov 2024 23:26:36 +0100 Subject: [PATCH 7/8] Add PHP 8.4 in CI --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 4d97ab5..5dedb9f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -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', '8.0', '8.1', '8.2', '8.3'] + 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 From 0e7a3abb38443c527535aaa3dbb8fbe0c01ad0fa Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Wed, 27 Nov 2024 07:31:55 +1030 Subject: [PATCH 8/8] Apply suggestions from code review --- .github/workflows/main.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9d0bb18..5dedb9f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -23,7 +23,6 @@ jobs: strategy: matrix: operating-system: ['ubuntu-latest', 'macos-latest'] - 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