Closed (duplicate)
Project:
Drupal core
Version:
11.x-dev
Component:
other
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
24 Aug 2023 at 20:45 UTC
Updated:
25 Aug 2023 at 10:27 UTC
Jump to comment: Most recent
Use new PHP 8 function str_contains instead. More readable, less instructions, and more efficient.
Some examples,
In lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php:122:
- return strpos($label, $match) !== FALSE;
+ return str_contains($label, $match);In lib/Drupal/Core/Routing/RouteCompiler.php:101:
- if (strpos($part, '{') === FALSE) {
+ if (!str_contains($part, '{')) {
Comments
Comment #2
cilefen commentedComment #3
cilefen commentedIs this part of #3324560: Replace strpos/substr with str_starts_with() / str_contains() / str_ends_with() or a duplicate?
Comment #4
cilefen commentedThe original issue has a plan and a merge request.
Comment #5
chris64OK.