[policy, no patch] Add exception for PHP attributes in the named arguments policy

Created on 15 March 2023, almost 2 years ago
Updated 8 April 2024, 9 months ago

Problem/Motivation

As of 🌱 [policy, no patch] Document named arguments BC policy Fixed named arguments are considered internal API. However, longwave pointed out in #3183180-24: [policy, no patch] Document named arguments BC policy β†’ , an exception is needed. Here is that comment copied in full for convenience.

We will need an exception when πŸ“Œ Use PHP attributes instead of doctrine annotations Fixed lands, as named arguments in attributes are part of the API, by design.

The proposed Block attribute constructor is:

<?php
  public function __construct(
    public readonly string $id,
    public readonly ?TranslatableMarkup $admin_label = NULL,
    public readonly ?TranslatableMarkup $category = NULL,
    public readonly array $context_definitions = [],
    public readonly ?string $deriver = NULL,
    public readonly array $forms = []
  ) {}
?>

This is then invoked with named arguments:

<?php
#[Block(
  id: "page_title_block",
  admin_label: new TranslatableMarkup("Page title"),
  forms: [
    'settings_tray' => FALSE,
  ]
)]
?>

Steps to reproduce

Proposed resolution

Add an exception to the policy for PHP attributes.

TBA - proposed text

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🌱 Plan
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated 2 days ago

Created by

πŸ‡³πŸ‡ΏNew Zealand quietone

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024