Am 09.06.2020 um 17:57 schrieb Theodore Brown:
That's an interesting argument. After thinking about it more, though,
I'm not sure I understand what the benefit would be. The docblock
annotation needed for PHP 7 is *already* forward compatible with PHP 8.
So wouldn't this just be duplicating the attribute and opening the
possibility for them to be out of sync for no benefit?

This would allow the introduction of classes into PHPUnit such as

    namespace PHPUnit\Attribute;

    #[Attribute]
    final class Covers
    {
        private string $coverageTarget;

        public function __construct(string $coverageTarget)
        {
            $this->coverageTarget = $coverageTarget;
        }

        // ...
    }

that can be used to encapsulate information that may come from a ...

    /**
     * @covers \Foo\Bar\Baz
     */

... DocBlock-style annotation in PHP 7 but may also come from an ...

    #[Covers(Baz::class)]

... attribute when PHP 8 is used.

This would make forward compatibility possible in code such as PHPUnit's that currently supports DocBlock-style annotations but wants to support PHP 8 attributes and to deprecate (and later remove) support for DocBlock-style annotations.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to