Skip to content

Commit c058fb3

Browse files
committed
Use ParamProviders
1 parent b29c8db commit c058fb3

File tree

1 file changed

+21
-221
lines changed

1 file changed

+21
-221
lines changed

tests/bench/RegressionBench.php

Lines changed: 21 additions & 221 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PHPStan\Benchmark;
44

55
use PhpBench\Attributes as Bench;
6+
use Symfony\Component\Finder\Finder;
67

78
#[Bench\Revs(revs: 1)]
89
#[Bench\Iterations(iterations: 5)]
@@ -15,235 +16,34 @@
1516
class RegressionBench extends BenchCase
1617
{
1718

18-
public function benchBug1388(): void
19+
/**
20+
* @param array{string} $params
21+
*/
22+
#[Bench\ParamProviders(['provideFiles'])]
23+
public function benchRunAnalyse(array $params): void
1924
{
20-
$this->runAnalyse(__DIR__ . '/data/bug-1388.php');
25+
$this->runAnalyse($params[0]);
2126
}
2227

23-
public function benchBug1447(): void
28+
/**
29+
* @return iterable<array{string}>
30+
*/
31+
public function provideFiles(): iterable
2432
{
25-
$this->runAnalyse(__DIR__ . '/data/bug-1447.php');
33+
yield from self::findTestDataFilesFromDirectory(__DIR__ . '/data');
2634
}
2735

28-
public function benchBug4308(): void
36+
private static function findTestDataFilesFromDirectory(string $directory): array
2937
{
30-
$this->runAnalyse(__DIR__ . '/data/bug-4308.php');
31-
}
32-
33-
public function benchBug5081(): void
34-
{
35-
$this->runAnalyse(__DIR__ . '/data/bug-5081.php');
36-
}
37-
38-
public function benchBug6265(): void
39-
{
40-
$this->runAnalyse(__DIR__ . '/data/bug-6265.php');
41-
}
42-
43-
public function benchBug6936(): void
44-
{
45-
$this->runAnalyse(__DIR__ . '/data/bug-6936.php');
46-
}
47-
48-
public function benchBug6948(): void
49-
{
50-
$this->runAnalyse(__DIR__ . '/data/bug-6948.php');
51-
}
52-
53-
public function benchBug7581(): void
54-
{
55-
$this->runAnalyse(__DIR__ . '/data/bug-7581.php');
56-
}
57-
58-
public function benchBug7637(): void
59-
{
60-
$this->runAnalyse(__DIR__ . '/data/bug-7637.php');
61-
}
62-
63-
public function benchBug7901(): void
64-
{
65-
$this->runAnalyse(__DIR__ . '/data/bug-7901.php');
66-
}
67-
68-
public function benchBug7903(): void
69-
{
70-
$this->runAnalyse(__DIR__ . '/data/bug-7903.php');
71-
}
72-
73-
public function benchBug8146(): void
74-
{
75-
$this->runAnalyse(__DIR__ . '/data/bug-8146b.php');
76-
}
77-
78-
public function benchBug8146a(): void
79-
{
80-
$this->runAnalyse(__DIR__ . '/data/bug-8146a.php');
81-
}
82-
83-
public function benchBug8147(): void
84-
{
85-
$this->runAnalyse(__DIR__ . '/data/bug-8147.php');
86-
}
87-
88-
public function benchBug8215(): void
89-
{
90-
$this->runAnalyse(__DIR__ . '/data/bug-8215.php');
91-
}
92-
93-
public function benchBug8503(): void
94-
{
95-
$this->runAnalyse(__DIR__ . '/data/bug-8503.php');
96-
}
97-
98-
public function benchBug9690(): void
99-
{
100-
$this->runAnalyse(__DIR__ . '/data/bug-9690.php');
101-
}
102-
103-
public function benchBug10772(): void
104-
{
105-
$this->runAnalyse(__DIR__ . '/data/bug-10772.php');
106-
}
107-
108-
public function benchBug10979(): void
109-
{
110-
$this->runAnalyse(__DIR__ . '/data/bug-10979.php');
111-
}
112-
113-
public function benchBug11263(): void
114-
{
115-
$this->runAnalyse(__DIR__ . '/data/bug-11263.php');
116-
}
117-
118-
public function benchBug11283(): void
119-
{
120-
$this->runAnalyse(__DIR__ . '/data/bug-11283.php');
121-
}
122-
123-
public function benchBug11297(): void
124-
{
125-
$this->runAnalyse(__DIR__ . '/data/bug-11297.php');
126-
}
127-
128-
public function benchBug11913(): void
129-
{
130-
$this->runAnalyse(__DIR__ . '/data/bug-11913.php');
131-
}
132-
133-
public function benchBug12159(): void
134-
{
135-
$this->runAnalyse(__DIR__ . '/data/bug-12159.php');
136-
}
38+
$finder = new Finder();
39+
$finder->followLinks();
40+
$finder->sortByName(true);
41+
$files = [];
42+
foreach ($finder->files()->name('*.php')->in($directory) as $fileInfo) {
43+
$files[$fileInfo->getBasename()] = [$fileInfo->getPathname()];
44+
}
13745

138-
public function benchBug12787(): void
139-
{
140-
$this->runAnalyse(__DIR__ . '/data/bug-12787.php');
141-
}
142-
143-
public function benchBug12800(): void
144-
{
145-
$this->runAnalyse(__DIR__ . '/data/bug-12800.php');
146-
}
147-
148-
public function benchBug13310(): void
149-
{
150-
require_once __DIR__ . '/data/bug-13310.php';
151-
$this->runAnalyse(__DIR__ . '/data/bug-13310.php');
152-
}
153-
154-
public function benchBug13352(): void
155-
{
156-
$this->runAnalyse(__DIR__ . '/data/bug-13352.php');
157-
}
158-
159-
public function benchBug13685(): void
160-
{
161-
$this->runAnalyse(__DIR__ . '/data/bug-13685.php');
162-
}
163-
164-
public function benchBug13933(): void
165-
{
166-
$this->runAnalyse(__DIR__ . '/data/bug-13933.php');
167-
}
168-
169-
public function benchBug14207(): void
170-
{
171-
$this->runAnalyse(__DIR__ . '/data/bug-14207.php');
172-
}
173-
174-
public function benchBug14207And(): void
175-
{
176-
$this->runAnalyse(__DIR__ . '/data/bug-14207-and.php');
177-
}
178-
179-
public function benchBug3686(): void
180-
{
181-
$this->runAnalyse(__DIR__ . '/data/bug-3686.php');
182-
}
183-
184-
public function benchBug4300(): void
185-
{
186-
$this->runAnalyse(__DIR__ . '/data/bug-4300.php');
187-
}
188-
189-
public function benchBug5231(): void
190-
{
191-
$this->runAnalyse(__DIR__ . '/data/bug-5231.php');
192-
}
193-
194-
public function benchBug5231Two(): void
195-
{
196-
$this->runAnalyse(__DIR__ . '/data/bug-5231_2.php');
197-
}
198-
199-
public function benchBug6442(): void
200-
{
201-
$this->runAnalyse(__DIR__ . '/data/bug-6442.php');
202-
}
203-
204-
public function benchBug7140(): void
205-
{
206-
$this->runAnalyse(__DIR__ . '/data/bug-7140.php');
207-
}
208-
209-
public function benchBug7214(): void
210-
{
211-
$this->runAnalyse(__DIR__ . '/data/bug-7214.php');
212-
}
213-
214-
public function benchBug10147(): void
215-
{
216-
$this->runAnalyse(__DIR__ . '/data/bug-10147.php');
217-
}
218-
219-
public function benchBug10538(): void
220-
{
221-
$this->runAnalyse(__DIR__ . '/data/bug-10538.php');
222-
}
223-
224-
public function benchBug12671(): void
225-
{
226-
$this->runAnalyse(__DIR__ . '/data/bug-12671.php');
227-
}
228-
229-
public function benchBug13218(): void
230-
{
231-
$this->runAnalyse(__DIR__ . '/data/bug-13218.php');
232-
}
233-
234-
public function benchConditionalExpressionInfiniteLoop(): void
235-
{
236-
$this->runAnalyse(__DIR__ . '/data/conditional-expression-infinite-loop.php');
237-
}
238-
239-
public function benchProcessCalledMethodInfiniteLoop(): void
240-
{
241-
$this->runAnalyse(__DIR__ . '/data/process-called-method-infinite-loop.php');
242-
}
243-
244-
public function benchBug5390(): void
245-
{
246-
$this->runAnalyse(__DIR__ . '/data/bug-5390.php');
46+
return $files;
24747
}
24848

24949
}

0 commit comments

Comments
 (0)