Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7679609

Browse files
authored
Improved types (PHPStan) (#1081)
1 parent e71db2f commit 7679609

22 files changed

+154
-376
lines changed

‎.php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
->setRiskyAllowed(true)
1919
->setRules([
2020
'@PSR12' => true,
21-
'void_return' => true,
21+
'void_return' => false,
2222
'binary_operator_spaces' => [
2323
'operators' => [
2424
'=>' => null

‎extensions/xdebug/lib/XDebugUtil.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public function __construct($xdebugVersion, bool $xdebugUseCompression)
4343
$this->xdebugUseCompression = $xdebugUseCompression;
4444
}
4545

46+
/**
47+
* @param string $extension
48+
*/
4649
public function filenameFromContext(ExecutionContext $context, $extension = ''): string
4750
{
4851
$name = sprintf(

‎lib/Attributes/Iterations.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class Iterations
2222
*/
2323
public $iterations;
2424

25+
/**
26+
* @param int|int[] $iterations
27+
*/
2528
public function __construct(int | array $iterations)
2629
{
2730
$this->iterations = (array)$iterations;

‎lib/Attributes/OutputMode.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public function __construct(private readonly string $mode)
2121
{
2222
}
2323

24+
/**
25+
* @return string
26+
*/
2427
public function getMode()
2528
{
2629
return $this->mode;

‎lib/Benchmark/Metadata/Driver/AnnotationDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct(private $subjectPattern = '^bench', AnnotationReader
5656
public function getMetadataForHierarchy(ReflectionHierarchy $hierarchy): BenchmarkMetadata
5757
{
5858
$primaryReflection = $hierarchy->getTop();
59-
$benchmark = new BenchmarkMetadata($primaryReflection->path, $primaryReflection->class);
59+
$benchmark = new BenchmarkMetadata($primaryReflection->path, $primaryReflection->getClass());
6060

6161
$this->buildBenchmark($benchmark, $hierarchy);
6262

‎lib/Benchmark/Metadata/Driver/AttributeDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(private readonly string $subjectPattern = '^bench')
4242
public function getMetadataForHierarchy(ReflectionHierarchy $hierarchy): BenchmarkMetadata
4343
{
4444
$primaryReflection = $hierarchy->getTop();
45-
$benchmark = new BenchmarkMetadata($primaryReflection->path, $primaryReflection->class);
45+
$benchmark = new BenchmarkMetadata($primaryReflection->path, $primaryReflection->getClass());
4646

4747
$this->buildBenchmark($benchmark, $hierarchy);
4848

‎lib/Benchmark/Metadata/Driver/ChainDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(private readonly array $drivers)
2121
public function getMetadataForHierarchy(ReflectionHierarchy $classHierarchy): BenchmarkMetadata
2222
{
2323
$primaryReflection = $classHierarchy->getTop();
24-
$benchmark = new BenchmarkMetadata($primaryReflection->path, $primaryReflection->class);
24+
$benchmark = new BenchmarkMetadata($primaryReflection->path, $primaryReflection->getClass());
2525

2626
foreach ($this->drivers as $driver) {
2727
$benchmark->merge($driver->getMetadataForHierarchy($classHierarchy));

‎lib/Color/GradientBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ final class GradientBuilder
99
*/
1010
private $series = [];
1111

12+
/**
13+
* @var array<string, Gradient>
14+
*/
1215
private array $cache = [];
1316

1417
public function __construct(private string $startColor = '#000000')

‎lib/Model/ResultCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function getMetricOrDefault(string $class, string $metric, $default = nul
134134
*
135135
* @return array<class-string<ResultInterface>, ResultInterface>
136136
*/
137-
public function getResults(): ?array
137+
public function getResults(): array
138138
{
139139
return $this->results;
140140
}

‎lib/Model/Variant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function getIterator(): ArrayIterator
126126
* $variant->getMetricValues(ComputedResult::class, 'z_value');
127127
* ```
128128
*
129-
* @return mixed[]
129+
* @return array<int|float>
130130
*/
131131
public function getMetricValues(string $resultClass, string $metricName): array
132132
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /