• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

azjezz / psl / 22680186990

04 Mar 2026 05:04PM UTC coverage: 97.34% (-1.0%) from 98.375%
22680186990

Pull #610

github

azjezz
perf: replace PSL calls with native PHP builtins and fix O(n2) algorithms

Signed-off-by: azjezz <azjezz@protonmail.com>
Pull Request #610: perf: replace PSL calls with native PHP builtins and fix O(n2) algorithms

319 of 355 new or added lines in 90 files covered. (89.86%)

64 existing lines in 12 files now uncovered.

9258 of 9511 relevant lines covered (97.34%)

34.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/src/Psl/Str/starts_with.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Psl\Str;
6

7
use function str_starts_with;
8

9
/**
10
 * Returns whether the string starts with the given prefix.
11
 *
12
 * @pure
13
 */
14
function starts_with(string $string, string $prefix, Encoding $encoding = Encoding::Utf8): bool
15
{
16
    if ('' === $prefix) {
49✔
17
        return false;
1✔
18
    }
19

20
    if ($encoding === Encoding::Ascii || $encoding === Encoding::Utf8) {
48✔
21
        return str_starts_with($string, $prefix);
48✔
22
    }
23

UNCOV
24
    return 0 === search($string, $prefix, 0, $encoding);
×
25
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc