Skip to content

Commit aa7404d

Browse files
committed
Fix typing for static analysis
1 parent 733bb3e commit aa7404d

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tests/plugins/optimization-detective/optimization-tests.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,8 @@ private function normalize_whitespace( string $str ): string {
10501050
/**
10511051
* Gets a validated URL metric.
10521052
*
1053-
* @param int $viewport_width Viewport width for the URL metric.
1053+
* @param int $viewport_width Viewport width for the URL metric.
1054+
* @param array<array{xpath: string, isLCP: bool}> $elements Elements.
10541055
* @return OD_URL_Metric URL metric.
10551056
* @throws Exception From OD_URL_Metric if there is a parse error, but there won't be.
10561057
*/
@@ -1061,13 +1062,21 @@ private function get_validated_url_metric( int $viewport_width, array $elements
10611062
'width' => $viewport_width,
10621063
'height' => 800,
10631064
),
1064-
'timestamp' => microtime( true ),
1065+
'timestamp' => (int) microtime( true ),
10651066
'elements' => array_map(
10661067
static function ( array $element ): array {
10671068
return array_merge(
10681069
array(
1069-
'isLCPCandidate' => true,
1070-
'intersectionRatio' => 1,
1070+
'isLCPCandidate' => true,
1071+
'intersectionRatio' => 1,
1072+
'intersectionRect' => array(
1073+
'width' => 100,
1074+
'height' => 100,
1075+
),
1076+
'boundingClientRect' => array(
1077+
'width' => 100,
1078+
'height' => 100,
1079+
),
10711080
),
10721081
$element
10731082
);

0 commit comments

Comments
 (0)