Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8, #[Attribute] in front of class_alias #149

Open
rotdrop opened this issue Jun 13, 2021 · 0 comments
Open

PHP 8, #[Attribute] in front of class_alias #149

rotdrop opened this issue Jun 13, 2021 · 0 comments

Comments

@rotdrop
Copy link

rotdrop commented Jun 13, 2021

Hi,

I'm using https://github.com/humbug/php-scoper to decouple some composer package requirements from an ambient cloud-software (Nextcloud). ATM this results also in wrapping some Symfony polyfill stuff.

The error message is as follows

ac-php: An error occurred during to re-index: 
PHPParser: Syntax error, unexpected T_NAME_FULLY_QUALIFIED on line 24 - /var/www/localhost/htdocs/nextcloud-git/apps/cafevdb/vendor-wrapped/symfony/polyfill-php80/Resources/stubs/Attribute.php

The offending lines are:

#[Attribute(Attribute::TARGET_CLASS)]
\class_alias('OCA\\CAFEVDB\\Wrapped\\Attribute', 'Attribute', \false);

And finally the complete source:

<?php

namespace OCA\CAFEVDB\Wrapped;

#[Attribute(Attribute::TARGET_CLASS)]
final class Attribute
{
    public const TARGET_CLASS = 1;
    public const TARGET_FUNCTION = 2;
    public const TARGET_METHOD = 4;
    public const TARGET_PROPERTY = 8;
    public const TARGET_CLASS_CONSTANT = 16;
    public const TARGET_PARAMETER = 32;
    public const TARGET_ALL = 63;
    public const IS_REPEATABLE = 64;
    /** @var int */
    public $flags;
    public function __construct(int $flags = self::TARGET_ALL)
    {
        $this->flags = $flags;
    }
}
#[Attribute(Attribute::TARGET_CLASS)]
\class_alias('OCA\\CAFEVDB\\Wrapped\\Attribute', 'Attribute', \false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant