Stop passing ints to DateTimePlus::createFromFormat and DrupalDateTime::createFromFormat

Created on 10 September 2024, 3 months ago
Updated 11 September 2024, 3 months ago

Problem/Motivation

DateTimePlus::createFromFormat accepts a string representing the time, but in \Drupal\Tests\Component\Datetime\DateTimePlusTest an int is passed 12 times.

To resolve πŸ“Œ Fix strict type errors detected by phpstan Active we need to pass the correct type.

Steps to reproduce

Add to phpstan.neon.dist:

parameters:
  checkFunctionArgumentTypes: true

Run phpstan

Grep output for something like this:
grep "createFromFormat" output.txt

Proposed resolution

It feels awkward using a string to represent a unix timestap. Instead we can pass ints directly to DateTimePlus::createFromTimestamp.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

RTBC

Version

11.0 πŸ”₯

Component
DatetimeΒ  β†’

Last updated 2 days ago

Created by

πŸ‡¦πŸ‡ΊAustralia mstrelan

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024