Skip to content

Commit 28a4bd0

Browse files
committed
Improve README.md
1 parent b36702e commit 28a4bd0

File tree

6 files changed

+6
-24
lines changed

6 files changed

+6
-24
lines changed

README.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ composer require --dev kubawerlos/php-cs-fixer-custom-fixers
1919
In your PHP CS Fixer configuration register fixers and use them:
2020
```diff
2121
<?php
22-
2322
return PhpCsFixer\Config::create()
2423
+ ->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers())
2524
->setRules([
@@ -28,7 +27,6 @@ In your PHP CS Fixer configuration register fixers and use them:
2827
+ PhpCsFixerCustomFixers\Fixer\NoLeadingSlashInGlobalNamespaceFixer::name() => true,
2928
+ PhpCsFixerCustomFixers\Fixer\NoTwoConsecutiveEmptyLinesFixer::name() => true,
3029
]);
31-
3230
```
3331

3432

@@ -38,14 +36,13 @@ In your PHP CS Fixer configuration register fixers and use them:
3836
<?php
3937
-implode($foo, "") . implode($bar);
4038
+implode("", $foo) . implode('', $bar);
41-
4239
```
4340

4441
- **NoDoctrineMigrationsGeneratedCommentFixer** - there must be no comment generated by Doctrine Migrations.
4542
```diff
43+
<?php
4644
namespace Migrations;
4745
use Doctrine\DBAL\Schema\Schema;
48-
use Doctrine\Migrations\AbstractMigration;
4946
-/**
5047
- * Auto-generated Migration: Please modify to your needs!
5148
- */
@@ -62,7 +59,6 @@ In your PHP CS Fixer configuration register fixers and use them:
6259
$this->addSql("UPDATE t1 SET col1 = col1 - 1");
6360
}
6461
}
65-
6662
```
6763

6864
- **NoLeadingSlashInGlobalNamespaceFixer** - when in global namespace there must be no leading slash for class.
@@ -72,7 +68,6 @@ In your PHP CS Fixer configuration register fixers and use them:
7268
+$x = new Foo();
7369
namespace Bar;
7470
$y = new \Baz();
75-
7671
```
7772

7873
- **NoPhpStormGeneratedCommentFixer** - there must be no comment generated by PhpStorm.
@@ -85,7 +80,6 @@ In your PHP CS Fixer configuration register fixers and use them:
8580
- * Time: 12:00
8681
- */
8782
namespace Foo;
88-
8983
```
9084

9185
- **NoTwoConsecutiveEmptyLinesFixer** - there must be no two consecutive empty lines in code.
@@ -95,7 +89,6 @@ In your PHP CS Fixer configuration register fixers and use them:
9589

9690
-
9791
class Bar {};
98-
9992
```
10093

10194
- **NoUselessClassCommentFixer** - there must be no comment like: "Class FooBar".
@@ -106,19 +99,17 @@ In your PHP CS Fixer configuration register fixers and use them:
10699
* Class to do something
107100
*/
108101
class FooBar {}
109-
110102
```
111103

112104
- **NoUselessConstructorCommentFixer** - there must be no comment like: "Foo constructor".
113105
```diff
114-
class Foo
115-
{
106+
<?php
107+
class Foo {
116108
/**
117109
- * Foo constructor
118110
*/
119111
public function __construct() {}
120112
}
121-
122113
```
123114

124115
- **NoUselessDoctrineRepositoryCommentFixer** - there must be no comment generated by the Doctrine ORM.
@@ -131,7 +122,6 @@ In your PHP CS Fixer configuration register fixers and use them:
131122
- * repository methods below.
132123
- */
133124
class FooRepository extends EntityRepository {}
134-
135125
```
136126

137127
- **PhpdocNoIncorrectVarAnnotationFixer** - `@var` must be correct in the code.
@@ -140,7 +130,6 @@ In your PHP CS Fixer configuration register fixers and use them:
140130
-/** @var Foo $foo */
141131
+
142132
$bar = new Foo();
143-
144133
```
145134

146135
- **PhpdocParamTypeFixer** - `@param` must have type.
@@ -152,7 +141,6 @@ In your PHP CS Fixer configuration register fixers and use them:
152141
+ * @param mixed $bar
153142
*/
154143
function a($foo, $bar) {}
155-
156144
```
157145

158146
- **PhpdocSingleLineVarFixer** - `@var` annotation must be in single line when is the only content.
@@ -165,7 +153,6 @@ In your PHP CS Fixer configuration register fixers and use them:
165153
+ /** @var string */
166154
private $name;
167155
}
168-
169156
```
170157

171158
- **PhpdocVarAnnotationCorrectOrderFixer** - `@var` annotation must have type and name in the correct order.
@@ -174,7 +161,6 @@ In your PHP CS Fixer configuration register fixers and use them:
174161
-/** @var $foo int */
175162
+/** @var int $foo */
176163
$foo = 2 + 2;
177-
178164
```
179165

180166

src/Fixer/NoDoctrineMigrationsGeneratedCommentFixer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public function getDefinition() : FixerDefinition
1818
[new CodeSample('<?php
1919
namespace Migrations;
2020
use Doctrine\DBAL\Schema\Schema;
21-
use Doctrine\Migrations\AbstractMigration;
2221
/**
2322
* Auto-generated Migration: Please modify to your needs!
2423
*/

src/Fixer/NoUselessConstructorCommentFixer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ public function getDefinition() : FixerDefinition
1616
return new FixerDefinition(
1717
'There must be no comment like: "Foo constructor".',
1818
[new CodeSample('<?php
19-
class Foo
20-
{
19+
class Foo {
2120
/**
2221
* Foo constructor
2322
*/

src/Readme/ReadmeCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ private function fixers() : string
139139

140140
private function diff(string $from, string $to) : string
141141
{
142-
return \str_replace(
142+
return \rtrim(\str_replace(
143143
"@@ @@\n",
144144
'',
145145
(new Differ(new UnifiedDiffOutputBuilder('')))->diff(
146146
$from,
147147
$to
148148
)
149-
);
149+
));
150150
}
151151

152152
private function contributing() : string

src/Readme/php-cs-fixer.config.after.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
return PhpCsFixer\Config::create()
43
->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers())
54
->setRules([

src/Readme/php-cs-fixer.config.before.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
return PhpCsFixer\Config::create()
43
->setRules([
54
'@PSR2' => true,

0 commit comments

Comments
 (0)