-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
9.CommentingAndDocBlocks.php
96 lines (83 loc) · 1.76 KB
/
9.CommentingAndDocBlocks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* This is a file level summary.
*
* This is a file level Description.
*/
declare(strict_types=1);
namespace LaminasCodingStandardTest\fixed;
use SQLite3;
use stdClass;
/**
* This is a class level Summary.
*
* This is a class level Description.
*/
class CommentingAndDocBlocks
{
/** @var string[] */
public $singleArray;
/** @var (int|string)[] */
public $multiArray;
/** @var string|null */
protected $title;
/**
* <Summary>
*
* <Description>
*
* @internal
* @deprecated
*
* @link
* @uses
* @see
*
* @param
* @return
* @throws
*/
public function testDocBlockSpacing(): void
{
}
public function testInlineCommentMustBeAtTheEnd(): void
{
$hello = $world; /* comment */
$hello = $world; /* comment */
}
/**
* Sets a single-line title.
*
* The `param` and `return` tags should be omitted as they are already
* type hinted.
*/
public function setTitle(string $title): void
{
// there should be no docblock here
$this->title = $title;
}
/**
* All tags can be omitted as typehints describe it all.
*/
public function foo(bool $createNew): ?stdClass
{
if ($createNew) {
return new stdClass();
}
return null;
}
/**
* The returned array should be described with a `return` tag.
*
* @return SQLite3[] $connections
*/
public function testIdeAutoCompletion(): array
{
/** @var SQLite3 $sqlite */
foreach ($connections as $sqlite) {
// there should be no docblock here
$sqlite->open('/my/database/path');
}
return $connections;
}
}