Add additional methods for reflections that have attributes
まだ誰も着手していません。
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
All currently attributable reflections have a single method relating to attributes.
getAttributes(?string $name = null, int $flags = 0): array
Additional methods for dealing with attributes would be a nice improvement and would simplify common approaches. I'm proposing the following methods.
getAttribute
Get a single instance of ReflectionAttribute, following the same rules as getAttributes, minus the fact that $name is required.
getAttribute(string $name, int $flags = 0): ?ReflectionAttribute
If more than one attribute matches, an exception should be thrown.
hasAttribute
Functionally identical to getAttribute, except it will return true if one or more matches are found, otherwise it returns false.
hasAttribute(string $name, int $flags = 0): bool
getNumberOfAttributes
Again, follows the same rules as getAttributes, but will return the number found. This particular method is based on the ReflectionFunctionAbstract::getNumberOfParameters method.
getNumberOfAttributes(?string $name = null, int $flags = 0): int
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、属性を付与可能なリフレクションに対する既存の getAttributes 実装と、関連する ReflectionAttribute テストを見つけます。参照すべき先例として ReflectionFunctionAbstract::getNumberOfParameters を使用し、そのうえで、属性を付与可能なすべてのリフレクション型について、提案されたメソッドの一致、flags、重複処理、戻り値を確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- api, backend
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100