Skip to content

Commit 61eefb6

Browse files
authored
Merge pull request #34 from MacFJA/update-tools
Update dev tools version (PHP-CS-Fixer + PHPStan)
2 parents e80451e + 6cdffa6 commit 61eefb6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+245
-46
lines changed

.php-cs-fixer.dist.php

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
/*
6+
* Copyright MacFJA
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
10+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
11+
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
14+
* Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
17+
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
*
21+
* ----------
22+
*
323
* This document has been generated with
424
* https://mlocati.github.io/php-cs-fixer-configurator/#version:3.0.0|configurator
525
* you can change this configuration by importing this file.
626
*/
27+
728
$config = new PhpCsFixer\Config();
29+
830
return $config
931
->setRiskyAllowed(true)
1032
->setRules([
@@ -17,15 +39,15 @@
1739
'@PhpCsFixer' => true,
1840
'combine_nested_dirname' => true,
1941
'dir_constant' => true,
20-
'global_namespace_import' => ['import_functions'=>true],
21-
'header_comment' => ['comment_type'=>'comment','header'=>"Copyright MacFJA\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the\nSoftware.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\nWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",'location'=>'after_declare_strict'],
42+
'global_namespace_import' => ['import_functions' => true],
43+
'header_comment' => ['comment_type' => 'comment', 'header' => "Copyright MacFJA\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the\nSoftware.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\nWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", 'location' => 'after_declare_strict'],
2244
'implode_call' => true,
2345
'logical_operators' => true,
2446
'modernize_types_casting' => true,
2547
'native_function_invocation' => true,
26-
'no_alias_functions' => ['sets'=>['@all']],
48+
'no_alias_functions' => ['sets' => ['@all']],
2749
'no_php4_constructor' => true,
28-
'no_superfluous_phpdoc_tags' => ['allow_mixed'=>true,'remove_inheritdoc'=>true],
50+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true],
2951
'no_unreachable_default_argument_value' => true,
3052
'no_useless_sprintf' => true,
3153
'php_unit_dedicate_assert' => true,
@@ -43,9 +65,10 @@
4365
'ternary_to_elvis_operator' => true,
4466
'void_return' => true,
4567
])
46-
->setFinder(PhpCsFixer\Finder::create()
47-
->exclude('vendor')
48-
->in(__DIR__.'/src')
49-
->in(__DIR__.'/tests')
68+
->setFinder(
69+
PhpCsFixer\Finder::create()
70+
->exclude('vendor')
71+
->in(__DIR__.'/src')
72+
->in(__DIR__.'/tests')
5073
)
51-
;
74+
;

.unused.dist.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11

22
<?php
33

4-
$projectPath = __DIR__ . '/';
4+
$projectPath = __DIR__.'/';
55

66
$scanDirectories = [
7-
$projectPath . '/src/',
8-
$projectPath . '/tests/',
7+
$projectPath.'/src/',
8+
$projectPath.'/tests/',
99
];
1010

1111
return [
12-
/**
13-
* Required params
14-
**/
15-
'composerJsonPath' => $projectPath . '/composer.json',
16-
'vendorPath' => $projectPath . '/vendor/',
12+
// Required params
13+
'composerJsonPath' => $projectPath.'/composer.json',
14+
'vendorPath' => $projectPath.'/vendor/',
1715
'scanDirectories' => $scanDirectories,
1816

19-
/**
20-
* Optional params
21-
**/
17+
// Optional params
2218
'skipPackages' => [
2319
'phpmd/phpmd', // QA tool
2420
'vimeo/psalm', // QA tool
@@ -28,10 +24,10 @@
2824
'enlightn/security-checker', // QA tool
2925
'php-parallel-lint/php-parallel-lint', // QA tool
3026
'sebastian/phpcpd', // QA tool
31-
'ukko/phpredis-phpdoc' // Stubs
27+
'ukko/phpredis-phpdoc', // Stubs
3228
],
3329
'excludeDirectories' => [],
3430
'scanFiles' => [],
3531
'extensions' => ['*.php'],
36-
'requireDev' => true
37-
];
32+
'requireDev' => true,
33+
];

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased v2.x]
88

