https://github.com/holyshared/attribute
Attribute for Hack
https://github.com/holyshared/attribute
Last synced: 3 months ago
JSON representation
Attribute for Hack
- Host: GitHub
- URL: https://github.com/holyshared/attribute
- Owner: holyshared
- Created: 2015-10-03T09:10:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-03T15:58:33.000Z (over 10 years ago)
- Last Synced: 2025-10-07T01:58:17.407Z (8 months ago)
- Language: Hack
- Size: 156 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
attribute
====================
Attribute for Hack
[](https://packagist.org/packages/holyshared/attribute)
[](https://travis-ci.org/holyshared/attribute)
[](https://www.versioneye.com/user/projects/560ff3b5a193340015000001)
[](https://packagist.org/packages/holyshared/attribute)
ClassAttribute
--------------------
```hack
name;
}
}
```
```hack
>
class TaggedTarget
{
}
```
```hack
value()); // Tag attribute instance
$attribute = Tag::findByClass(new ReflectionClass(TaggedTarget::class));
var_dump($attribute->value()); // Tag attribute instance
```
MethodAttribute
--------------------
```hack
name;
}
}
```
```hack
>
public function getName() : string
{
return $this->name;
}
}
```
```hack
at('getName')->value()); // important
$attributes = Tag::findByClass(new ReflectionClass(TaggedTarget::class));
var_dump($attributes->at('getName')->value()); // important
$attribute = Tag::findByMethod(new ReflectionMethod(TaggedTarget::class, 'getName'));
var_dump($attribute->value()); // important
```
Run the test
--------------------
composer install
composer test