Skip to content

Commit

Permalink
Prevent errors on code introduced on #262
Browse files Browse the repository at this point in the history
  • Loading branch information
bordoni committed Sep 22, 2023
1 parent bb320c2 commit e73538e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions checks/phpcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ protected function phpcs_result_to_warnings( $result ) {
}

$source_code = esc_html( trim( file( $this->path . '/' . $filename )[ $message['line'] - 1 ] ) );
if ( current_user_can( 'edit_plugins' ) {

if ( current_user_can( 'edit_plugins' ) ) {
$edit_link = sprintf(
'<a href="%1$s" title="%2$s" aria-label="%2$s" target="_blank">%3$s</a>',
$this->get_file_editor_url( $filename, $message['line'] ),
Expand All @@ -132,7 +133,7 @@ protected function phpcs_result_to_warnings( $result ) {
$filename,
rtrim( $message['message'], '.' ),
"<pre class='wp-plugin-check-code'><code>{$source_code}</code></pre>",
$edit_link
$edit_link ?? ''
)
);
}
Expand Down

0 comments on commit e73538e

Please sign in to comment.