From 4dedef137884df486c9cfa597b6708285ae42290 Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Wed, 9 Sep 2026 16:48:10 -0700 Subject: [PATCH 1/2] [Dependencies] Update to `league/commonmark` 2.10.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c08d406..547d0df 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "danielescherzer/commonmark-ext-pygments-highlighter": "0.2.0", "danielescherzer/html-builder": "0.0.2", "nikic/fast-route": "1.3.0", - "league/commonmark": "2.9.1", + "league/commonmark": "2.10.1", "ramsey/pygments": "3.0.0", "symfony/yaml": "7.4.12" }, From b80abcf133804b4b32777f837ce89bac9eb52409 Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Wed, 9 Sep 2026 16:49:24 -0700 Subject: [PATCH 2/2] bless --- tests/data/blog-highlighting.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/data/blog-highlighting.html b/tests/data/blog-highlighting.html index 50d63bd..df63d6a 100644 --- a/tests/data/blog-highlighting.html +++ b/tests/data/blog-highlighting.html @@ -17,14 +17,14 @@
  • Next steps
  • -

    Attributes on constants

    Tuesday, 29 April 2025 +

    Attributes on constants

    Tuesday, 29 April 2025

    Earlier today, the attributes-on-constants RFC implementation was finally merged. This was a project I worked on for months and a significant reason I became more active as a PHP core developer. The initial motivation was to add a way for constants to be marked as deprecated, so that MediaWiki could use that feature to signal deprecated constants instead of relying solely on documentation.

    -

    Background

    +

    Background

    PHP 8 introduced support for attributes, which allowed recording metadata for classes, functions, methods, class properties, class constants, and function parameters. In my presentation at the Fall 2024 edition of the @@ -56,7 +56,7 @@

    Feature

    +

    Feature

    The feature presented in the RFC is to allow using attributes on compile-time non-class constants. By "compile-time", I meant constants that were declared like

    @@ -77,7 +77,7 @@

    define() that would allow passing in attributes but not evaluating them was something that I thought would be trickier; in retrospect, it might have been easier than adding support for attributes on the const-defined constants.

    -

    Compile time or not

    +

    Compile time or not

    The line between compile-time and run-time constants is not as straightforward as just the use of const or the use of define().

    Consider the following PHP file (include_class.php):

    @@ -148,7 +148,7 @@

    at runtime, something that wasn't previously done because all other supported attribute targets were compile-time constructs (classes, functions, parameters, etc.).

    -

    Optimization of define()

    +

    Optimization of define()

    The line gets even blurrier when looking at PHP's built-in optimizer. As part of "pass 1" with simple local optimizations (pass1.c as of merge), for any function call where

    @@ -165,7 +165,7 @@

    Implementation

    +

    Implementation

    If you want to take a look at the actual code, the implementing PR is available on GitHub. I'm not going to explain it in depth here, just with broad strokes. The first three parts are for general attribute support, the last @@ -189,7 +189,7 @@

    Using

    +

    Using

    Now that constants support attributes, developers can apply userland attributes to their constants to add various metadata. But, for me, the real power is in the attributes that PHP itself provides, since those are able to hook into parts @@ -214,7 +214,7 @@

    My hope is that MediaWiki and other libraries will apply this attribute to send warnings where previously only documentation could be used to indicate deprecations.

    -

    Backwards compatibility

    +

    Backwards compatibility

    However, using this attribute in MediaWiki, and more generally, in any tool that supports versions of PHP before 8.5 (which isn't even out yet!) presents a problem: because using attributes on constants requires syntax that was invalid @@ -256,7 +256,7 @@

    In PHP stubs

    +

    In PHP stubs

    Now that constants can be deprecated with attributes, the various constants that PHP provides can be updated with more informative error messages by adding the attribute to those internal constants. This would mirror the addition of the @@ -283,7 +283,7 @@

    Next steps

    +

    Next steps

    Now that it is possible to have the engine trigger deprecation notices for global constants, I've started looking into the other places where #[\Deprecated] support would be useful, either for MediaWiki or for libraries