Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add return description
Co-authored-by: Felix Arntz <felixarntz@google.com>
  • Loading branch information
westonruter and felixarntz authored Sep 10, 2024
commit 22711e42308b47cba5f61f1f51fb89dd89e8f889
2 changes: 1 addition & 1 deletion plugins/optimization-detective/class-od-url-metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ protected static function extend_schema_with_optional_properties( array $propert
* @todo Instead of returning null when the key doesn't exist, should the `default` value be returned as defined in the schema?
*
* @param string $key Property.
* @return mixed|null
* @return mixed|null The property value, or null if not set.
*/
public function get( string $key ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could make use of generics to specify the expected return type given the input $key.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not, as then attempting to access an extended property will result in a PHPStan error.

return $this->data[ $key ] ?? null;
Expand Down