Closed jjarolim closed 1 year ago
That's because you cannot use attributes in PHP 7.4 Use annotations instead (or XML mapping or yaml)
Ah OK thanks!
For the first try I just copied the package configuration from the documentation page Basic usage without questioning what
metadata:
type: attribute
means.
Maybe some clarification in the sample would be cool:
metadata:
type: attribute # PHP 8: Use attributes @see https://www.php.net/manual/en/language.attributes.overview.php
But nevertheless many thanks for the help!
Best regards from Salzburg,
Johannes
Documentation in master is for latest release. For 1.21 you need to check docs in 1.x branch.
Bug Report
Summary
After installing VichUploaderBundle via composer, symfony throws the following error:
Attempted to call an undefined method named "getAttributes" of class "ReflectionClass" in AttributeReader.php line 20.
It seems that ReflectionClass::getAttributes was introduced in PHP 8 and is not available in PHP 7.4: https://www.php.net/manual/en/reflectionclass.getattributes.php
composer.json
php requirement and platform config would be set to 7.4:Current behavior
Project throws compile time exception
How to reproduce
Just install bundle on a fresh symfony 5.4 project on PHP 7.4.x
Expected behavior
No usage of that method on PHP < 8