Skip to content

Commit

Permalink
Issue #3328457 by xjm, dimitriskr: Replace most substr($a, $i) where …
Browse files Browse the repository at this point in the history
…$i is negative with str_ends_with()
  • Loading branch information
catch committed Jan 11, 2024
1 parent 46393bc commit 775c5a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ManageGitIgnore.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected function addToGitIgnore($dir, array $entries) {
// Appending to existing .gitignore files.
if (file_exists($git_ignore_path)) {
$contents = file_get_contents($git_ignore_path);
if (!empty($contents) && substr($contents, -1) != "\n") {
if (!empty($contents) && !str_ends_with($contents, "\n")) {
$contents .= "\n";
}
}
Expand Down

0 comments on commit 775c5a5

Please sign in to comment.