We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6dc7832 commit 118f981Copy full SHA for 118f981
Symfony/CS/AbstractPhpdocTypesFixer.php
@@ -27,7 +27,7 @@ abstract class AbstractPhpdocTypesFixer extends AbstractFixer
27
*
28
* @var string[]
29
*/
30
- protected static $tags = array('param', 'return', 'type', 'var', 'property');
+ protected static $tags = array('param', 'property', 'property-read', 'property-write', 'return', 'type', 'var');
31
32
/**
33
* {@inheritdoc}
Symfony/CS/DocBlock/Tag.php
@@ -26,8 +26,9 @@ class Tag
26
private static $tags = array(
'api', 'author', 'category', 'copyright', 'deprecated', 'example',
'global', 'internal', 'license', 'link', 'method', 'package', 'param',
- 'property', 'return', 'see', 'since', 'struct', 'subpackage', 'throws',
- 'todo', 'typedef', 'uses', 'var', 'version',
+ 'property', 'property-read', 'property-write', 'return', 'see',
+ 'since', 'struct', 'subpackage', 'throws', 'todo', 'typedef', 'uses',
+ 'var', 'version',
);
34
@@ -45,7 +46,7 @@ class Tag
45
46
public function __construct($content)
47
{
48
$this->name = 'other';
- preg_match_all('/@[a-zA-Z0-9_]+(?=\s|$)/', $content, $matches);
49
+ preg_match_all('/@[a-zA-Z0-9_-]+(?=\s|$)/', $content, $matches);
50
51
if (isset($matches[0][0])) {
52
$this->name = ltrim($matches[0][0], '@');
Symfony/CS/DocBlock/TagComparator.php
@@ -28,6 +28,7 @@ class TagComparator
array('deprecated', 'link', 'see', 'since'),
array('author', 'copyright', 'license'),
array('package', 'subpackage'),
+ array('property', 'property-read', 'property-write'),
Symfony/CS/Tests/DocBlock/TagTest.php
@@ -37,6 +37,7 @@ public function provideNameCases()
37
array('THROWSSS', "\t@THROWSSS\t \t RUNTIMEEEEeXCEPTION\t\t\t\t\t\t\t\n\n\n"),
38
array('other', ' * @\Foo\Bar(baz = 123)'),
39
array('expectedException', ' * @expectedException Exception'),
40
+ array('property-read', ' * @property-read integer $daysInMonth number of days in the given month'),
41
array('method', ' * @method'),
42
array('method', ' * @method string getString()'),
43
array('other', ' * @method("GET")'),
@@ -61,6 +62,7 @@ public function provideValidCases()
61
62
array(true, '*@throws \Exception'),
63
array(true, ' * @method'),
64
array(true, ' * @method string getString()'),
65
+ array(true, ' * @property-read integer $daysInMonth number of days in the given month'),
66
array(false, ' * @method("GET")'),
67
array(false, '*@thRoWs \InvalidArgumentException'),
68
array(false, "\t@THROWSSS\t \t RUNTIMEEEEeXCEPTION\t\t\t\t\t\t\t\n\n\n"),
Symfony/CS/Tests/Fixer/Symfony/PhpdocScalarFixerTest.php
@@ -45,6 +45,8 @@ public function testPropertyFix()
<?php
* @property int $foo
+ * @property-read bool $bar
+ * @property-write float $baz
EOF;
@@ -53,6 +55,8 @@ public function testPropertyFix()
53
55
54
56
57
* @property integer $foo
58
+ * @property-read boolean $bar
59
+ * @property-write double $baz
60
Symfony/CS/Tests/Fixer/Symfony/PhpdocSeparationFixerTest.php
@@ -343,6 +343,36 @@ public function testDeprecatedAndSeeTags()
343
* @return void
344
345
346
+EOF;
347
+
348
+ $this->makeTest($expected, $input);
349
+ }
350
351
+ public function testPropertyTags()
352
+ {
353
+ $expected = <<<'EOF'
354
+<?php
355
+ /**
356
+ * @author Bar Baz <[email protected]>
357
+ *
358
+ * @property int $foo
359
+ * @property-read int $foo
360
+ * @property-write int $bar
361
+ */
362
363
364
365
+ $input = <<<'EOF'
366
367
368
369
370
371
372
373
374
375
376
377
378
$this->makeTest($expected, $input);
Symfony/CS/Tests/Fixer/Symfony/PhpdocTypesFixerTest.php
@@ -90,6 +90,31 @@ public function testMixedAndVoid()
90
91
}
92
93
+ public function testPropertyFix()
94
95
96
97
+/**
98
99
100
+ * @property-write mixed $baz
101
102
103
104
105
106
107
108
+ * @property Int $foo
109
+ * @property-read Boolean $bar
110
+ * @property-write MIXED $baz
111
112
113
114
115
116
117
118
public function testInlineDoc()
119
120
$expected = <<<'EOF'
0 commit comments