File tree Expand file tree Collapse file tree
rules-tests/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector/Fixture Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Rector \Tests \DeadCode \Rector \Node \RemoveNonExistingVarAnnotationRector \Fixture ;
4+
5+ final class DemoFile
6+ {
7+ public function run (int $ param ): int
8+ {
9+ /**
10+ * Rector should not remove this @var annotation.
11+ *
12+ * @var array<int,int>
13+ */
14+ static $ cached_result = [];
15+
16+ if (!isset ($ cached_result [$ param ])) {
17+ $ cached_result [$ param ] = doExpensiveCalculation ($ param );
18+ }
19+
20+ return $ cached_result [$ param ];
21+ }
22+ }
23+ -----
24+ <?php
25+
26+ namespace Rector \Tests \DeadCode \Rector \Node \RemoveNonExistingVarAnnotationRector \Fixture ;
27+
28+ final class DemoFile
29+ {
30+ public function run (int $ param ): int
31+ {
32+ /**
33+ * Rector should not remove this @var annotation.
34+ */
35+ static $ cached_result = [];
36+
37+ if (!isset ($ cached_result [$ param ])) {
38+ $ cached_result [$ param ] = doExpensiveCalculation ($ param );
39+ }
40+
41+ return $ cached_result [$ param ];
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments