https://github.com/psalm/psalm-attributes
A repository for PHP 8 Attributes that you can use with Psalm
https://github.com/psalm/psalm-attributes
Last synced: 10 months ago
JSON representation
A repository for PHP 8 Attributes that you can use with Psalm
- Host: GitHub
- URL: https://github.com/psalm/psalm-attributes
- Owner: psalm
- Created: 2020-10-30T06:00:52.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-02T17:30:29.000Z (over 5 years ago)
- Last Synced: 2024-08-08T23:41:27.373Z (almost 2 years ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 19
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# psalm-attributes
A repository for PHP 8 Attributes that you can use with Psalm.
## Installation
The potential for PHP 8's runtime attribute reflection somewhere in your codebase makes this complicated.
If the following code exists your codebase:
```php
function getClassAttributes(string $className) {
foreach ((new ReflectionClass($className))->getAttributes() as $attr) {
$attr->newInstance();
}
}
```
_And_ there’s a possibility it might load classes with these particular attributes then install with
```
composer require psalm/attributes:*
```
If you’re not planning to use any runtime attribute reflection (and nobody might use it on your library/package classes) then it should be safe to install with
```
composer require --dev psalm/attributes
```