- Issue created by @berdir
- π§πͺBelgium kristiaanvandeneynde Antwerp, Belgium
+1 for deprecating passing NULL instead
- π¬π§United Kingdom catch
Deprecation seems like a good idea to me too.
- π¨πSwitzerland berdir Switzerland
The deprecation is there. The only thing is whether we want to document on the interface that this will get a type in D12.
The only thing is whether we want to document on the interface that this will get a type in D12.
What's the alternative? Throw an exception on non-arrays in D12?
Documenting the type change seems straightforward: https://www.drupal.org/about/core/policies/core-change-policies/how-to-d... β , and the signature will change anyway because $is_root_call is going away, though maybe that's not a breaking change.
It would be nice to add a return type at that point, too, if possible.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Context for #10: @larowlan ran into this at https://git.drupalcode.org/project/experience_builder/-/merge_requests/4..., for π PHPUnit Next Major tests failing Active .
OK, rebased the MR and updated the deprecation version. I also changed the code a bit so that
$variables['date']
and$variables['author_name']
are always set, even if empty, so that people debugging Twig templates don't wonder why those variable might be missing.CR draft: https://www.drupal.org/node/3534020 β
Follow up to add the type declaration: π [PP-1] Add array type declaration to parameters in RendererInterface::render() ActiveOne thing to consider is whether to add type declarations to
$elements
inrenderRoot()
,renderInIsolation()
, andrenderPlain()
as well, but that's probably out of scope for this issue.- π¨πSwitzerland berdir Switzerland
Cross-referencing π Move preprocess functions into NodeThemeHooks Active , we should get this in first otherwise it will be a lot more complicated to backport this to 11.2
- π¬π§United Kingdom oily Greater London
@berdir I am not sure why line 212 of Renderer.php has /* array */ instead of typehinting the $elements parameter 'array'?
public function render(/* array */&$elements, $is_root_call = FALSE) {
- πΊπΈUnited States xjm
@oily re:
@berdir I am not sure why line 212 of Renderer.php has /* array */ instead of typehinting the $elements parameter 'array'? Not sure it matters. But cannot find any other examples grepping codebase.
We can't add the typehint in a minor version because it would be a backwards compatibility break. Reference: Deprecation process for interface and base class signature changes β . (The second example in point 1 there for adding a typehint illustrates this pattern.).
@larowlan inquired about backporting this to 11.2 despite the deprecation. Since this is a regression in 11.2, a backport is appropriate, but it might be better to create a backport version that does not raise the deprecation (i.e., that just silently returns empty string if the array is empty in
Renderer::render()
. They'll still start getting the deprecation on 11.3, so it's not like we're hiding their upgrade path from them. But that way we also avoid triggering new deprecation errors in production.Thoughts?