Skip to content

Commit

Permalink
Use str_contains instead of strpos
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Dec 21, 2023
1 parent 1ab89fd commit eaca180
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions includes/Checker/Checks/Plugin_Readme_Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ private function check_default_text( Check_Result $result, string $readme_file,
$donate_link = $parser->donate_link;

Check warning on line 102 in includes/Checker/Checks/Plugin_Readme_Check.php

View check run for this annotation

Codecov / codecov/patch

includes/Checker/Checks/Plugin_Readme_Check.php#L99-L102

Added lines #L99 - L102 were not covered by tests

if (
in_array( 'tags', $tags, true )
|| strpos( $short_description, 'Here is a short description of the plugin.' ) !== false
|| strpos( $donate_link, '//example.com/' ) !== false
in_array( 'tag1', $tags, true )
|| str_contains( $short_description, 'Here is a short description of the plugin.' )
|| str_contains( $donate_link, '//example.com/' )

Check warning on line 107 in includes/Checker/Checks/Plugin_Readme_Check.php

View check run for this annotation

Codecov / codecov/patch

includes/Checker/Checks/Plugin_Readme_Check.php#L105-L107

Added lines #L105 - L107 were not covered by tests
) {
$this->add_result_warning_for_file(
$result,
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ parameters:
message: '/^Function str_contains not found.$/'
paths:
- includes/Checker/Checks/Abstract_File_Check.php
- includes/Checker/Checks/Plugin_Readme_Check.php
- includes/Traits/Find_Readme.php
- includes/Traits/File_Editor_URL.php

0 comments on commit eaca180

Please sign in to comment.