Shorten $exception->getStatusCode() implementation

Created on 16 March 2023, almost 2 years ago
Updated 24 March 2023, almost 2 years ago

Problem/Motivation

($exception->getStatusCode() === 404 || $exception->getStatusCode() === 403)

is long, harder to read and making two function calls.

In such cases it's better to use an array for the values (like an SQL "IN"):

in_array($exception->getStatusCode(), [403, 404])

as in_array()'s second parameter is set to non-strict by default, we don't have to care for data types. So we keep them like before.

Steps to reproduce

Proposed resolution

Use

in_array($exception->getStatusCode(), [403, 404])

instead, see MR.

Remaining tasks

  1. Review
  2. Merge
  3. Cherry-pick into 3.0.x

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

4.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

Production build 0.71.5 2024