File tree Expand file tree Collapse file tree
src/Command/ErrorFormatter Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010use PHPStan \File \RelativePathHelper ;
1111use function count ;
1212use function htmlspecialchars ;
13+ use function PHPStan \debugScope ;
1314use function sprintf ;
1415use const ENT_COMPAT ;
1516use const ENT_XML1 ;
@@ -124,4 +125,20 @@ private function groupByFile(AnalysisResult $analysisResult): array
124125 return $ files ;
125126 }
126127
128+ /** @param 1 $i */
129+ public function demoErrorAnnotations (int $ i ): array
130+ {
131+ if ($ i === 1 ) {
132+ echo 1 ; // @phpstan-ignore variable.undefined
133+ }
134+
135+ debugScope ();
136+ return [$ this ->demoWithoutTip ()];
137+ }
138+
139+ private function demoWithoutTip (): int
140+ {
141+ return 'not an int ' ;
142+ }
143+
127144}
Original file line number Diff line number Diff line change 22
33namespace PHPStan \Command \ErrorFormatter ;
44
5+ use Exception ;
56use PHPStan \Command \AnalysisResult ;
67use PHPStan \Command \Output ;
78use PHPStan \DependencyInjection \AutowiredService ;
@@ -49,4 +50,20 @@ public function formatErrors(
4950 return $ analysisResult ->hasErrors () ? 1 : 0 ;
5051 }
5152
53+ public function demoErrorAnnotations (): void
54+ {
55+ $ this ->demoObjectShape (new Exception ());
56+ $ rocket = '🚀 launch 😃 ' ;
57+ if ($ rocket === '🐢 slow ' ) {
58+ return ;
59+ }
60+ }
61+
62+ /**
63+ * @param object{foo: int, bar: string} $o
64+ */
65+ private function demoObjectShape (object $ o ): void
66+ {
67+ }
68+
5269}
You can’t perform that action at this time.
0 commit comments