Replace most strpos() === 0 or !== 0 with str_starts_with()

Created on 20 December 2022, about 3 years ago
Updated 20 January 2023, almost 3 years ago

Problem/Motivation

Part of 🌱 Replace strpos/substr with PHP 8's str_starts_with() / str_contains() / str_ends_with() Active .

Proposed resolution

  1. Replace strpos($a, $b) === 0 with str_starts_with($a, $b)
  2. Replace strpos($a, $b) !== 0 with !str_starts_with($a, $b)
  3. A few are deliberately omitted where they would cause merge conflicts with other child issues.

Remaining tasks

  • When reviewing, consider using git diff --color-words or git diff --porecelain.
  • Pay attention to the !. It should be in the expression once either before the change or after the change.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

πŸ“Œ Task
Status

Needs review

Version

10.1 ✨

Component
OtherΒ  β†’

Last updated 4 months ago

Created by

πŸ‡ΊπŸ‡ΈUnited States xjm

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024