\Drupflare\Anachron\Drupal\Extension HookInfoRewriter

Wraps every procedural `hook_hook_info` implementation so its answer has the shape Drupal 11 reads.

Drupal 7 read each entry's group with isset(), so an implementation could answer 'apps_server' => '' and nothing complained. Drupal 11 compiles the container by calling the function and indexing $info['group'] on each entry, which is a fatal on a string. The function keeps its name and its body; it is renamed with a suffix and a wrapper under the old name passes the answer through LegacyHookInfo::normalise().

Summary

Methods
Properties
Constants
rewrite
No public properties found
SUFFIX
No protected methods found
No protected properties found
No protected constants found
nameAfter
No private properties found
No private constants found

Constant

SUFFIX

SUFFIX = '_unnormalised'

Suffix of the renamed original.

Methods

rewrite()

rewrite(string  $code) : string

Rewrites one PHP source string.

Parameters

string $code

PHP source.

Returns

string —

The source with each top level NAME_hook_info renamed and wrapped, or the same string when it has none.

nameAfter()

nameAfter(array  $tokens, int  $function) : ?int

Finds the token index of the function name after a `function` keyword.

Parameters

array $tokens

The token list.

int $function

Index of the function token.

Returns

?int —