Skip to content

Commit 1688b25

Browse files
committed
improved phpDoc
1 parent 706c125 commit 1688b25

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/RobotLoader/RobotLoader.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ class RobotLoader
3131
{
3232
private const RetryLimit = 3;
3333

34-
/** @var string[] */
34+
/** @var list<string> */
3535
public array $ignoreDirs = ['.*', '*.old', '*.bak', '*.tmp', 'temp'];
3636

37-
/** @var string[] */
37+
/** @var list<string> */
3838
public array $acceptFiles = ['*.php'];
3939
private bool $autoRebuild = true;
4040
private bool $reportParseErrors = true;
4141

42-
/** @var string[] */
42+
/** @var list<string> */
4343
private array $scanPaths = [];
4444

45-
/** @var string[] */
45+
/** @var list<string> */
4646
private array $excludeDirs = [];
4747

48-
/** @var array<string, array{string, int}> class => [file, time] */
48+
/** @var array<class-string, array{string, int}> class => [file, time] */
4949
private array $classes = [];
5050
private bool $cacheLoaded = false;
5151
private bool $refreshed = false;
@@ -155,7 +155,7 @@ public function excludeDirectory(string ...$paths): static
155155

156156

157157
/**
158-
* @return array<string, string> class => filename
158+
* @return array<class-string, string> class => filename
159159
*/
160160
public function getIndexedClasses(): array
161161
{
@@ -308,7 +308,7 @@ private function updateFile(string $file): void
308308

309309
/**
310310
* Searches classes, interfaces and traits in PHP file.
311-
* @return string[]
311+
* @return list<class-string>
312312
*/
313313
private function scanPhp(string $file): array
314314
{
@@ -455,7 +455,7 @@ private function loadCache(): void
455455

456456
/**
457457
* Writes class list to cache.
458-
* @param resource $lock
458+
* @param ?resource $lock
459459
*/
460460
private function saveCache($lock = null): void
461461
{
@@ -477,7 +477,10 @@ private function saveCache($lock = null): void
477477
}
478478

479479

480-
/** @return resource */
480+
/**
481+
* @param LOCK_SH|LOCK_EX $mode
482+
* @return resource
483+
*/
481484
private function acquireLock(string $file, int $mode)
482485
{
483486
$handle = @fopen($file, 'w'); // @ is escalated to exception
@@ -506,6 +509,7 @@ private function generateCacheFileName(): string
506509
}
507510

508511

512+
/** @return array{list<string>, list<string>, list<string>, list<string>, string} */
509513
protected function generateCacheKey(): array
510514
{
511515
return [$this->ignoreDirs, $this->acceptFiles, $this->scanPaths, $this->excludeDirs, 'v2'];

0 commit comments

Comments
 (0)