Skip to content

Commit c011c4f

Browse files
committed
Bump php version to 7.1
1 parent 5c81c61 commit c011c4f

20 files changed

+344
-288
lines changed

.php_cs.dist

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
3+
namespace Tarantool\Queue;
4+
5+
use PhpCsFixer\Config;
6+
use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer;
7+
use PhpCsFixer\Fixer\FixerInterface;
8+
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
9+
use PhpCsFixer\Tokenizer\Tokens;
10+
11+
final class FilterableFixer implements FixerInterface
12+
{
13+
private $fixer;
14+
private $pathRegex;
15+
16+
public function __construct(FixerInterface $fixer, string $pathRegex)
17+
{
18+
$this->fixer = $fixer;
19+
$this->pathRegex = $pathRegex;
20+
}
21+
22+
public function isCandidate(Tokens $tokens) : bool
23+
{
24+
return $this->fixer->isCandidate($tokens);
25+
}
26+
27+
public function isRisky() : bool
28+
{
29+
return $this->fixer->isRisky();
30+
}
31+
32+
public function fix(\SplFileInfo $file, Tokens $tokens) : void
33+
{
34+
$this->fixer->fix($file, $tokens);
35+
}
36+
37+
public function getName() : string
38+
{
39+
return (new \ReflectionClass($this))->getShortName().'/'.$this->fixer->getName();
40+
}
41+
42+
public function getPriority() : int
43+
{
44+
return $this->fixer->getPriority();
45+
}
46+
47+
public function supports(\SplFileInfo $file) : bool
48+
{
49+
if (1 !== preg_match($this->pathRegex, $file->getRealPath())) {
50+
return false;
51+
}
52+
53+
return $this->fixer->supports($file);
54+
}
55+
};
56+
57+
$header = <<<EOF
58+
This file is part of the Tarantool Queue package.
59+
60+
(c) Eugene Leonovich <gen.work@gmail.com>
61+
62+
For the full copyright and license information, please view the LICENSE
63+
file that was distributed with this source code.
64+
EOF;
65+
66+
return Config::create()
67+
->setUsingCache(false)
68+
->setRiskyAllowed(true)
69+
->registerCustomFixers([
70+
new FilterableFixer(new NativeConstantInvocationFixer(), '/\bsrc\b/'),
71+
new FilterableFixer(new NativeFunctionInvocationFixer(), '/\bsrc\b/'),
72+
])
73+
->setRules([
74+
'@Symfony' => true,
75+
'@Symfony:risky' => true,
76+
'array_syntax' => ['syntax' => 'short'],
77+
'binary_operator_spaces' => ['operators' => ['=' => null, '=>' => null]],
78+
'native_constant_invocation' => false,
79+
'native_function_invocation' => false,
80+
'FilterableFixer/native_constant_invocation' => true,
81+
'FilterableFixer/native_function_invocation' => true,
82+
'no_useless_else' => true,
83+
'no_useless_return' => true,
84+
'ordered_imports' => true,
85+
'phpdoc_order' => true,
86+
'phpdoc_align' => false,
87+
'return_type_declaration' => ['space_before' => 'one'],
88+
'strict_comparison' => true,
89+
'header_comment' => [
90+
'header' => $header,
91+
'location' => 'after_declare_strict',
92+
'separate' => 'both',
93+
],
94+
])
95+
;

.travis.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ services:
66
- docker
77

88
env:
9-
- IMAGE='php:5.6-cli' TNT_CLIENT=pecl
10-
- IMAGE='php:7.0-cli' TNT_CLIENT=pecl
119
- IMAGE='php:7.1-cli' TNT_CLIENT=pecl
12-
- IMAGE='php:5.6-cli' TNT_CLIENT=pure
13-
- IMAGE='php:7.0-cli' TNT_CLIENT=pure
14-
- IMAGE='php:7.1-cli' TNT_CLIENT=pure
15-
- IMAGE='php:7.2-cli' TNT_CLIENT=pure PHPUNIT_OPTS='--coverage-clover=coverage.clover'
10+
- IMAGE='php:7.1-cli'
11+
- IMAGE='php:7.2-cli' PHPUNIT_OPTS='--coverage-clover=coverage.clover'
12+
- IMAGE='php:7.3-rc-cli'
1613

