Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ includes:
- tests/phpstan/baselines/booleanOr.alwaysFalse.neon
- tests/phpstan/baselines/booleanOr.alwaysTrue.neon
- tests/phpstan/baselines/booleanOr.rightAlwaysTrue.neon
- tests/phpstan/baselines/catch.neverThrown.neon
- tests/phpstan/baselines/class.notFound.neon
- tests/phpstan/baselines/deadCode.unreachable.neon
- tests/phpstan/baselines/empty.offset.neon
Expand Down
2 changes: 0 additions & 2 deletions src/wp-admin/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,6 @@
wp_admin_notice( __( 'Plugin deactivated.' ), $updated_notice_args );
} elseif ( isset( $_GET['deactivate-multi'] ) ) {
wp_admin_notice( __( 'Selected plugins deactivated.' ), $updated_notice_args );
} elseif ( 'update-selected' === $action ) {
wp_admin_notice( __( 'All selected plugins are up to date.' ), $updated_notice_args );
} elseif ( isset( $_GET['resume'] ) ) {
wp_admin_notice( __( 'Plugin resumed.' ), $updated_notice_args );
} elseif ( isset( $_GET['enabled-auto-update'] ) ) {
Expand Down
19 changes: 13 additions & 6 deletions src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,8 @@ private function bail( string $message ) {
* @see self::ERROR_UNSUPPORTED
* @see self::ERROR_EXCEEDED_MAX_BOOKMARKS
*
* @phpstan-impure
*
* @return string|null The last error, if one exists, otherwise null.
*/
public function get_last_error(): ?string {
Expand Down Expand Up @@ -804,7 +806,7 @@ public function next_token(): bool {
private function next_visitable_token(): bool {
$this->current_element = null;

if ( isset( $this->last_error ) ) {
if ( null !== $this->get_last_error() ) {
return false;
}

Expand All @@ -823,7 +825,7 @@ private function next_visitable_token(): bool {
return $this->next_visitable_token();
}

if ( isset( $this->last_error ) ) {
if ( null !== $this->get_last_error() ) {
return false;
}
}
Expand Down Expand Up @@ -1019,7 +1021,7 @@ public function expects_closer( ?WP_HTML_Token $node = null ): ?bool {
*/
public function step( $node_to_process = self::PROCESS_NEXT_NODE ): bool {
// Refuse to proceed if there was a previous error.
if ( null !== $this->last_error ) {
if ( null !== $this->get_last_error() ) {
return false;
}

Expand Down Expand Up @@ -1063,7 +1065,7 @@ public function step( $node_to_process = self::PROCESS_NEXT_NODE ): bool {
try {
$bookmark_name = $this->bookmark_token();
} catch ( Exception $e ) {
if ( self::ERROR_EXCEEDED_MAX_BOOKMARKS === $this->last_error ) {
if ( self::ERROR_EXCEEDED_MAX_BOOKMARKS === $this->get_last_error() ) {
return false;
}
throw $e;
Expand Down Expand Up @@ -1175,7 +1177,7 @@ public function step( $node_to_process = self::PROCESS_NEXT_NODE ): bool {
*/
return false;
} catch ( Exception $e ) {
if ( self::ERROR_EXCEEDED_MAX_BOOKMARKS === $this->last_error ) {
if ( self::ERROR_EXCEEDED_MAX_BOOKMARKS === $this->get_last_error() ) {
return false;
}
// Rethrow any other exceptions for higher-level handling.
Expand Down Expand Up @@ -1633,6 +1635,7 @@ private function step_initial(): bool {
* @since 6.7.0
* @ignore
*
* @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
*
* @see https://html.spec.whatwg.org/#the-before-html-insertion-mode
Expand Down Expand Up @@ -1733,6 +1736,7 @@ private function step_before_html(): bool {
* @since 6.7.0
* @ignore
*
* @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
*
* @see https://html.spec.whatwg.org/#the-before-head-insertion-mode
Expand Down Expand Up @@ -2163,6 +2167,7 @@ private function step_in_head_noscript(): bool {
* @since 6.7.0
* @ignore
*
* @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
*
* @see https://html.spec.whatwg.org/#the-after-head-insertion-mode
Expand Down Expand Up @@ -3431,6 +3436,7 @@ private function in_body_any_other_end_tag(): bool {
* @since 6.7.0
* @ignore
*
* @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
*
* @see https://html.spec.whatwg.org/#parsing-main-intable
Expand Down Expand Up @@ -3905,6 +3911,7 @@ private function step_in_column_group(): bool {
* @since 6.7.0
* @ignore
*
* @throws Exception When unable to allocate a bookmark for the next token in the input HTML document.
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
*
* @see https://html.spec.whatwg.org/#parsing-main-intbody
Expand Down Expand Up @@ -5166,7 +5173,7 @@ public function get_namespace(): string {
* @return string|null Name of currently matched tag in input HTML, or `null` if none found.
*/
public function get_tag(): ?string {
if ( null !== $this->last_error ) {
if ( null !== $this->get_last_error() ) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function check_reassign( $value, $request, $param ) {
return $value;
}

if ( empty( $value ) || false === $value || 'false' === $value ) {
if ( empty( $value ) || 'false' === $value ) {
return false;
}

Expand Down
25 changes: 0 additions & 25 deletions tests/phpstan/baselines/catch.neverThrown.neon

This file was deleted.

15 changes: 0 additions & 15 deletions tests/phpstan/baselines/identical.alwaysFalse.neon
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,8 @@

parameters:
ignoreErrors:
-
message: '#^Strict comparison using \=\=\= between ''update\-selected'' and mixed~\(''activate''\|''activate\-selected''\|''deactivate''\|''deactivate\-selected''\|''delete\-selected''\|''disable\-auto\-update''\|''disable\-auto\-update\-selected''\|''enable\-auto\-update''\|''enable\-auto\-update\-selected''\|''error_scrape''\|''resume''\|''update\-selected''\) will always evaluate to false\.$#'
identifier: identical.alwaysFalse
count: 1
path: ../../../src/wp-admin/plugins.php
-
message: '#^Strict comparison using \=\=\= between ''exceeded\-max…'' and null will always evaluate to false\.$#'
identifier: identical.alwaysFalse
count: 1
path: ../../../src/wp-includes/html-api/class-wp-html-processor.php
-
message: '#^Strict comparison using \=\=\= between 3000000000 and 2147483647 will always evaluate to false\.$#'
identifier: identical.alwaysFalse
count: 1
path: ../../../src/wp-includes/pluggable.php
-
message: '#^Strict comparison using \=\=\= between false and mixed will always evaluate to false\.$#'
identifier: identical.alwaysFalse
count: 1
path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
Loading