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

Restore php 5.3 support #51

Merged
merged 6 commits into from
Mar 30, 2021
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
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
strategy:
matrix:
php:
- '5.3'
- '5.4'
- '5.5'
- '5.6'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Additionally `blame` can be used to show commits that introduced the breakage.

Running parallel jobs in PHP is inspired by Nette framework tests.

The application is officially supported for use with PHP 5.4 to 8.0.
The application is officially supported for use with PHP 5.3 to 8.0.

## Table of contents

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": ">=5.4.0",
"php": ">=5.3.0",
"ext-json": "*"
},
"replace": {
Expand Down
10 changes: 6 additions & 4 deletions parallel-lint
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/

if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50400) {
fwrite(STDERR, "PHP Parallel Lint require PHP 5.4.0 or newer." . PHP_EOL);
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300) {
fwrite(STDERR, "PHP Parallel Lint requires PHP 5.3.0 or newer." . PHP_EOL);
exit(254);
}

$autoloadLocations = [
$autoloadLocations = array(
getcwd() . '/vendor/autoload.php',
getcwd() . '/../../autoload.php',
__DIR__ . '/vendor/autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../../autoload.php',
__DIR__ . '/../../autoload.php',
];
);

$loaded = false;
foreach ($autoloadLocations as $autoload) {
Expand All @@ -61,5 +61,7 @@ if (!$loaded) {
exit(254);
}

require_once __DIR__ . '/src/polyfill.php';

$app = new JakubOnderka\PhpParallelLint\Application();
exit($app->run());
15 changes: 15 additions & 0 deletions src/polyfill.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

/**
* Polyfill for PHP < 5.4
*/
if (!interface_exists('JsonSerializable', false)) {
interface JsonSerializable
{
/**
* @param void
* @return mixed
*/
function jsonSerialize();
}
}