Add additional methods for reflections that have attributes
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C
- Estrellas
- 40.4k
- Forks
- 8.1k
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 96
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza localizando las implementaciones existentes de getAttributes para las reflexiones atribuibles y las pruebas relacionadas de ReflectionAttribute. Usa ReflectionFunctionAbstract::getNumberOfParameters como precedente de referencia y, a continuación, verifica la coincidencia, los flags, el manejo de duplicados y los valores de retorno de los métodos propuestos en todos los tipos de reflexión atribuibles.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- c, php
- Área
- api, backend
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100