Skip to content

Commit 18806e4

Browse files
committed
Migrate to PHP-CS-Fixer 3. Upgrade custom rules. Upgrade ruleset.
1 parent ad25ce8 commit 18806e4

22 files changed

+2676
-1680
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
vendor
22
dist
3-
.php_cs
4-
.php_cs.cache
3+
.phpunit.result.cache
4+
.php-cs-fixer
5+
.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
$finder = PhpCsFixer\Finder::create()
5+
->in(__DIR__);
6+
7+
return Ely\CS\Config::create([
8+
// Disable "parameters" and "match" to keep compatibility with PHP 7.4
9+
'trailing_comma_in_multiline' => [
10+
'elements' => ['arrays', 'arguments'],
11+
],
12+
])->setFinder($finder);

.php_cs.dist

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

CHANGELOG.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,47 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
- `php_unit_mock_short_will_return` fixer.
1313
- `php_unit_dedicate_assert_internal_type` fixer.
1414
- `php_unit_no_expectation_annotation` fixer.
15+
- `modernize_strpos` fixer.
16+
- `no_multiple_statements_per_line` fixer.
17+
- `octal_notation` fixer.
18+
- `class_reference_name_casing` fixer.
19+
- `integer_literal_case` fixer.
20+
- `no_unset_cast` fixer.
21+
- `no_null_property_initialization` fixer.
22+
- `comment_to_phpdoc` fixer.
23+
- `multiline_comment_opening_closing` fixer.
24+
- `no_empty_comment` fixer.
25+
- `single_line_comment_spacing` fixer.
26+
- `single_line_comment_style` fixer.
27+
- `empty_loop_body` fixer.
28+
- `empty_loop_condition` fixer.
29+
- `switch_continue_to_break` fixer.
30+
- `yoda_style` fixer in non-yoda mode.
31+
- `function_typehint_space` fixer.
32+
- `lambda_not_used_import` fixer.
33+
- `no_unneeded_import_alias` fixer.
34+
- `combine_consecutive_unsets` fixer.
35+
- `declare_parentheses` fixer.
36+
- `clean_namespace` fixer.
37+
- `assign_null_coalescing_to_coalesce_equal` fixer.
38+
- `no_useless_nullsafe_operator` fixer.
39+
- `operator_linebreak` fixer.
40+
- `php_unit_fqcn_annotation` fixer.
41+
- `php_unit_test_case_static_method_calls` fixer.
42+
- `simplified_null_return` fixer.
43+
- `no_empty_statement` fixer.
44+
- `no_singleline_whitespace_before_semicolons` fixer.
45+
- `semicolon_after_instruction` fixer.
46+
- `types_spaces` fixer.
47+
- `no_trailing_comma_in_singleline` fixer.
1548

1649
### Changed
17-
- `friendsofphp/php-cs-fixer` version bumped to `^2.15.0`.
50+
- `friendsofphp/php-cs-fixer` version bumped to `^3`.
51+
- `braces` fixer now enables rule `allow_single_line_anonymous_class_with_empty_body`.
52+
- `class_attributes_separation` fixer now fixes `const` in the `only_if_meta` mode.
1853

1954
### Removed
55+
- `Ely/new_with_braces` since all its functionality is now included in the original fixer.
2056
- `self_accessor` fixer because it leads to errors in interfaces, that returns self.
2157

2258
## [0.3.0] - 2019-02-23

README.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -246,27 +246,6 @@ and `do-while`.
246246
$c = 'next statement';
247247
```
248248

249-
### `Ely/new_with_braces`
250-
251-
This is the extended version of the original `new_with_braces` fixer. It allows you to remove braces around
252-
an anonymous class declaration in a case when said class constructor doesn't contain any arguments.
253-
254-
```diff
255-
--- Original
256-
+++ New
257-
@@ @@
258-
<?php
259-
-$a = new Foo;
260-
+$a = new Foo();
261-
-$b = new class() extends Foo {};
262-
+$b = new class extends Foo {};
263-
```
264-
265-
**Configuration:**
266-
267-
* `remove_for_anonymous_classes` - if its set to `true`, then braces for anonymous classes without constructor
268-
arguments will be removed. **Default**: `false`.
269-
270249
### `Ely/remove_class_name_method_usages` (Yii2)
271250

272251
Replaces Yii2 [`BaseObject::className()`](https://github.com/yiisoft/yii2/blob/e53fc0ded1/framework/base/BaseObject.php#L84)

composer.json

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,22 @@
1616
"license": "Apache-2.0",
1717
"type": "library",
1818
"require": {
19-
"php": "^7.0|^8.0",
20-
"friendsofphp/php-cs-fixer": "^2.15.0"
19+
"php": "^7.4|^8.0",
20+
"friendsofphp/php-cs-fixer": "^3"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^6.5.1"
23+
"phpunit/phpunit": "^9.5",
24+
"phpspec/prophecy": "^1.15",
25+
"phpspec/prophecy-phpunit": "^2.0",
26+
"phpunitgoodpractices/traits": "^1.9.1",
27+
"symfony/phpunit-bridge": "^6.0",
28+
"phpunitgoodpractices/polyfill": "^1.5",
29+
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2"
30+
},
31+
"config": {
32+
"preferred-install": {
33+
"friendsofphp/php-cs-fixer": "source"
34+
}
2435
},
2536
"autoload": {
2637
"psr-4": {
@@ -29,12 +40,8 @@
2940
},
3041
"autoload-dev": {
3142
"psr-4": {
32-
"Ely\\CS\\Test\\": "tests/"
33-
}
34-
},
35-
"config": {
36-
"platform": {
37-
"php": "7.0.8"
43+
"Ely\\CS\\Test\\": "tests/",
44+
"PhpCsFixer\\Tests\\": "vendor/friendsofphp/php-cs-fixer/tests/"
3845
}
3946
}
4047
}

0 commit comments

Comments
 (0)