- πΊπΈUnited States smustgrave
This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β as a guide.
Seems this survived the review queue purge.
So to continue the conversation #8 should this be a documentation update?
If not Patch for #3
- New functions and properties should be typehinted for D10
- Needs a test case to show the issueDid not test for the issue locally
Thanks!
- πΊπΈUnited States smustgrave
This looks correct to me
Looked at other uses of mixed $value when reading that section and seemed to line up there too.
LGTM
- Status changed to Needs review
3 days ago 11:47am 28 June 2025 - πΊπΈUnited States xjm
The docs themselves look great and appear to be accurate. I added one suggestion.
One thing though: Are there other places this is documented in core, and are we repeating documentation? Could we use an
@see
?And if we haven't checked for that, it would be good to look up the documentation of e.g. callers.
Thanks!
- π¬π§United Kingdom oily Greater London
Added code review: callables: called or invoked.
- π¬π§United Kingdom oily Greater London
@xjm If you are unconvinced by my arguments (code review), do you want to do a follow-up to change the few instances of 'calling' callables' in the existing Drupal codebase to 'invoking'?
- π¬π§United Kingdom oily Greater London
@xjm You are correct that in Drupal API docs eg:
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension...there are:
callable $callback: A callable that invokes a hook implementation.
But is that the purpose of the callback in this issue?
If not then best to contradistinguish the chalk from the cheese?
- πΊπΈUnited States xjm
@oily, Thanks for your interest in this topic. The discussion is out of scope for this issue, so please create a new issue to discuss it. Thanks!
Reference: Drupal core issue scope guidelines β
- πΊπΈUnited States xjm
The outstanding tasks are as I posted in my previous committer review:
One thing though: Are there other places this is documented in core, and are we repeating documentation? Could we use an @see?
And if we haven't checked for that, it would be good to look up the documentation of e.g. callers.
- π¬π§United Kingdom joachim
While this still set to NW, I'm going to nitpick and say that the NULL case should be a first-level thing, not a parenthetical.
But other than that, it's looking really good!
- π¬π§United Kingdom oily Greater London
#31 @xjm
@oily, Thanks for your interest in this topic.
Everyone else has 'contributed' to this discussion.
... the discussion is out of scope for this issue
How is it 'out of scope'?!
- π¬π§United Kingdom oily Greater London
Re #32 "Plus addressing @joachim's feedback". So why not addressing my 'feedback', too?
- πΊπΈUnited States xjm
@oily, this is why I've ruled your feedback as out of scope:
[ayrton:drupal | Sun 13:28:30] $ grep -r "invoke" * | grep "callback" | grep -v "vendor" | grep -v "node_modules" | wc -l 31
This even includes things that aren't documentation at all:
core/lib/Drupal/Core/Theme/ThemeManager.php: $invoke_preprocess_callback = function (mixed $preprocessor_function) use ($invoke_map, &$variables, $hook, $info): mixed
As a Drupal core release manager, I have final decision-making over issue scope and management decisions of this sort. Like I've stated, you have valid points about the terminology, but since this is a pattern already used widely in both core docs and runtime code, your proposal to improve the usage should be made as a coding standards proposal, not an argument about a single word in a docblock for an otherwise nearly committable issue. Please do not post any further comments about this on this issue.
- π¬π§United Kingdom oily Greater London
Thank you for #36 @xjm. Please refer to #30:
A PHP callable is a PHP variable that can be used by the call_user_func() function and returns true when passed to the is_callable() function. It can be a \Closure instance, an object implementing an __invoke() method (which is what closures are in fact), a string representing a function or an array representing an object method or a class method.,
That seems to be a clear description of PHP callables. It explains the variance in Drupal docs you have highlighted in #36.
The action to take when documenting a callable is straightforward:
- Is it a \Closure? If so it must be an object implementing an __invoke() method. So it is 'invoked'..
- If not a \Closure and does not invoke an __invoke() method, is may be a string representing a function?
- If neither of the above, is must be an array?
Line 508
throw new \InvalidArgumentException('Default value callback must be a <strong>string</strong>,...
makes it clear that the $callback parameter of BaseFieldDefinition::setDefaultValueCallback() is a string callback (see item 2).
Therefore, it is 'called' not 'invoked'. Callables elsewhere e.g. in Drupal API docs (see item 1) are correctly described as 'invoked'.
- π¬π§United Kingdom oily Greater London
If the callback at line 493 is 'invoked' then it should be typehinted as
\Closure
, notstring|NULL
. - πΊπΈUnited States xjm
@oily, you have made your point repeatedly. Please file a separate issue. Thanks.
- π¬π§United Kingdom oily Greater London
@xjm Thank you for #42 but I respectfully disagree: I have been constantly changing my 'point'. It has evolved.
The status is 'Needs review'. Distilled from the above is this:
At line 493:
string|NULL should be callable|NULL
If others disagree then I am keen to hear their viewpoint.
- π¬π§United Kingdom oily Greater London
Not sure why pipeline failed. Failures dont seem related. It has failed on a one word commit.
- π¦πΊAustralia acbramley
@oily check your changes, you've removed a chunk of code.
- π¬π§United Kingdom oily Greater London
@acbramley I used the online single file editor. Weird.
- π¬π§United Kingdom oily Greater London
Pipleline green.
Change to Needs review.
- πΊπΈUnited States smustgrave
How come we went ahead with the change when there wasnβt consensus and even mentioned a separate issue in #42?
- π¬π§United Kingdom oily Greater London
#49 @smustgrave Because the typehint should not be 'string' it should be 'callable'. If you disagree, please explain why.
- πΊπΈUnited States smustgrave
Just saying itβs best to get consensus before just making the change
- π¬π§United Kingdom oily Greater London
@smustgrave. I agree. I created a code review as others here did. My review was to change 'string' to 'callable'. I believe my review was ignored while everyone else's was resolved. No idea why.