Support for deprecated preprocess variables
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 43/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- drupal, php
- Área
- devtools, testing-qa
Línea de trabajo
Read the linked Drupal issue 3458183 and its predecessor 3458587, then inspect how phpstan-drupal analyzes Drupal preprocess hooks. The issue suggests detecting direct $variables['teaser'] access using a list of deprecated variable names, while avoiding matches such as $variables['view_mode'] === 'teaser'. Done means adding useful detection for deprecated preprocess variables with limited false positives; the issue does not name files or tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Feature request
Core added support for deprecating Twig variables a couple of years ago, it has not been used much yet, CR is here: https://www.drupal.org/node/3334622
In https://www.drupal.org/project/drupal/issues/3458587 and sub-issues I'm actually trying to use it, of course this immediately runs into limitations.
The support we added in core supports detecting when a deprecated variable is used in a twig template, so that the template author can remove it.
However a lot of custom/contrib preprocess implementations check the value of one preprocess variable to then set the value of another, or overwrite preprocess variables etc. - we don't have any detection for that because it's just array keys.
Alex Pott suggested a phpstan-drupal issue to see if we can add detection. Because the support relies on values of $variables['deprecations'] which is also set in preprocess, it would be extremely difficult for php-stan drupal to dynamically determine this, but we wondered about hardcoding specific variable names like 'teaser' in a list then looking for $variables['teaser'] in any node preprocess hook and notifying if it's found. If we only look for $variables['teaser'] that would reduce false positives like $variables['view_mode'] === 'teaser'. This support would not be perfect, but we could detect the most disruptive changes which would be better than nothing.
https://www.drupal.org/project/drupal/issues/3458183 is the first issue to actually land from the latest round so there is something to try against.
- Lenguaje dominante
- PHP
- Estrellas
- 208
- Forks
- 88
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 15
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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.
Más de mglaman/phpstan-drupal
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
mglaman/phpstan-drupal#1078 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
mglaman/phpstan-drupal#1079 ·
Los mantenedores suelen responder en 1 día
-
Report constraint plugins that break on Drupal 12 because they have no named-arguments constructorPosiblemente ocupada @goba la tomó hace 2 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
mglaman/phpstan-drupal#1075 ·
Los mantenedores suelen responder en 1 día
-
Magic properties: original on entities, name on UserSession and password on User are not reported as deprecatedPosiblemente ocupada @goba la tomó hace 2 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
mglaman/phpstan-drupal#1074 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
mglaman/phpstan-drupal#1051 ·
Los mantenedores suelen responder en 1 día
Todos los issues de mglaman/phpstan-drupal
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
nikic/PHP-Parser#1187 ·
-
15.0
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Icinga/icinga-notifications-web#645 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
OpenMage/magento-lts#5865 ·
Los mantenedores suelen responder en 3 días