Skip to content

Commit

Permalink
Refine types
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Jul 29, 2024
1 parent 31584c0 commit 2764ea8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion plugins/auto-sizes/tests/test-optimization-detective.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function data_provider_test_od_optimize_template_output_buffer(): array {
* @covers ::auto_sizes_visit_tag
*
* @dataProvider data_provider_test_od_optimize_template_output_buffer
* @phpstan-param array<string, mixed> $element_metrics
* @phpstan-param array{ xpath: string, isLCP: bool, intersectionRatio: int } $element_metrics
*/
public function test_od_optimize_template_output_buffer( array $element_metrics, string $buffer, string $expected ): void {
$this->populate_url_metrics( array( $element_metrics ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function test_get_json_schema(): void {
}

/**
* Check schema subset.
* Checks schema subset.
*
* @param array<string, mixed> $schema Schema subset.
*/
Expand Down
24 changes: 14 additions & 10 deletions tests/class-optimization-detective-test-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
*/

/**
* @phpstan-type ElementDataSubset array{xpath: string, isLCP?: bool, intersectionRatio: float}
* @phpstan-type ElementDataSubset array{
* xpath: string,
* isLCP?: bool,
* intersectionRatio?: float
* }
*/
trait Optimization_Detective_Test_Helpers {

Expand Down Expand Up @@ -42,18 +46,18 @@ public function populate_url_metrics( array $elements, bool $complete = true ):
/**
* Gets a sample DOM rect for testing.
*
* @return int[]
* @return array<string, float>
*/
public function get_sample_dom_rect(): array {
return array(
'width' => 100,
'height' => 100,
'x' => 100,
'y' => 100,
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
'width' => 100.0,
'height' => 100.0,
'x' => 100.0,
'y' => 100.0,
'top' => 0.0,
'right' => 0.0,
'bottom' => 0.0,
'left' => 0.0,
);
}

Expand Down

0 comments on commit 2764ea8

Please sign in to comment.