-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump minimum PHP version requirement to 7.1 (#14)
* Bump php version to 7.1 * Temporary skip the test for the pecl connector until this PR is merged: tarantool/tarantool-php#134 * Use variadic args in Queue::call() * Use float type hint for timestamp and interval arguments * Declare strict types * Fix scrutinizer fails to parse a coverage file * Add .php_cs.dist * Update README.md
- Loading branch information
Showing
20 changed files
with
440 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tarantool\Queue; | ||
|
||
use PhpCsFixer\Config; | ||
use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer; | ||
use PhpCsFixer\Fixer\FixerInterface; | ||
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer; | ||
use PhpCsFixer\Tokenizer\Tokens; | ||
|
||
final class FilterableFixer implements FixerInterface | ||
{ | ||
private $fixer; | ||
private $pathRegex; | ||
|
||
public function __construct(FixerInterface $fixer, string $pathRegex) | ||
{ | ||
$this->fixer = $fixer; | ||
$this->pathRegex = $pathRegex; | ||
} | ||
|
||
public function isCandidate(Tokens $tokens) : bool | ||
{ | ||
return $this->fixer->isCandidate($tokens); | ||
} | ||
|
||
public function isRisky() : bool | ||
{ | ||
return $this->fixer->isRisky(); | ||
} | ||
|
||
public function fix(\SplFileInfo $file, Tokens $tokens) : void | ||
{ | ||
$this->fixer->fix($file, $tokens); | ||
} | ||
|
||
public function getName() : string | ||
{ | ||
return (new \ReflectionClass($this))->getShortName().'/'.$this->fixer->getName(); | ||
} | ||
|
||
public function getPriority() : int | ||
{ | ||
return $this->fixer->getPriority(); | ||
} | ||
|
||
public function supports(\SplFileInfo $file) : bool | ||
{ | ||
if (1 !== preg_match($this->pathRegex, $file->getRealPath())) { | ||
return false; | ||
} | ||
|
||
return $this->fixer->supports($file); | ||
} | ||
}; | ||
|
||
$header = <<<EOF | ||
This file is part of the Tarantool Queue package. | ||
(c) Eugene Leonovich <[email protected]> | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
EOF; | ||
|
||
return Config::create() | ||
->setUsingCache(false) | ||
->setRiskyAllowed(true) | ||
->registerCustomFixers([ | ||
new FilterableFixer(new NativeConstantInvocationFixer(), '/\bsrc\b/'), | ||
new FilterableFixer(new NativeFunctionInvocationFixer(), '/\bsrc\b/'), | ||
]) | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'binary_operator_spaces' => ['operators' => ['=' => null, '=>' => null]], | ||
'declare_strict_types' => true, | ||
'native_constant_invocation' => false, | ||
'native_function_invocation' => false, | ||
'FilterableFixer/native_constant_invocation' => true, | ||
'FilterableFixer/native_function_invocation' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'ordered_imports' => true, | ||
'phpdoc_order' => true, | ||
'phpdoc_align' => false, | ||
'return_type_declaration' => ['space_before' => 'one'], | ||
'strict_comparison' => true, | ||
'header_comment' => [ | ||
'header' => $header, | ||
'location' => 'after_declare_strict', | ||
'separate' => 'both', | ||
], | ||
]) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.