This error occurred for me when trying to add a new field to a content type. I removed the 'string' type declaration for these constants:

Before:


class DateTimeDayItem extends DateTimeItem {

  /**
   * Values for the 'time_type' setting: store only a time, time & seconds.
   */
  const string DATEDAY_TIME_DEFAULT_TYPE_FORMAT = 'time';
  const string DATE_TIME_DAY_H_I_FORMAT_STORAGE_FORMAT = 'H:i';
  const string DATEDAY_TIME_TYPE_SECONDS_FORMAT = 'time_seconds';
  const string DATE_TIME_DAY_H_I_S_FORMAT_STORAGE_FORMAT = 'H:i:s';

After:


class DateTimeDayItem extends DateTimeItem {

  /**
   * Values for the 'time_type' setting: store only a time, time & seconds.
   */
  const DATEDAY_TIME_DEFAULT_TYPE_FORMAT = 'time';
  const DATE_TIME_DAY_H_I_FORMAT_STORAGE_FORMAT = 'H:i';
  const DATEDAY_TIME_TYPE_SECONDS_FORMAT = 'time_seconds';
  const DATE_TIME_DAY_H_I_S_FORMAT_STORAGE_FORMAT = 'H:i:s';

Comments

todea created an issue. See original summary.

andriy khomych’s picture

Status: Active » Postponed (maintainer needs more info)

Hey Tom O'Dea!
Please refer to Drupal 11 requirements.
https://www.drupal.org/docs/getting-started/system-requirements/php-requ...
It means that we need to use PHP 8.2
Maybe I should release a separate major version, but I think it makes more sense update to PHP 8.2 as it is widely supported by Drupal.

todea’s picture

I see. PHP 8.3 supports typed constants. We got this error in an environment with 8.2

andriy khomych’s picture

My bad, it seems it was introduced in PHP 8.3

andriy khomych’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.