Enforce null coalescing operator ?? instead of a ternary operator through phpcs

Created on 8 May 2024, 2 months ago
Updated 23 May 2024, about 2 months ago

Problem/Motivation

#3074131: Use null coalescing operator ?? instead of a ternary operator with an isset() condition β†’ landed, so we should enforce this. The change to null coallescing operator was already done in core a while back in #3222251: [November 8, 2021] Replace all isset constructs with the null coalescing operator β†’ . But now we need to enable SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator.

Steps to reproduce

Add SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator to phpcs.xml.dist and run codestle.

Proposed resolution

Add SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator to phpcs.xml.dist

Remaining tasks

Add SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator to phpcs.xml.dist
Fix possible violations

User interface changes

n.a.

API changes

n.a.

Data model changes

n.a.

Release notes snippet

Using null coalescing operator ?? instead of a ternary operator is now enforced in core.

πŸ“Œ Task
Status

Fixed

Version

10.3 ✨

Component
OtherΒ  β†’

Last updated about 5 hours ago

Created by

πŸ‡³πŸ‡±Netherlands bbrala Netherlands

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024