Add additional methods for reflections that have attributes
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C
- Sterne
- 40.4k
- Forks
- 8.1k
- Ø Merge
- 2 T. 13 Std.
- Gemergte PRs (30 T.)
- 96
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die vorhandenen getAttributes-Implementierungen für attributfähige Reflektionen und die zugehörigen ReflectionAttribute-Tests zu lokalisieren. Verwende ReflectionFunctionAbstract::getNumberOfParameters als maßgebliche Referenz und überprüfe anschließend für die vorgeschlagenen Methoden über alle attributfähigen Reflection-Typen hinweg die Übereinstimmung, Flags, Behandlung von Duplikaten und Rückgabewerte.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- c, php
- Bereich
- api, backend
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100