Skip to content
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
21 changes: 21 additions & 0 deletions .github/workflows/phpstan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: PHPStan

on: [push, pull_request]

permissions: {}

jobs:
phpstan:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
tools: composer:v2
- name: Install Dependencies
run: COMPOSER=composer.phpstan.json composer install --no-ansi --no-interaction --no-progress
- name: Run PHPStan
run: vendor-phpstan/bin/phpstan analyse
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
vendor
vendor-phpstan
.phpunit.result.cache
composer.lock
composer.phpstan.lock
9 changes: 9 additions & 0 deletions composer.phpstan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"description": "composer for PHPStan to still support php5.4 and higher in the main composer file",
"config": {
"vendor-dir": "vendor-phpstan"
},
"require": {
"phpstan/phpstan": "^2.1"
}
}
6 changes: 3 additions & 3 deletions lib/Tinify.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ public static function setClient($client) {
}

function setKey($key) {
return Tinify::setKey($key);
Tinify::setKey($key);
}

function setAppIdentifier($appIdentifier) {
return Tinify::setAppIdentifier($appIdentifier);
Tinify::setAppIdentifier($appIdentifier);
}

function setProxy($proxy) {
return Tinify::setProxy($proxy);
Tinify::setProxy($proxy);
}

function getCompressionCount() {
Expand Down
3 changes: 2 additions & 1 deletion lib/Tinify/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function request($method, $url, $body = NULL) {
}

$request = curl_init();
if ($request === false || $request === null) {
if ($request === false) {
throw new ConnectionException(
"Error while connecting: curl extension is not functional or disabled."
);
Expand Down Expand Up @@ -153,6 +153,7 @@ function request($method, $url, $body = NULL) {
throw new ConnectionException("Error while connecting: " . $message);
}
}
throw new ConnectionException("Error while connecting: max retries exceeded");
}

protected static function parseHeaders($headers) {
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
phpVersion: 70100
level: 5
paths:
- lib
Loading