Merge branch 'main' into remove-pear

This commit is contained in:
Till Krüss
2020-08-14 10:39:52 -07:00
committed by GitHub
20 changed files with 74 additions and 253 deletions
-2
View File
@@ -5,6 +5,4 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/phpunit.xml.travisci export-ignore
+38
View File
@@ -0,0 +1,38 @@
name: Tests
on: [push, pull_request]
jobs:
predis:
name: PHP ${{ matrix.php-versions }} (Redis ${{ matrix.redis-versions }})
runs-on: ubuntu-latest
services:
redis:
image: redis:${{ matrix.redis-versions }}
ports:
- 6379/tcp
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0']
redis-versions: ['3', '4', '5', '6']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP with Composer and extensions
with:
php-version: ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
- name: Get Composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer dependencies
uses: actions/cache@v2
with:
php-version: ${{ matrix.php-versions }}
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Test with PHPUnit
run: vendor/bin/phpunit
+1 -1
View File
@@ -1,6 +1,6 @@
/vendor
.php-version
.php_cs.cache
.phpunit.result.cache
composer.lock
phpunit.xml
*.tgz
-24
View File
@@ -1,24 +0,0 @@
language: php
sudo: false
branches:
except:
- v0.5
- v0.6
- v0.6-PHP_5.2
- documentation
before_install:
- docker run -d --rm -p 127.0.0.1:6379:6379 redis:3
before_script:
- composer self-update
- composer install --no-interaction --prefer-source --dev
script:
- travis_retry vendor/bin/phpunit -c phpunit.xml.travisci
matrix:
fast_finish: true
include:
- php: 7.2
- php: 7.3
- php: 7.4
- php: nightly
allow_failures:
- php: nightly
+1 -1
View File
@@ -1,6 +1,6 @@
## Filing bug reports ##
Bugs or feature requests can be posted on the [GitHub issues](http://github.com/predishq/predis/issues)
Bugs or feature requests can be posted on the [GitHub issues](http://github.com/predis/predis/issues)
section of the project.
When reporting bugs, in addition to the obvious description of your issue you __must__ always provide
+1 -1
View File
@@ -33,7 +33,7 @@ usually something that developers prefer to customize depending on their needs a
generalized when using Redis because of the many possible access patterns for your data. This does
not mean that it is impossible to have such a feature since you can leverage the extensibility of
this library to define your own serialization-aware commands. You can find more details about how to
do that [on this issue](http://github.com/predishq/predis/issues/29#issuecomment-1202624).
do that [on this issue](http://github.com/predis/predis/issues/29#issuecomment-1202624).
### How can I force Predis to connect to Redis before sending any command? ###
+14 -14
View File
@@ -4,7 +4,7 @@
[![Latest stable][ico-version-stable]][link-packagist]
[![Latest development][ico-version-dev]][link-packagist]
[![Monthly installs][ico-downloads-monthly]][link-downloads]
[![Build status][ico-travis]][link-travis]
[![Build status][ico-build]][link-actions]
A flexible and feature-complete [Redis](http://redis.io) client for PHP 7.2 and newer.
@@ -36,8 +36,8 @@ More details about this project can be found on the [frequently asked questions]
## How to _install_ and use Predis ##
This library can be found on [Packagist](http://packagist.org/packages/predis/predis) for an easier
management of projects dependencies using [Composer](http://packagist.org/about-composer). Ultimately,
compressed archives of each release are [available on GitHub](https://github.com/predishq/predis/releases).
management of projects dependencies using [Composer](http://packagist.org/about-composer).
Compressed archives of each release are [available on GitHub](https://github.com/predis/predis/releases).
### Loading the library ###
@@ -449,8 +449,8 @@ the `unstable` branch by modifying `phpunit.xml` and setting `REDIS_SERVER_VERSI
the development server profile will be used. You can refer to [the tests README](tests/README.md)
for more detailed information about testing Predis.
Predis uses Travis CI for continuous integration and the history for past and current builds can be
found [on its project page](http://travis-ci.org/predishq/predis).
Predis uses GitHub Actions for continuous integration and the history for past and current builds can be
found [on its actions page](https://github.com/predis/predis/actions).
## Other ##
@@ -458,9 +458,9 @@ found [on its project page](http://travis-ci.org/predishq/predis).
### Project related links ###
- [Source code](https://github.com/predishq/predis)
- [Wiki](https://github.com/predishq/predis/wiki)
- [Issue tracker](https://github.com/predishq/predis/issues)
- [Source code](https://github.com/predis/predis)
- [Wiki](https://github.com/predis/predis/wiki)
- [Issue tracker](https://github.com/predis/predis/issues)
### Author ###
@@ -473,12 +473,12 @@ found [on its project page](http://travis-ci.org/predishq/predis).
The code for Predis is distributed under the terms of the MIT license (see [LICENSE](LICENSE)).
[ico-license]: https://img.shields.io/github/license/predishq/predis.svg?style=flat-square
[ico-version-stable]: https://img.shields.io/packagist/v/predis/predis.svg?style=flat-square
[ico-version-dev]: https://img.shields.io/packagist/vpre/predis/predis.svg?style=flat-square
[ico-downloads-monthly]: https://img.shields.io/packagist/dm/predis/predis.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/predishq/predis.svg?style=flat-square
[ico-license]: https://img.shields.io/github/license/predis/predis.svg
[ico-version-stable]: https://img.shields.io/packagist/v/predis/predis.svg
[ico-version-dev]: https://img.shields.io/packagist/vpre/predis/predis.svg
[ico-downloads-monthly]: https://img.shields.io/packagist/dm/predis/predis.svg
[ico-build]: https://img.shields.io/github/workflow/status/predis/predis/Tests/main
[link-packagist]: https://packagist.org/packages/predis/predis
[link-travis]: https://travis-ci.org/predishq/predis
[link-actions]: https://github.com/predis/predis/actions
[link-downloads]: https://packagist.org/packages/predis/predis/stats
+1 -1
View File
@@ -1 +1 @@
1.1.2
2.0.0-dev
+4 -4
View File
@@ -3,10 +3,10 @@
"type": "library",
"description": "A flexible and feature-complete Redis client for PHP.",
"keywords": ["nosql", "redis", "predis"],
"homepage": "http://github.com/predishq/predis",
"homepage": "http://github.com/predis/predis",
"license": "MIT",
"support": {
"issues": "https://github.com/predishq/predis/issues"
"issues": "https://github.com/predis/predis/issues"
},
"authors": [
{
@@ -28,10 +28,10 @@
}
],
"require": {
"php": "^7.2"
"php": "^7.2 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0"
"phpunit/phpunit": "^8.0 || ^9.0"
},
"suggest": {
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol",
-54
View File
@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
syntaxCheck="true"
beStrictAboutTestSize="true"
beStrictAboutTestsThatDoNotTestAnything="true">
<testsuites>
<testsuite name="Predis Test Suite">
<directory>tests/Predis/</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>ext-phpiredis</group>
<group>ext-curl</group>
<group>realm-webdis</group>
<!-- <group>connected</group> -->
<!-- <group>disconnected</group> -->
<!-- <group>commands</group> -->
<!-- <group>slow</group> -->
</exclude>
</groups>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-text" target="php://stdout" />
</logging>
<php>
<!-- Redis -->
<const name="REDIS_SERVER_VERSION" value="3.2" />
<const name="REDIS_SERVER_HOST" value="127.0.0.1" />
<const name="REDIS_SERVER_PORT" value="6379" />
<const name="REDIS_SERVER_DBNUM" value="15" />
<!-- Webdis -->
<const name="WEBDIS_SERVER_HOST" value="127.0.0.1" />
<const name="WEBDIS_SERVER_PORT" value="7379" />
</php>
</phpunit>
+1 -1
View File
@@ -40,7 +40,7 @@ use Predis\Transaction\MultiExec as MultiExecTransaction;
*/
class Client implements ClientInterface, \IteratorAggregate
{
const VERSION = '1.1.2';
const VERSION = '2.0.0-dev';
protected $connection;
protected $options;
@@ -12,7 +12,7 @@
/**
* Constraint that accepts arrays with the same elements but different order.
*/
class ArrayHasSameValuesConstraint extends \PHPUnit_Framework_Constraint
class ArrayHasSameValuesConstraint extends \PHPUnit\Framework\Constraint\Constraint
{
protected $array;
@@ -27,7 +27,7 @@ class ArrayHasSameValuesConstraint extends \PHPUnit_Framework_Constraint
/**
* {@inheritdoc}
*/
public function matches($other)
public function matches($other): bool
{
if (count($this->array) !== count($other)) {
return false;
@@ -43,7 +43,7 @@ class ArrayHasSameValuesConstraint extends \PHPUnit_Framework_Constraint
/**
* {@inheritdoc}
*/
public function toString()
public function toString(): string
{
return 'two arrays contain the same elements.';
}
@@ -51,7 +51,7 @@ class ArrayHasSameValuesConstraint extends \PHPUnit_Framework_Constraint
/**
* {@inheritdoc}
*/
protected function failureDescription($other)
protected function failureDescription($other): string
{
return $this->toString();
}
+1 -1
View File
@@ -17,7 +17,7 @@ use Predis\Profile;
/**
* Base test case class for the Predis test suite.
*/
abstract class PredisTestCase extends \PHPUnit_Framework_TestCase
abstract class PredisTestCase extends \PHPUnit\Framework\TestCase
{
protected $redisServerVersion = null;
+4 -4
View File
@@ -15,7 +15,7 @@ use SebastianBergmann\Exporter\Exporter;
/**
* Constraint that verifies a redis command.
*/
class RedisCommandConstraint extends \PHPUnit_Framework_Constraint
class RedisCommandConstraint extends \PHPUnit\Framework\Constraint\Constraint
{
protected $commandID;
protected $arguments;
@@ -38,7 +38,7 @@ class RedisCommandConstraint extends \PHPUnit_Framework_Constraint
/**
* {@inheritdoc}
*/
public function matches($other)
public function matches($other): bool
{
if (!$other instanceof CommandInterface) {
return false;
@@ -71,7 +71,7 @@ class RedisCommandConstraint extends \PHPUnit_Framework_Constraint
* @todo Improve output using diff when expected and actual arguments of a
* command do not match.
*/
public function toString()
public function toString(): string
{
$exporter = new Exporter();
$string = 'is a Redis command';
@@ -91,7 +91,7 @@ class RedisCommandConstraint extends \PHPUnit_Framework_Constraint
/**
* {@inheritdoc}
*/
protected function failureDescription($other)
protected function failureDescription($other): string
{
$string = is_object($other) ? get_class($other) : $other;
@@ -57,8 +57,8 @@ class HashKeyTest extends PredisTestCase
}
/**
* @see https://github.com/predishq/predis/pull/330
* @see https://github.com/predishq/predis/issues/331
* @see https://github.com/predis/predis/pull/330
* @see https://github.com/predis/predis/issues/331
* @group disconnected
*/
public function testIterationWithIntegerFields()
@@ -57,7 +57,7 @@ class SortedSetKeyTest extends PredisTestCase
}
/**
* @see https://github.com/predishq/predis/issues/216
* @see https://github.com/predis/predis/issues/216
* @group disconnected
*/
public function testIterationWithIntegerMembers()
@@ -76,7 +76,7 @@ class StringIncrementByFloatTest extends PredisCommandTestCase
$redis->set('foo', 2);
// We use round() to avoid errors on some platforms, see the following
// issue https://github.com/predishq/predis/issues/220 for reference.
// issue https://github.com/predis/predis/issues/220 for reference.
$this->assertEquals(22.123, $redis->incrbyfloat('foo', 20.123));
$this->assertEquals(10, round($redis->incrbyfloat('foo', -12.123), 5));
$this->assertEquals(-100.01, round($redis->incrbyfloat('foo', -110.01), 5));
-38
View File
@@ -1,38 +0,0 @@
diff --git a/src/Framework/MockObject/Generator.php b/src/Framework/MockObject/Generator.php
index 3df3abb..fc76d5d 100644
--- a/src/Framework/MockObject/Generator.php
+++ b/src/Framework/MockObject/Generator.php
@@ -1031,16 +1031,29 @@ protected function getMethodParameters(ReflectionMethod $method, $forCall = fals
$typeDeclaration = '';
if (!$forCall) {
+ if (PHP_VERSION_ID >= 80000) {
+ $isArray = $parameter->getType() && $parameter->getType()->getName() === 'array';
+ $isCallable = $parameter->getType() && $parameter->getType()->getName() === 'callable';
+ } else {
+ $isArray = $parameter->isArray();
+ $isCallable = version_compare(PHP_VERSION, '5.4.0', '>=') ? $parameter->isCallable() : false;
+ }
+
if ($this->hasType($parameter)) {
- $typeDeclaration = (string) $parameter->getType() . ' ';
- } elseif ($parameter->isArray()) {
+ $type = $parameter->getType();
+ $typeDeclaration = (PHP_VERSION_ID >= 70100 ? $type->getName() : (string) $type) . ' ';
+ } elseif ($isArray) {
$typeDeclaration = 'array ';
} elseif ((defined('HHVM_VERSION') || version_compare(PHP_VERSION, '5.4.0', '>='))
- && $parameter->isCallable()) {
+ && $isCallable) {
$typeDeclaration = 'callable ';
} else {
try {
- $class = $parameter->getClass();
+ if (PHP_VERSION_ID >= 80000) {
+ $class = $parameter->getType();
+ } else {
+ $class = $parameter->getClass();
+ }
} catch (ReflectionException $e) {
throw new PHPUnit_Framework_MockObject_RuntimeException(
sprintf(
-60
View File
@@ -1,60 +0,0 @@
diff --git a/src/Util/Getopt.php b/src/Util/Getopt.php
index ba21be3..96931a3 100644
--- a/src/Util/Getopt.php
+++ b/src/Util/Getopt.php
@@ -35,7 +35,15 @@ class PHPUnit_Util_Getopt
reset($args);
array_map('trim', $args);
- while (list($i, $arg) = each($args)) {
+ while (true) {
+ $arg = current($args);
+ $i = key($args);
+ next($args);
+
+ if ($arg === false) {
+ break;
+ }
+
if ($arg == '') {
continue;
}
@@ -94,11 +102,14 @@ class PHPUnit_Util_Getopt
if ($i + 1 < $argLen) {
$opts[] = array($opt, substr($arg, $i + 1));
break;
- } elseif (list(, $opt_arg) = each($args)) {
} else {
- throw new PHPUnit_Framework_Exception(
- "option requires an argument -- $opt"
- );
+ $opt_arg = current($args);
+ next($args);
+ if ($opt_arg === false) {
+ throw new PHPUnit_Framework_Exception(
+ "option requires an argument -- $opt"
+ );
+ }
}
}
}
@@ -139,11 +150,14 @@ class PHPUnit_Util_Getopt
if (substr($long_opt, -1) == '=') {
if (substr($long_opt, -2) != '==') {
- if (!strlen($opt_arg) &&
- !(list(, $opt_arg) = each($args))) {
- throw new PHPUnit_Framework_Exception(
- "option --$opt requires an argument"
- );
+ if (!strlen($opt_arg)) {
+ $opt_arg = current($args);
+ next($args);
+ if ($opt_arg === false) {
+ throw new PHPUnit_Framework_Exception(
+ "option --$opt requires an argument"
+ );
+ }
}
}
} elseif ($opt_arg) {
-39
View File
@@ -1,39 +0,0 @@
diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php
index 638f42513..b4c7d3a5e 100644
--- a/src/Framework/TestCase.php
+++ b/src/Framework/TestCase.php
@@ -905,7 +905,7 @@ protected function runTest()
try {
$testResult = $method->invokeArgs(
$this,
- array_merge($this->data, $this->dependencyInput)
+ array_values(array_merge($this->data, $this->dependencyInput))
);
} catch (Throwable $_e) {
$e = $_e;
diff --git a/src/Util/Configuration.php b/src/Util/Configuration.php
index 5c1041608..b2f7a7bd0 100644
--- a/src/Util/Configuration.php
+++ b/src/Util/Configuration.php
@@ -162,7 +162,7 @@ protected function __construct($filename)
/**
* @since Method available since Release 3.4.0
*/
- final private function __clone()
+ private function __clone()
{
}
diff --git a/src/Util/PHP/Template/TestCaseMethod.tpl.dist b/src/Util/PHP/Template/TestCaseMethod.tpl.dist
index b48f354cd..d59cdeea7 100644
--- a/src/Util/PHP/Template/TestCaseMethod.tpl.dist
+++ b/src/Util/PHP/Template/TestCaseMethod.tpl.dist
@@ -78,7 +78,7 @@ if ('' !== $configurationFilePath) {
unset($configuration);
}
-function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
+function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext = null)
{
return true;
}