Skip to content

Commit bb59c17

Browse files
committed
chore: improve doctypes /type safety for WP_Screen properties
1 parent dd2d7ef commit bb59c17

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/wp-admin/includes/class-wp-screen.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,10 @@ final class WP_Screen {
175175
/**
176176
* Stores the result of the public show_screen_options function.
177177
*
178+
* Set when calling ::show_screen_options() for the first time.
179+
*
178180
* @since 3.3.0
179-
* @var bool
181+
* @var ?bool
180182
*/
181183
private $_show_screen_options;
182184

@@ -545,7 +547,7 @@ public function get_options() {
545547
* @param string $option Option name.
546548
* @param string|false $key Optional. Specific array key for when the option is an array.
547549
* Default false.
548-
* @return string The option value if set, null otherwise.
550+
* @return ?string The option value if set, null otherwise.
549551
*/
550552
public function get_option( $option, $key = false ) {
551553
if ( ! isset( $this->_options[ $option ] ) ) {
@@ -598,7 +600,7 @@ public function get_help_tabs() {
598600
* @since 3.4.0
599601
*
600602
* @param string $id Help Tab ID.
601-
* @return array Help tab arguments.
603+
* @return ?array Help tab arguments.
602604
*/
603605
public function get_help_tab( $id ) {
604606
if ( ! isset( $this->_help_tabs[ $id ] ) ) {
@@ -733,7 +735,7 @@ public function get_screen_reader_content() {
733735
* @since 4.4.0
734736
*
735737
* @param string $key Screen reader text array named key.
736-
* @return string Screen reader text string.
738+
* @return ?string Screen reader text string. Null if no text is associated with the key.
737739
*/
738740
public function get_screen_reader_text( $key ) {
739741
if ( ! isset( $this->_screen_reader_content[ $key ] ) ) {
@@ -950,7 +952,7 @@ public function render_screen_meta() {
950952
$this->columns = (int) get_user_option( "screen_layout_$this->id" );
951953

952954
if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) {
953-
$this->columns = $this->get_option( 'layout_columns', 'default' );
955+
$this->columns = (int) $this->get_option( 'layout_columns', 'default' );
954956
}
955957
}
956958
$GLOBALS['screen_layout_columns'] = $this->columns; // Set the global for back-compat.

0 commit comments

Comments
 (0)