Ensure getWidth()/getHeigth always return ?int

Created on 29 August 2024, 4 months ago
Updated 5 September 2024, 4 months ago

Problem/Motivation

getWidth() and getHeigth() methods in the image system shoud return int or null, but getimagesize() returns an array with width and height as strings.

This causes problems because the returned type is not as expected and any downstream code that uses strict typing may fail with TypeErrors.

Proposed resolution

Build around the process for adding new arguments described in https://www.drupal.org/about/core/policies/core-change-policies/how-to-d... to extend it to manage return typehints:

  1. pre-typehint the return types in the interfaces so that in Drupal 12 these could be finalized
  2. add an issue to do the change to the interfaces in next major
  3. typehint return types in implementing classes
  4. add tests where appropriate

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Postponed

Version

11.0 🔥

Component
Image system 

Last updated 1 day ago

Created by

🇮🇹Italy mondrake 🇮🇹

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

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024