Skip to content

Commit 1a0d9ca

Browse files
Simplify by using null coalescing operator
Co-authored-by: Weston Ruter <[email protected]>
1 parent e23c08a commit 1a0d9ca

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/wp-includes/class-wp-script-modules.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -938,14 +938,10 @@ private function sort_item_dependencies( string $id, array $import_types, array
938938
* @since 7.0.0
939939
*
940940
* @param string $id The script module identifier.
941-
* @return string|false The script module source URL, or false if not registered.
941+
* @return string|null The script module source URL, or null if not registered.
942942
*/
943-
public function get_registered_src( string $id ) {
944-
if ( ! isset( $this->registered[ $id ] ) ) {
945-
return false;
946-
}
947-
948-
return $this->registered[ $id ]['src'];
943+
public function get_registered_src( string $id ): ?string {
944+
return $this->registered[ $id ]['src'] ?? null;
949945
}
950946

951947
/**

0 commit comments

Comments
 (0)