Skip to content

Commit

Permalink
Prevent error if doing_it_wrong is called with a non string version.
Browse files Browse the repository at this point in the history
In rare cases a doing_it_wrong is passed no version, null or number. This is bad
 practice but don't want to throw if we're already catching.
  • Loading branch information
lipemat committed Sep 9, 2024
1 parent 72ad64d commit e0b726b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/src/Helpers/Doing_It_Wrong.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public function get_expected( string $function_name ): ?array {
}


public function catch( string $function_name, string $message, string $version ): void {
if ( '' !== $version ) {
public function catch( string $function_name, string $message, $version ): void {
if ( '' !== $version && null !== $version ) {
$message .= ' ' . \sprintf( '(This message was added in version %s.)', $version );
}
if ( ! isset( $this->caught[ $function_name ] ) ) {
Expand Down

0 comments on commit e0b726b

Please sign in to comment.