1714
install:
1815
- ./dockerfile.sh | tee /dev/tty | docker build -t queue -

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Lua modules, called [LuaRocks](https://luarocks.org/). This package provides PHP
1414
The recommended way to install the library is through [Composer](http://getcomposer.org):
1515

1616
```sh
17-
$ composer require tarantool/queue
17+
composer require tarantool/queue
1818
```
1919

2020

@@ -39,7 +39,7 @@ To start the instance you need to copy (or symlink) `queues.lua` file into the `
3939
directory and run the following command:
4040

4141
```sh
42-
$ sudo tarantoolctl start queues
42+
sudo tarantoolctl start queues
4343
```
4444

4545

@@ -271,28 +271,28 @@ $result = $queue->call('put_many', [[
271271
The easiest way to run tests is with Docker. First, build an image using the [dockerfile.sh](dockerfile.sh) generator:
272272

273273
```sh
274-
$ ./dockerfile.sh | docker build -t queue -
274+
./dockerfile.sh | docker build -t queue -
275275
```
276276

277277
Then run Tarantool instance (needed for integration tests):
278278

279279
```sh
280-
$ docker network create tarantool-php
281-
$ docker run -d --net=tarantool-php --name=tarantool -v `pwd`:/queue \
280+
docker network create tarantool-php
281+
docker run -d --net=tarantool-php --name=tarantool -v `pwd`:/queue \
282282
tarantool/tarantool:1 tarantool /queue/tests/Integration/queues.lua
283283
```
284284

285285
And then run both unit and integration tests:
286286

287287
```sh
288-
$ docker run --rm --net=tarantool-php --name=queue -v `pwd`:/queue -w /queue queue
288+
docker run --rm --net=tarantool-php --name=queue -v `pwd`:/queue -w /queue queue
289289
```
290290

291291
To run only integration or unit tests, set the `PHPUNIT_OPTS` environment variable
292292
to either `--testsuite Integration` or `--testsuite Unit` respectively, e.g.:
293293

294294
```sh
295-
$ docker run --rm --net=tarantool-php --name=queue -v `pwd`:/queue -w /queue \
295+
docker run --rm --net=tarantool-php --name=queue -v `pwd`:/queue -w /queue \
296296
-e PHPUNIT_OPTS='--testsuite Unit' queue
297297
```
298298

composer.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^5.4|^7.0"
14+
"php": "^7.1"
1515
},
1616
"require-dev": {
17+
"friendsofphp/php-cs-fixer": "^2.13",
18+
"phpunit/phpunit": "^7.4",
1719
"rybakit/msgpack": "@dev",
1820
"tarantool/client": "@dev"
1921
},
@@ -30,5 +32,11 @@
3032
"psr-4": {
3133
"Tarantool\\Queue\\Tests\\": "tests/"
3234
}
35+
},
36+
"config": {
37+
"preferred-install": {
38+
"*": "dist"
39+
},
40+
"sort-packages": true
3341
}
3442
}

dockerfile.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ FROM $IMAGE
3131
3232
RUN apt-get update && \\
3333
apt-get install -y git curl zlib1g-dev${RUN_CMDS} && \\
34-
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \\
35-
composer global require 'phpunit/phpunit'${RUN_POST_CMDS}
34+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer${RUN_POST_CMDS}
3635
3736
ENV PATH=~/.composer/vendor/bin:\$PATH
3837
ENV TARANTOOL_HOST=tarantool TARANTOOL_PORT=3301
3938
40-
CMD if [ ! -f composer.lock ]; then composer install; fi && ~/.composer/vendor/bin/phpunit\${PHPUNIT_OPTS:+ }\$PHPUNIT_OPTS
39+
CMD if [ ! -f composer.lock ]; then composer install; fi && vendor/bin/phpunit\${PHPUNIT_OPTS:+ }\$PHPUNIT_OPTS
4140
"

phpunit.xml.dist

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<phpunit backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
syntaxCheck="false"
12-
verbose="true"
13-
bootstrap="tests/bootstrap.php"
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
colors="true"
5+
verbose="true"
6+
bootstrap="vendor/autoload.php"
147
>
158
<php>
169
<ini name="date.timezone" value="UTC" />
@@ -23,11 +16,11 @@
2316
</php>
2417

2518
<testsuites>
26-
<testsuite name="Unit">
19+
<testsuite name="unit">
2720
<directory>tests/Unit</directory>
2821
</testsuite>
2922

30-
<testsuite name="Integration">
23+
<testsuite name="integration">
3124
<directory>tests/Integration</directory>
3225
</testsuite>
3326
</testsuites>

src/ClientAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Tarantool\Client\Client;
1515

16-
class ClientAdapter
16+
final class ClientAdapter
1717
{
1818
private $client;
1919

@@ -22,7 +22,7 @@ public function __construct(Client $client)
2222
$this->client = $client;
2323
}
2424

25-
public function call($funcName, array $args = [])
25+
public function call(string $funcName, array $args = []) : array
2626
{
2727
$data = $this->client->call($funcName, $args)->getData();
2828

src/Options.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
namespace Tarantool\Queue;
1313

14-
abstract class Options
14+
final class Options
1515
{
16-
const DELAY = 'delay';
17-
const PRI = 'pri';
18-
const TTL = 'ttl';
19-
const TTR = 'ttr';
20-
const UTUBE = 'utube';
16+
public const DELAY = 'delay';
17+
public const PRI = 'pri';
18+
public const TTL = 'ttl';
19+
public const TTR = 'ttr';
20+
public const UTUBE = 'utube';
2121
}

0 commit comments

Comments
 (0)