Skip to content

Commit a7c72d0

Browse files
Merge pull request #2013 from WordPress/fix/conflict
Fix merge conflict
2 parents fb58db7 + 2f07c38 commit a7c72d0

37 files changed

+972
-375
lines changed

.eslintrc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ const config = {
2525
'/dist',
2626
'/**/*.min.js',
2727
],
28+
overrides: [
29+
...( wpConfig?.overrides || [] ),
30+
{
31+
files: [ 'plugins/view-transitions/js/**/*.js' ],
32+
rules: {
33+
'jsdoc/no-undefined-types': [
34+
'error',
35+
{ definedTypes: [ 'PageSwapEvent', 'PageRevealEvent' ] },
36+
],
37+
},
38+
},
39+
],
2840
};
2941

3042
module.exports = config;

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 204 additions & 196 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
"@octokit/rest": "^21.1.1",
1515
"@playwright/test": "^1.51.1",
1616
"@wordpress/e2e-test-utils-playwright": "^1.21.0",
17-
"@wordpress/env": "^10.22.0",
18-
"@wordpress/prettier-config": "^4.20.0",
19-
"@wordpress/scripts": "^30.15.0",
17+
"@wordpress/env": "^10.23.0",
18+
"@wordpress/prettier-config": "^4.23.0",
19+
"@wordpress/scripts": "^30.16.0",
2020
"commander": "13.1.0",
2121
"copy-webpack-plugin": "^13.0.0",
2222
"css-minimizer-webpack-plugin": "^7.0.2",

plugins/optimization-detective/class-od-strict-url-metric.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Representation of the measurements taken from a single client's visit to a specific URL without additionalProperties allowed.
1717
*
1818
* This is used exclusively in the REST API endpoint for capturing new URL Metrics to prevent invalid additional data from being
19-
* submitted in the request. For URL Metrics which have been stored the looser OD_URL_Metric class is used instead.
19+
* submitted in the request. For URL Metrics which have been stored, the looser OD_URL_Metric class is used instead.
2020
*
2121
* @phpstan-import-type JSONSchema from OD_URL_Metric
2222
*

