Skip to content

Commit b36702e

Browse files
committed
Better code samples
1 parent 5ae14fb commit b36702e

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,20 @@ In your PHP CS Fixer configuration register fixers and use them:
151151
- * @param $bar
152152
+ * @param mixed $bar
153153
*/
154+
function a($foo, $bar) {}
154155

155156
```
156157

157158
- **PhpdocSingleLineVarFixer** - `@var` annotation must be in single line when is the only content.
158159
```diff
159160
<?php
160-
-/**
161-
- * @var Foo
162-
- */
163-
+/** @var Foo */
161+
class Foo {
162+
- /**
163+
- * @var string
164+
- */
165+
+ /** @var string */
166+
private $name;
167+
}
164168

165169
```
166170

src/Fixer/PhpdocParamTypeFixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public function getDefinition() : FixerDefinition
2020
* @param string $foo
2121
* @param $bar
2222
*/
23+
function a($foo, $bar) {}
2324
')]
2425
);
2526
}

src/Fixer/PhpdocSingleLineVarFixer.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ public function getDefinition() : FixerDefinition
1616
return new FixerDefinition(
1717
'`@var` annotation must be in single line when is the only content.',
1818
[new CodeSample('<?php
19-
/**
20-
* @var Foo
21-
*/
19+
class Foo {
20+
/**
21+
* @var string
22+
*/
23+
private $name;
24+
}
2225
')]
2326
);
2427
}

0 commit comments

Comments
 (0)