-
Notifications
You must be signed in to change notification settings - Fork 142
Description
Feature Description
For #1466 we introduced the etag property for the URL Metric (#1705, #1722). At the time, we made it optional so as to avoid invaliding all existing URL Metrics. See #1466 (comment). However, now that URL Metrics have been collected for a few months, we can safely now make etag a required property of the URL Metric.
For example, this method can now return non-empty-string instead of non-empty-string|null:
performance/plugins/optimization-detective/class-od-url-metric.php
Lines 432 to 442 in d44b4c1
| /** | |
| * Gets ETag. | |
| * | |
| * @since 0.9.0 | |
| * | |
| * @return non-empty-string|null ETag. | |
| */ | |
| public function get_etag(): ?string { | |
| // Since the ETag is optional for now, return null for old URL Metrics that do not have one. | |
| return $this->data['etag'] ?? null; | |
| } |
Similarly here:
| * etag?: non-empty-string, |
And here:
performance/plugins/optimization-detective/class-od-url-metric.php
Lines 214 to 222 in d44b4c1
| 'etag' => array( | |
| 'description' => __( 'The ETag for the URL Metric.', 'optimization-detective' ), | |
| 'type' => 'string', | |
| 'pattern' => '^[0-9a-f]{32}\z', | |
| 'minLength' => 32, | |
| 'maxLength' => 32, | |
| 'required' => false, // To be made required in a future release. | |
| 'readonly' => true, // Omit from REST API. | |
| ), |
And this condition can be removed:
performance/plugins/optimization-detective/class-od-url-metric-group.php
Lines 289 to 292 in d44b4c1
| // The ETag is not populated yet, so this is stale. Eventually this will be required. | |
| if ( $url_metric->get_etag() === null ) { | |
| return false; | |
| } |
There's probably a few other impacted bits of code.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status