An open API service indexing awesome lists of open source software.

https://github.com/holyshared/attribute

Attribute for Hack
https://github.com/holyshared/attribute

Last synced: 3 months ago
JSON representation

Attribute for Hack

Awesome Lists containing this project

README

          

attribute
====================

Attribute for Hack

[![Latest Stable Version](https://poser.pugx.org/holyshared/attribute/v/stable)](https://packagist.org/packages/holyshared/attribute)
[![Build Status](https://travis-ci.org/holyshared/attribute.svg?branch=master)](https://travis-ci.org/holyshared/attribute)
[![Dependency Status](https://www.versioneye.com/user/projects/560ff3b5a193340015000001/badge.svg?style=flat)](https://www.versioneye.com/user/projects/560ff3b5a193340015000001)
[![License](https://poser.pugx.org/holyshared/attribute/license)](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