Fabien Potencier ba5875b575 minor #4315 Add more precise types for the registration of safe classes (stof)
This PR was merged into the 3.x branch.

Discussion
----------

Add more precise types for the registration of safe classes

Safe classes only impact the auto-escaping of the string casting of instance of those classes.
By defining that this method only expects names of stringable classes, it allows static analysis tools to report non-working configurations (for instance for people thinking this would impact the auto-escaping for values returned by getters of a safe class, as in https://github.com/twigphp/Twig/issues/4113 for instance).

The method technically support prefixing the class name with a `\`. Static analyzers would reject such string when checking for `class-string`. However, I think this is fine. Projects wanting to use a SA tool are probably already using the `::class` constant anyway to refer to class names (and otherwise, removing the leading `\` in their string literal is easy)

Commits
-------

8330936415 Add more precise types for the registration of safe classes
2024-09-13 13:08:24 +02:00
2024-08-10 12:32:24 +02:00
2024-09-13 08:15:49 +02:00
2024-09-10 08:27:46 +02:00
2024-09-11 11:55:09 +02:00
2024-09-11 11:55:09 +02:00
2024-08-10 12:32:24 +02:00
2024-09-03 10:17:14 +02:00
2023-12-09 12:45:27 +01:00

Twig, the flexible, fast, and secure template language for PHP
==============================================================

Twig is a template language for PHP.

Twig uses a syntax similar to the Django and Jinja template languages which
inspired the Twig runtime environment.

Sponsors
--------

.. raw:: html

    <a href="https://docs.blackfire.io/introduction?utm_source=twig&utm_medium=github_readme&utm_campaign=logo">
        <img src="https://static.blackfire.io/assets/intemporals/logo/png/blackfire-io_secondary_horizontal_transparent.png?1" width="255px" alt="Blackfire.io">
    </a>

More Information
----------------

Read the `documentation`_ for more information.

.. _documentation: https://twig.symfony.com/documentation
Languages
PHP 99.9%