Skip to content

Commit

Permalink
Merge remote-tracking branch 'starter/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz committed Nov 13, 2024
2 parents a778f11 + cddeb03 commit 67635e9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions php-tools/lint/phpstan-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,25 @@ function str_starts_with( $haystack, $needle ) {
return 0 === strpos( $haystack, $needle );
}
}

if ( ! function_exists( 'str_ends_with' ) ) {
function str_ends_with( $haystack, $needle ) {
if ( '' === $haystack ) {
return '' === $needle;
}

$len = strlen( $needle );

return substr( $haystack, -$len, $len ) === $needle;
}
}

if ( ! function_exists( 'str_contains' ) ) {
function str_contains( $haystack, $needle ) {
if ( '' === $needle ) {
return true;
}

return false !== strpos( $haystack, $needle );
}
}

0 comments on commit 67635e9

Please sign in to comment.