forked from pfrenssen/coder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariableCommentUnitTest.inc.fixed
More file actions
116 lines (96 loc) · 2.13 KB
/
VariableCommentUnitTest.inc.fixed
File metadata and controls
116 lines (96 loc) · 2.13 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
/**
* @file
* Test file.
*/
/**
* Test class with properties.
*/
class Test {
/**
* The data type declaration should not end with a dot.
*
* @var \Drupal\locale\StringStorageInterface
*/
protected $localeStorage;
/**
* Multiple type declarations can be declared, separated by pipes.
*
* @var \Drupal\Core\Entity\EntityInterface|null
*/
protected $entity;
/**
* Test for some common misspellings.
*
* @var bool|null|false|true|array
*/
protected $someVar;
/**
* A variable name should not follow the type declaration.
*
* @var \Drupal\Core\Session\AccountProxyInterface
*/
protected $user;
/**
* A doc comment should be used here.
*/
protected $wrongCommentStyle;
/**
* Wrong style with var keyword.
*/
public $varStyle;
protected $missingComment;
/**
* A variable comment is optional for a typed property.
*/
public ?Bar $bar;
/**
* Property fooBar.
*
* @var \Foo|\Bar|false|null
*/
public Foo|Bar|FALSE|NULL $fooBar;
/**
* Readonly property.
*/
protected readonly string $readOnly;
/**
* PHPStan array annotation.
*
* @var array<int,array<int,int>>
*/
protected array $arrayStructure;
/**
* PHPStan array shapes.
*
* @var array{'foo': int, "bar"?: string}
*/
protected array $arrayShape;
/**
* PHPStan constant wildcard.
*
* @var \Foo::*
*/
protected string $constant;
/**
* Intersection type support, it is allowed to repeat it in the var type.
*
* @var \Drupal\user\UserStorageInterface&\PHPUnit\Framework\MockObject\MockObject
*/
protected UserStorageInterface&MockObject $userStorageMock;
/**
* It is also allowed to leave the var comment out since there is a type.
*/
protected UserStorageInterface&MockObject $userStorageMock2;
/**
* The search score.
*/
// phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName
public string $search_score;
/**
* Allow parentheses in the type declaration.
*
* @var (\Drupal\user\UserInterface&\PHPUnit\Framework\MockObject\MockObject)|null
*/
protected $userMock;
}