plugins/optimization-detective/class-od-tag-visitor-context.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function __get( string $name ) {
124124
throw new Error(
125125
esc_html(
126126
sprintf(
127-
/* translators: %s is class member variable name */
127+
/* translators: %s is the class member variable name */
128128
__( 'Unknown property %s.', 'optimization-detective' ),
129129
__CLASS__ . '::$' . $name
130130
)

plugins/optimization-detective/class-od-template-optimization-context.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function __get( string $name ) {
114114
throw new Error(
115115
esc_html(
116116
sprintf(
117-
/* translators: %s is class member variable name */
117+
/* translators: %s is the class member variable name */
118118
__( 'Unknown property %s.', 'optimization-detective' ),
119119
__CLASS__ . '::$' . $name
120120
)

plugins/optimization-detective/class-od-url-metric-group-collection.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ final class OD_URL_Metric_Group_Collection implements Countable, IteratorAggrega
5151
* value of 1, and the breakpoints are used as the maximum viewport widths for the viewport groups, with the addition of
5252
* a final viewport group which has a maximum viewport width of infinity.
5353
*
54-
* This array may be empty in which case there are no responsive breakpoints and all URL Metrics are collected in a
54+
* This array may be empty, in which case there are no responsive breakpoints, and all URL Metrics are collected in a
5555
* single group.
5656
*
5757
* @since 0.1.0
@@ -153,7 +153,7 @@ public function __construct( array $url_metrics, string $current_etag, array $br
153153
*/
154154
$this->breakpoints = $breakpoints;
155155

156-
// Set sample size.
156+
// Set the sample size.
157157
if ( $sample_size <= 0 ) {
158158
throw new InvalidArgumentException(
159159
esc_html(
@@ -211,7 +211,7 @@ public function get_sample_size(): int {
211211
}
212212

213213
/**
214-
* Gets the freshness age (TTL) for a given URL Metric..
214+
* Gets the freshness age (TTL) for a given URL Metric.
215215
*
216216
* @since 1.0.0
217217
*
@@ -224,7 +224,7 @@ public function get_freshness_ttl(): int {
224224
/**
225225
* Gets the first URL Metric group (with the lowest minimum viewport width, e.g. for mobile).
226226
*
227-
* This group normally represents viewports for mobile devices. This group always has a minimum viewport width of 0
227+
* This group normally represents viewports for mobile devices. This group always has a minimum viewport width of 0,
228228
* and the maximum viewport width corresponds to the smallest defined breakpoint returned by
229229
* {@see od_get_breakpoint_max_widths()}.
230230
*
@@ -241,7 +241,7 @@ public function get_first_group(): OD_URL_Metric_Group {
241241
*
242242
* This group normally represents viewports for desktop devices. This group always has a minimum viewport width
243243
* defined as one greater than the largest breakpoint returned by {@see od_get_breakpoint_max_widths()}.
244-
* The maximum viewport width of this group is always `null`, or in other words it is unbounded.
244+
* The maximum viewport width of this group is always `null`, or in other words, it is unbounded.
245245
*
246246
* @since 0.7.0
247247
*
@@ -404,7 +404,7 @@ public function is_every_group_populated(): bool {
404404
/**
405405
* Checks whether every group is complete (full sample of non-stale URL Metrics).
406406
*
407-
* Completeness means the full sample size of URL Metrics has been collected,
407+
* Completeness means the full sample size of URL Metrics has been collected;
408408
* none of the collected URL Metrics are stale (with a mismatching ETag or a
409409
* timestamp older than the freshness TTL).
410410
*
@@ -520,9 +520,9 @@ public function get_common_lcp_element(): ?OD_Element {
520520
/**
521521
* Gets all elements from all URL Metrics from all groups keyed by the elements' XPaths.
522522
*
523-
* This is an O(n^3) function so its results must be cached. This being said, the number of groups should be 4 (one
524-
* more than the default number of breakpoints) and the number of URL Metrics for each group should be 3
525-
* (the default sample size). Therefore, given the number (n) of visited elements on the page this will only
523+
* This is an O(n^3) function, so its results must be cached. This being said, the number of groups should be 4 (one
524+
* more than the default number of breakpoints), and the number of URL Metrics for each group should be 3
525+
* (the default sample size). Therefore, given the number (n) of visited elements on the page, this will only
526526
* end up running n*4*3 times.
527527
*
528528
* @since 0.7.0
@@ -584,8 +584,8 @@ public function get_all_element_max_intersection_ratios(): array {
584584
*
585585
* An element is positioned in the initial viewport if its `boundingClientRect.top` is less than the
586586
* `viewport.height` for any of its recorded URL Metrics. Note that even though the element may be positioned in the
587-
* initial viewport, it may not actually be visible. It could be occluded as a latter slide in a carousel in which
588-
* case it will have intersectionRatio of 0. Or the element may not be visible due to it or an ancestor having the
587+
* initial viewport, it may not actually be visible. It could be occluded as a latter slide in a carousel, in which
588+
* case it will have an intersectionRatio of 0. Or the element may not be visible due to it or an ancestor having the
589589
* `visibility:hidden` style, such as in the case of a dropdown navigation menu. When, for example, an IMG element
590590
* is positioned in any initial viewport, it should not get `loading=lazy` but rather `fetchpriority=low`.
591591
* Furthermore, the element may be positioned _above_ the initial viewport or to the left or right of the viewport,
@@ -624,7 +624,7 @@ public function get_all_elements_positioned_in_any_initial_viewport(): array {
624624
* @since 0.3.0
625625
*
626626
* @param string $xpath XPath for the element.
627-
* @return float|null Max intersection ratio of null if tag is unknown (not captured).
627+
* @return float|null Max intersection ratio or null if the tag is unknown (not captured).
628628
*/
629629
public function get_element_max_intersection_ratio( string $xpath ): ?float {
630630
return $this->get_all_element_max_intersection_ratios()[ $xpath ] ?? null;
@@ -636,7 +636,7 @@ public function get_element_max_intersection_ratio( string $xpath ): ?float {
636636
* @since 0.7.0
637637
*
638638
* @param string $xpath XPath for the element.
639-
* @return bool|null Whether element is positioned in any initial viewport of null if unknown.
639+
* @return bool|null Whether an element is positioned in any initial viewport or null if unknown.
640640
*/
641641
public function is_element_positioned_in_any_initial_viewport( string $xpath ): ?bool {
642642
return $this->get_all_elements_positioned_in_any_initial_viewport()[ $xpath ] ?? null;
@@ -651,8 +651,8 @@ public function is_element_positioned_in_any_initial_viewport( string $xpath ):
651651
*/
652652
public function get_flattened_url_metrics(): array {
653653
// The duplication of iterator_to_array is not a mistake. This collection is an
654-
// iterator and the collection contains iterator instances. So to flatten the
655-
// two levels of iterators we need to nest calls to iterator_to_array().
654+
// iterator, and the collection contains iterator instances. So to flatten the
655+
// two levels of iterators, we need to nest calls to iterator_to_array().
656656
return array_merge(
657657
...array_map(
658658
'iterator_to_array',

plugins/optimization-detective/class-od-url-metric-group.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static function ( OD_URL_Metric $a, OD_URL_Metric $b ): int {
268268
/**
269269
* Determines whether the URL Metric group is complete.
270270
*
271-
* A group is complete if it has the full sample size of URL Metrics
271+
* A group is complete if it has the full sample size of URL Metrics,
272272
* and all of these URL Metrics are fresh (with a current ETag and a
273273
* timestamp that is not older than the freshness TTL).
274274
*
@@ -322,15 +322,15 @@ public function get_lcp_element(): ?OD_Element {
322322

323323
$result = ( function () {
324324

325-
// No metrics have been gathered for this group so there is no LCP element.
325+
// No metrics have been gathered for this group, so there is no LCP element.
326326
if ( count( $this->url_metrics ) === 0 ) {
327327
return null;
328328
}
329329

330330
// The following arrays all share array indices.
331331

332332
/**
333-
* Seen breadcrumbs counts.
333+
* Seen breadcrumb counts.
334334
*
335335
* @var array<int, non-empty-string> $seen_breadcrumbs
336336
*/
@@ -350,7 +350,7 @@ public function get_lcp_element(): ?OD_Element {
350350
*/
351351
$breadcrumb_element = array();
352352

353-
// Prefer to use URL Metrics which have a current ETag.
353+
// Prefer to use URL Metrics, which have a current ETag.
354354
$url_metrics = array_filter(
355355
$this->url_metrics,
356356
function ( OD_URL_Metric $url_metric ): bool {
@@ -459,7 +459,7 @@ public function get_all_element_max_intersection_ratios(): array {
459459
* @since 0.9.0
460460
*
461461
* @param string $xpath XPath for the element.
462-
* @return float|null Max intersection ratio of null if tag is unknown (not captured).
462+
* @return float|null Max intersection ratio or null if the tag is unknown (not captured).
463463
*/
464464
public function get_element_max_intersection_ratio( string $xpath ): ?float {
465465
return $this->get_all_element_max_intersection_ratios()[ $xpath ] ?? null;

plugins/optimization-detective/class-od-url-metric.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public static function get_json_schema(): array {
208208
)
209209
);
210210

211-
// The spec allows these to be negative but this doesn't make sense in the context of intersectionRect and boundingClientRect.
211+
// The spec allows these to be negative, but this doesn't make sense in the context of intersectionRect and boundingClientRect.
212212
$dom_rect_properties['width']['minimum'] = 0.0;
213213
$dom_rect_properties['height']['minimum'] = 0.0;
214214

@@ -312,9 +312,9 @@ public static function get_json_schema(): array {
312312
),
313313
),
314314
// Additional root properties may be added to the schema via the od_url_metric_schema_root_additional_properties filter.
315-
// Therefore, additionalProperties is set to true so that additional properties defined in the extended schema may persist
315+
// Therefore, `additionalProperties` is set to true so that additional properties defined in the extended schema may persist
316316
// in a stored URL Metric even when the extension is deactivated. For REST API requests, the OD_Strict_URL_Metric
317-
// which sets this to false so that newly-submitted URL Metrics only ever include the known properties.
317+
// which sets this to false so that newly submitted URL Metrics only ever include the known properties.
318318
'additionalProperties' => true,
319319
);
320320

@@ -364,7 +364,7 @@ public static function get_json_schema(): array {
364364
protected static function extend_schema_with_optional_properties( array $properties_schema, array $additional_properties, string $filter_name ): array {
365365
$doing_it_wrong = static function ( string $message ) use ( $filter_name ): void {
366366
_doing_it_wrong(
367-
esc_html( "Filter: '{$filter_name}'" ),
367+
esc_html( "Filter: '$filter_name'" ),
368368
esc_html( $message ),
369369
'Optimization Detective 0.6.0'
370370
);

0 commit comments

Comments
 (0)