- Add PHP 8.1 / 8.2 unit tests

- Updated code to be PHP 8.2 compliant
This commit is contained in:
Daniel Mason 2023-02-07 02:19:09 +00:00 committed by idanoo
commit 679394eb5f
Signed by: idanoo
GPG Key ID: 387387CDBC02F132
11 changed files with 200 additions and 15 deletions

View File

@ -1,3 +1,7 @@
## 2.1.0 (2023-02-07)
- Add PHP 8.1 / 8.2 unit tests
- Updated code to be PHP 8.2 compliant
## 2.0.3 (2022-09-12)
- Update composer packages
- Added WoodpeckerCI tests

View File

@ -1,8 +1,6 @@
php-resque: PHP Resque Worker (and Enqueue)
===========================================
[![Build Status](https://ci.tinker.nz/api/badges/idanoo/php-resque/status.svg)](https://ci.tinker.nz/idanoo/php-resque)
Resque is a Redis-backed library for creating background jobs, placing
those jobs on one or more queues, and processing them later.

View File

@ -7,7 +7,7 @@
},
"description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.",
"keywords": ["job", "background", "redis", "resque", "php"],
"homepage": "https://tinker.nz/idanoo/php-resque/",
"homepage": "https://gitlab.com/idanoo/php-resque/",
"license": "MIT",
"authors": [
{
@ -22,7 +22,9 @@
},
"require-dev": {
"phpunit/phpunit": "^9",
"squizlabs/php_codesniffer": "3.*"
"squizlabs/php_codesniffer": "3.*",
"phpcompatibility/php-compatibility": "^9.3",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
},
"bin": [
"bin/resque"
@ -38,7 +40,12 @@
}
},
"support": {
"issues": "https://tinker.nz/idanoo/php-resque/issues",
"source": "https://tinker.nz/idanoo/php-resque"
"issues": "https://gitlab.com/idanoo/php-resque/issues",
"source": "https://gitlab.com/idanoo/php-resque"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}

142
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "67934d62707c83cdcba540469eff2fe7",
"content-hash": "3f81232ce308e8074ac0beeaec83a3eb",
"packages": [
{
"name": "colinmollenhour/credis",
@ -105,6 +105,84 @@
}
],
"packages-dev": [
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/PHPCSStandards/composer-installer.git",
"reference": "4be43904336affa5c2f70744a348312336afd0da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da",
"reference": "4be43904336affa5c2f70744a348312336afd0da",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.4",
"squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0"
},
"require-dev": {
"composer/composer": "*",
"ext-json": "*",
"ext-zip": "*",
"php-parallel-lint/php-parallel-lint": "^1.3.1",
"phpcompatibility/php-compatibility": "^9.0",
"yoast/phpunit-polyfills": "^1.0"
},
"type": "composer-plugin",
"extra": {
"class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
},
"autoload": {
"psr-4": {
"PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Franck Nijhof",
"email": "franck.nijhof@dealerdirect.com",
"homepage": "http://www.frenck.nl",
"role": "Developer / IT Manager"
},
{
"name": "Contributors",
"homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors"
}
],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://www.dealerdirect.com",
"keywords": [
"PHPCodeSniffer",
"PHP_CodeSniffer",
"code quality",
"codesniffer",
"composer",
"installer",
"phpcbf",
"phpcs",
"plugin",
"qa",
"quality",
"standard",
"standards",
"style guide",
"stylecheck",
"tests"
],
"support": {
"issues": "https://github.com/PHPCSStandards/composer-installer/issues",
"source": "https://github.com/PHPCSStandards/composer-installer"
},
"time": "2023-01-05T11:28:13+00:00"
},
{
"name": "doctrine/instantiator",
"version": "1.4.1",
@ -401,6 +479,68 @@
},
"time": "2022-02-21T01:04:05+00:00"
},
{
"name": "phpcompatibility/php-compatibility",
"version": "9.3.5",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
"shasum": ""
},
"require": {
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
},
"conflict": {
"squizlabs/php_codesniffer": "2.6.2"
},
"require-dev": {
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
},
"type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "Wim Godden",
"homepage": "https://github.com/wimg",
"role": "lead"
},
{
"name": "Juliette Reinders Folmer",
"homepage": "https://github.com/jrfnl",
"role": "lead"
},
{
"name": "Contributors",
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
}
],
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
"keywords": [
"compatibility",
"phpcs",
"standards"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
},
"time": "2019-12-27T09:44:58+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.17",

View File

@ -1,10 +1,9 @@
<?xml version="1.0"?>
<ruleset name="phpresque" namespace="ezyVet\PHPCS">
<description>PSR12</description>
<ruleset name="PHP82" namespace="ezyVet\PHPCS">
<description>PHP8.2 Ruleset</description>
<file>.</file>
<exclude-pattern>vendor/</exclude-pattern>
<exclude-pattern>vendor</exclude-pattern>
<exclude-pattern>tests/</exclude-pattern>
<arg name="extensions" value="php" />
@ -12,8 +11,19 @@
<arg value="sp"/>
<arg name="parallel" value="16"/>
<arg name="report-width" value="140" />
<arg name="error-severity" value="1" />
<!-- Setting warning-severity here overrides both the '-n' CLI option and 'config-set show_warnings 0', so we
can't use it. -->
<ini name="memory_limit" value="256M"/>
<!-- Check for version support for PHP 8.2 and higher. -->
<config name="testVersion" value="8.2-"/>
<rule ref="PSR12">
</rule>
<rule ref="PHPCompatibility">
</rule>
</ruleset>

View File

@ -11,6 +11,10 @@ namespace Resque\Job;
*/
class Factory implements FactoryInterface
{
public ?Job $job;
public string $queue;
public array $args;
/**
* @param $className
* @param array $args

View File

@ -174,7 +174,7 @@ class Job
*/
public function getInstance()
{
if (!is_null($this->instance)) {
if (isset($this->instance) && !is_null($this->instance)) {
return $this->instance;
}

View File

@ -12,7 +12,7 @@ namespace Resque;
class Resque
{
public const VERSION = '2.0.3';
public const VERSION = '2.1.0';
public const DEFAULT_INTERVAL = 5;

View File

@ -397,6 +397,11 @@ class JobTest extends TestCase
class SomeJobClass implements \Resque\Job\JobInterface
{
public static $called = false;
public $args = false;
public $queue;
public $job;
/**
* @return bool
*/
@ -408,6 +413,11 @@ class SomeJobClass implements \Resque\Job\JobInterface
class Some_Stub_Factory implements \Resque\Job\FactoryInterface
{
public static $called = false;
public $args = false;
public $queue;
public $job;
/**
* @param $className
* @param array $args

View File

@ -35,6 +35,9 @@ if (function_exists('pcntl_signal')) {
class TestJob
{
public static $called = false;
public $args = false;
public $queue;
public $job;
public function perform()
{
@ -48,6 +51,11 @@ class FailingJobException extends \Exception
class FailingJob
{
public static $called = false;
public $args = false;
public $queue;
public $job;
public function perform()
{
throw new FailingJobException('Message!');
@ -62,6 +70,8 @@ class TestJobWithSetUp
{
public static $called = false;
public $args = false;
public $queue;
public $job;
public function setUp()
{
@ -78,6 +88,8 @@ class TestJobWithTearDown
{
public static $called = false;
public $args = false;
public $queue;
public $job;
public function perform()
{