9+
### Changed
10+
11+
- (dev) Update version and rules of PHP-CS-Fixer and PHPStan
12+
913
## [2.1.1]
1014

1115
### Fixed

Makefile

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

33
analyze: | vendor
44
$(COMPOSER) exec -v parallel-lint -- src
5-
$(COMPOSER) exec -v php-cs-fixer -- fix --dry-run
5+
$(COMPOSER) exec -v php-cs-fixer -- fix --dry-run -v
66
$(COMPOSER) exec -v unused_scanner -- .unused.dist.php
77
$(COMPOSER) exec -v security-checker -- security:check
88
$(COMPOSER) exec -v phpcpd -- --fuzzy src
@@ -13,7 +13,7 @@ analyze: | vendor
1313

1414
fix-code: | vendor
1515
$(COMPOSER) normalize
16-
$(COMPOSER) exec -v php-cs-fixer -- fix
16+
$(COMPOSER) exec -v php-cs-fixer -- fix -v
1717

1818
test: | vendor
1919
$(COMPOSER) exec -v phpunit
@@ -55,4 +55,4 @@ ifneq ($(shell command -v composer > /dev/null ; echo $$?), 0)
5555
COMPOSER=php composer.phar
5656
else
5757
COMPOSER=composer
58-
endif
58+
endif

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
{
22
"name": "macfja/redisearch",
3-
"type": "library",
43
"description": "PHP Client for RediSearch",
4+
"license": "MIT",
5+
"type": "library",
56
"keywords": [
67
"Redis",
78
"RediSearch",
89
"Search Engine",
910
"Suggestion"
1011
],
1112
"readme": "README.md",
12-
"license": "MIT",
1313
"authors": [
1414
{
1515
"name": "MacFJA"
1616
}
1717
],
18+
"support": {
19+
"issues": "https://github.com/MacFJA/php-redisearch/issues",
20+
"source": "https://github.com/MacFJA/php-redisearch"
21+
},
1822
"require": {
1923
"php": "^7.2 || ^8.0",
2024
"ext-intl": "*",
@@ -55,12 +59,6 @@
5559
"ptrofimov/tinyredisclient": "To use TinyRedisClient implementation",
5660
"redisent/redisent": "To use Redisent implementation"
5761
},
58-
"config": {
59-
"allow-plugins": {
60-
"composer/package-versions-deprecated": true,
61-
"ergebnis/composer-normalize": true
62-
}
63-
},
6462
"autoload": {
6563
"psr-4": {
6664
"MacFJA\\RediSearch\\": "src/"
@@ -71,8 +69,10 @@
7169
"MacFJA\\RediSearch\\tests\\": "tests/"
7270
}
7371
},
74-
"support": {
75-
"issues": "https://github.com/MacFJA/php-redisearch/issues",
76-
"source": "https://github.com/MacFJA/php-redisearch"
72+
"config": {
73+
"allow-plugins": {
74+
"composer/package-versions-deprecated": true,
75+
"ergebnis/composer-normalize": true
76+
}
7777
}
7878
}

src/Index.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ class Index
4444
{
4545
/** @var Client */
4646
private $client;
47+
4748
/** @var InfoResponse */
4849
private $info;
50+
4951
/** @var string */
5052
private $index;
53+
5154
/** @var string */
5255
private $version;
5356

src/IndexBuilder.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,40 +97,58 @@ class IndexBuilder
9797
use AddFieldOptionTrait;
9898

9999
private const IS_ARRAY = ['prefixes', 'stopWords', 'fields'];
100+
100101
/** @var null|string */
101102
private $index;
103+
102104
/** @var null|string */
103105
private $structure;
106+
104107
/** @var array<string> */
105108
private $prefixes = [];
109+
106110
/** @var null|string */
107111
private $filter;
112+
108113
/** @var null|string */
109114
private $defaultLanguage;
115+
110116
/** @var null|string */
111117
private $languageField;
118+
112119
/** @var null|float */
113120
private $defaultScore;
121+
114122
/** @var null|string */
115123
private $scoreField;
124+
116125
/** @var null|string */
117126
private $payloadField;
127+
118128
/** @var bool */
119129
private $maxTextFields = false;
130+
120131
/** @var null|int */
121132
private $temporary;
133+
122134
/** @var bool */
123135
private $noOffsets = false;
136+
124137
/** @var bool */
125138
private $noHighLight = false;
139+
126140
/** @var bool */
127141
private $noFields = false;
142+
128143
/** @var bool */
129144
private $noFrequencies = false;
145+
130146
/** @var bool */
131147
private $skipInitialScan = false;
148+
132149
/** @var null|array<string> */
133150
private $stopWords;
151+
134152
/** @var array<CreateCommandFieldOption> */
135153
private $fields = [];
136154

src/Query/Builder/EncapsulationGroup.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ class EncapsulationGroup implements QueryElement, QueryElementDecorator
2525
{
2626
/** @var string */
2727
private $open;
28+
2829
/** @var string */
2930
private $close;
31+
3032
/** @var bool */
3133
private $omitIfNoSpace;
34+
3235
/** @var QueryElement */
3336
private $element;
3437

src/Query/Builder/FieldFacet.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class FieldFacet implements QueryElement
2929
{
3030
/** @var array<string> */
3131
private $fields;
32+
3233
/** @var QueryElement */
3334
private $element;
3435

src/Query/Builder/Fuzzy.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Fuzzy implements QueryElement
2828
{
2929
/** @var string */
3030
private $word;
31+
3132
/** @var int */
3233
private $distance;
3334

src/Redis/Client.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public function execute(Command $command);
4343
public function executeRaw(...$args);
4444

4545
/**
46-
* @param Command ...$commands
47-
*
4846
* @return array<mixed>
4947
*/
5048
public function pipeline(Command ...$commands): array;

src/Redis/Client/AbstractClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ public function pipeline(Command ...$commands): array
4141
}
4242

4343
/**
44-
* @param Command ...$commands
45-
*
4644
* @return array<mixed>
4745
*/
4846
abstract protected function doPipeline(Command ...$commands): array;

src/Redis/Client/ClientFacade.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ public function getClient($redis): Client
5353
{
5454
/** @var Client $factory */
5555
foreach ($this->factories as $factory) {
56-
if (!is_subclass_of($factory, Client::class)) {
57-
continue;
58-
}
5956
if ($factory::supports($redis)) {
6057
return $factory::make($redis);
6158
}

src/Redis/Command/AbstractCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ abstract class AbstractCommand implements Command
3434
{
3535
public const MAX_IMPLEMENTED_VERSION = '2.0.12';
3636
public const MIN_IMPLEMENTED_VERSION = '2.0.0';
37+
3738
/**
3839
* @var array<array<CommandOption>|CommandOption|mixed>
3940
*/
4041
protected $options;
42+
4143
/** @var string */
4244
private $rediSearchVersion;
4345

src/Redis/Command/AggregateCommand/GroupByOption.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class GroupByOption extends AbstractCommandOption
3131

3232
/** @var array<ReduceOption> */
3333
private $reducers = [];
34+
3435
/** @var array<string> */
3536
private $fields;
3637

src/Redis/Command/AggregateCommand/SortByOption.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
class SortByOption extends AbstractCommandOption
3030
{
3131
use PrefixFieldName;
32+
3233
/** @var array<string,null|string> */
3334
private $fields = [];
35+
3436
/** @var null|int */
3537
private $max;
3638

src/Redis/Command/CreateCommand/JSONFieldOption.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class JSONFieldOption extends AbstractCommandOption implements CreateCommandJSON
2727
{
2828
/** @var CreateCommandFieldOption */
2929
private $decorated;
30+
3031
/** @var string */
3132
private $path;
3233

src/Redis/Command/Option/AbstractCommandOption.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
namespace MacFJA\RediSearch\Redis\Command\Option;
2323

2424
use Composer\Semver\Semver;
25+
use function is_scalar;
2526
use UnexpectedValueException;
2627

2728
abstract class AbstractCommandOption implements CommandOption

src/Redis/Command/Option/FlagOption.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class FlagOption extends AbstractCommandOption
2525
{
2626
/** @var string */
2727
private $name;
28+
2829
/** @var bool */
2930
private $active;
3031

0 commit comments

Comments
 (0)