Skip to content

Commit dc95d05

Browse files
committed
Upgrade PHP CS Fixer
1 parent 0e9cad7 commit dc95d05

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

+396
-377
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
/.gitignore export-ignore
55
/.travis.yml export-ignore
66
/phpunit.xml.dist export-ignore
7-
/php_cs.dist export-ignore
7+
/.php-cs-fixer.dist.php export-ignore

.github/workflows/test-unit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
php: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
18+
php: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3', 'latest']
1919
type: ['Phpunit']
2020
include:
21-
- php: '8.0'
21+
- php: 'latest'
2222
type: 'CodingStyle'
23-
- php: '8.3'
23+
- php: 'latest'
2424
type: 'StaticAnalysis'
2525
steps:
2626
- name: Checkout

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/.idea
2-
/.php_cs
3-
/.phpunit.result.cache
41
/vendor
52
/composer.lock
63
/phpunit.xml
4+
/.phpunit.result.cache

.php-cs-fixer.dist.php

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Config;
6+
use PhpCsFixer\Finder;
7+
8+
$finder = Finder::create()
9+
->in([__DIR__])
10+
->exclude(['vendor']);
11+
12+
return (new Config())
13+
->setRiskyAllowed(true)
14+
->setRules([
15+
'@PhpCsFixer' => true,
16+
'@PhpCsFixer:risky' => true,
17+
'@PHP71Migration' => true,
18+
'@PHP71Migration:risky' => true,
19+
20+
// required by PSR-12
21+
'concat_space' => [
22+
'spacing' => 'one',
23+
],
24+
25+
// disable some too strict rules
26+
'phpdoc_types_order' => [
27+
'null_adjustment' => 'always_last',
28+
'sort_algorithm' => 'none',
29+
],
30+
'single_line_throw' => false,
31+
'yoda_style' => [
32+
'equal' => false,
33+
'identical' => false,
34+
],
35+
'native_constant_invocation' => true,
36+
'native_function_invocation' => false,
37+
'void_return' => false,
38+
'blank_line_before_statement' => [
39+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'exit'],
40+
],
41+
'final_internal_class' => false,
42+
'combine_consecutive_issets' => false,
43+
'combine_consecutive_unsets' => false,
44+
'multiline_whitespace_before_semicolons' => false,
45+
'no_superfluous_elseif' => false,
46+
'ordered_class_elements' => false,
47+
'php_unit_internal_class' => false,
48+
'php_unit_test_class_requires_covers' => false,
49+
'phpdoc_add_missing_param_annotation' => false,
50+
'return_assignment' => false,
51+
'comment_to_phpdoc' => false,
52+
'general_phpdoc_annotation_remove' => [
53+
'annotations' => ['author', 'copyright', 'throws'],
54+
],
55+
56+
// fn => without curly brackets is less readable,
57+
// also prevent bounding of unwanted variables for GC
58+
'use_arrow_functions' => false,
59+
60+
// TODO disable too strict rules for now - remove once the CS is updated
61+
'declare_strict_types' => false,
62+
'fully_qualified_strict_types' => false,
63+
'general_phpdoc_annotation_remove' => false,
64+
'global_namespace_import' => false,
65+
'increment_style' => false,
66+
'native_constant_invocation' => false,
67+
'no_useless_else' => false,
68+
'php_unit_data_provider_name' => false,
69+
'php_unit_data_provider_return_type' => false,
70+
'php_unit_data_provider_static' => false,
71+
'php_unit_strict' => false,
72+
'php_unit_test_case_static_method_calls' => false,
73+
'phpdoc_to_comment' => false,
74+
'static_lambda' => false,
75+
'strict_comparison' => false,
76+
])
77+
->setFinder($finder)
78+
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer.' . md5(__DIR__) . '.cache');

.php_cs.dist

Lines changed: 0 additions & 60 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@
4646
"ext-sysvsem": "*",
4747
"eloquent/liberator": "^2.0",
4848
"ergebnis/composer-normalize": "^2.13",
49-
"friendsofphp/php-cs-fixer": "^2.16",
50-
"johnkary/phpunit-speedtrap": "^3.0",
49+
"friendsofphp/php-cs-fixer": "^3.0",
5150
"mikey179/vfsstream": "^1.6.7",
5251
"php-mock/php-mock-phpunit": "^2.1",
5352
"phpstan/phpstan": "^0.12.58",
5453
"phpunit/phpunit": "^9.4",
5554
"predis/predis": "^1.1",
56-
"spatie/async": "^1.5",
57-
"squizlabs/php_codesniffer": "^3.3"
55+
"spatie/async": "^1.5"
5856
},
5957
"suggest": {
6058
"ext-igbinary": "To use this library with PHP Redis igbinary serializer enabled.",
@@ -82,8 +80,5 @@
8280
"phpstan/extension-installer": true
8381
},
8482
"sort-packages": true
85-
},
86-
"scripts": {
87-
"fix-cs": "vendor/bin/phpcbf --standard=PSR2 src/ tests/"
8883
}
8984
}

phpunit.xml.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,4 @@
1515
<directory suffix="Test.php">./tests</directory>
1616
</testsuite>
1717
</testsuites>
18-
<listeners>
19-
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
20-
</listeners>
2118
</phpunit>

src/exception/DeadlineException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@
99
/**
1010
* Deadline exception.
1111
*/
12-
class DeadlineException extends RuntimeException implements PhpLockException
13-
{
14-
}
12+
class DeadlineException extends RuntimeException implements PhpLockException {}

src/exception/ExecutionOutsideLockException.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ class ExecutionOutsideLockException extends LockReleaseException
2121
/**
2222
* Creates a new instance of the ExecutionOutsideLockException class.
2323
*
24-
* @param float $elapsedTime Total elapsed time of the synchronized code
25-
* callback execution.
26-
* @param float $timeout The lock timeout in seconds.
27-
* @return self Execution outside lock exception.
24+
* @param float $elapsedTime total elapsed time of the synchronized code
25+
* callback execution
26+
* @param float $timeout the lock timeout in seconds
27+
*
28+
* @return self execution outside lock exception
2829
*/
2930
public static function create(float $elapsedTime, float $timeout): self
3031
{

src/exception/LockAcquireException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@
1010
* Used when the lock could not be acquired. This exception implies that the
1111
* critical code was not executed, or at least had no side effects.
1212
*/
13-
class LockAcquireException extends MutexException
14-
{
15-
}
13+
class LockAcquireException extends MutexException {}

0 commit comments

Comments
 (0)