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

drop PHP 7.4 and 8.0, bump PHPStan to 2 #30

Merged
merged 4 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ jobs:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:

Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# CHANGELOG

## 0.9.21 - 2024-xx-xx
**NOTE**: since version 0.10, this CHANGELOG is no longer updated. Check the
[release notes](https://github.com/FileEye/pel/releases) of each release instead.

* [CI] Run PHPStan at rule level 0
## 0.10.0 - 2024-01-11

* [CI] Run PHPStan at rule level 5
* Add Codecov
* Removed support for PHP lower than 7.4

## 0.9.20 - 2023-06-20
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
],
"license" : "GPL-2.0",
"require" : {
"php" : ">=7.4"
"php" : ">=8.1"
},
"require-dev" : {
"ext-gd" : "*",
"ext-exif" : "*",
"squizlabs/php_codesniffer" : ">=3.8",
"phpunit/phpunit" : "^9 || ^10 || ^11 ",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3.11"
"phpunit/phpunit" : "^10 || ^11 ",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2",
"phpstan/phpstan-phpunit": "^2"
},
"config": {
"allow-plugins": {
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ parameters:
- src
- test

treatPhpDocTypesAsCertain: false

ignoreErrors:
-
message: "#^Unreachable statement - code above always terminates.$#"
Expand Down
2 changes: 1 addition & 1 deletion src/PelDataWindow.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function __construct($data = '', $endianess = PelConvert::LITTLE_ENDIAN)
{
if (is_string($data)) {
$this->data = $data;
} elseif ((is_resource($data) && get_resource_type($data) === 'gd') || (PHP_VERSION_ID >= 80000 && is_object($data) && $data instanceof \GDImage)) {
} elseif (is_object($data) && $data instanceof \GDImage) {
/*
* The ImageJpeg() function insists on printing the bytes
* instead of returning them in a more civil way as a string, so
Expand Down
2 changes: 1 addition & 1 deletion src/PelJpeg.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function __construct($data = false)
} elseif ($data instanceof PelDataWindow) {
Pel::debug('Initializing PelJpeg object from PelDataWindow.');
$this->load($data);
} elseif ((is_resource($data) && get_resource_type($data) == 'gd') || (PHP_VERSION_ID >= 80000 && is_object($data) && $data instanceof \GDImage)) {
} elseif (is_object($data) && $data instanceof \GDImage) {
Pel::debug('Initializing PelJpeg object from image resource.');
$this->load(new PelDataWindow($data));
} else {
Expand Down
8 changes: 4 additions & 4 deletions test/BrokenImagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ class BrokenImagesTest extends TestCase
public function testWindowWindowExceptionIsCaught()
{
$jpeg = new PelJpeg(dirname(__FILE__) . '/broken_images/gh-10-a.jpg');
$this->assertInstanceOf('\lsolesen\pel\PelJpeg', $jpeg);
$this->assertNotSame('', $jpeg->getBytes());
}

public function testWindowOffsetExceptionIsCaught()
{
$jpeg = new PelJpeg(dirname(__FILE__) . '/broken_images/gh-10-b.jpg');
$this->assertInstanceOf('\lsolesen\pel\PelJpeg', $jpeg);
$this->assertNotSame('', $jpeg->getBytes());
}

public function testParsingNotFailingOnRecursingIfd()
{
$jpeg = new PelJpeg(dirname(__FILE__) . '/broken_images/gh-11.jpg');
$this->assertInstanceOf('\lsolesen\pel\PelJpeg', $jpeg);
$this->assertNotSame('', $jpeg->getBytes());
}

public function testInvalidIfd()
{
$this->expectException(PelIllegalFormatException::class) ;
$jpeg = new PelJpeg(dirname(__FILE__) . '/broken_images/gh-156.jpg');
$this->assertInstanceOf('\lsolesen\pel\PelJpeg', $jpeg);
$this->assertNotSame('', $jpeg->getBytes());
}
}
2 changes: 1 addition & 1 deletion test/Bug3017880Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testThisDoesNotWorkAsExpected()
try {
$resave_file = 0;
$jpeg = new PelJpeg($filename);
$this->assertInstanceOf('\lsolesen\pel\PelJpeg', $jpeg);
$this->assertNotSame('', $jpeg->getBytes());

// should all exif data on photo be cleared (gd and iu will always strip it anyway, so only
// force strip if you know the image you're branding is an original)
Expand Down
4 changes: 2 additions & 2 deletions test/Gh200Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testPelDataWindowOffsetExceptionOffsetNotWithin()

$data = new PelDataWindow(file_get_contents($file));
$pelJpeg = new PelJpeg($data);
$this->assertInstanceOf('\lsolesen\pel\PelJpeg', $pelJpeg);

$this->assertNotSame('', $pelJpeg->getBytes());
}
}
Loading