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

Created on 20 December 2022, almost 2 years ago
Updated 27 January 2023, almost 2 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

Fixed

Version

10.1 ✨

Component
OtherΒ  β†’

Last updated 5 minutes ago

Created by

πŸ‡ΊπŸ‡ΈUnited States xjm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

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