Problem/Motivation
A Drupal developer opening this module should be able to guess a name before reading it. Most of Yoyaku already reads that way, but an audit of all 1032 PHP files against core's own naming found several groups where the module invents a shape core already has a word for. Every candidate was counted against core itself, over core/lib and core/modules, so each finding is a difference from core rather than a matter of taste. A word core never uses is only a defect where core already has a word for the same thing.
Renames are free here: the module is pre-1.0 and reinstall-only, so there are no update hooks and no BC layer to carry.
What the audit found
- 11 test traits do not end in
Trait:StartsFromAnEmptySite,HoldsWithoutThrottling,RunsEveryScenario,SignsInOnce,RecordsQueryCounts,WaitsForTheNextPage,HoldsOneLine,AllowsForALoadedRunner,KnowsHowThisCoreGroupsAssets,DrawsAHall,FoldsTheMap. In core, 265 of 269 traits end inTrait, and one of the four exceptions is a typo. A sentence-shaped name in a class'suselist gives no clue that it is a trait. - Words core has its own verb for.
give,giveBackPlace,giveUpFirstandgivenPartitionagainst core's zerogive-prefixed methods and 8release-prefixed ones.activePinning,activeConfigurationandactiveOrderagainst core's 16 distinctgetActivemethods and zero bareactive.recomputeStateandrecomputeOnceagainst core's 9computemethods and norecompute. - Bare-noun template methods on the overview and order forms.
columns()andcells()do what core callsbuildHeader()(35 uses) andbuildRow()(37), andSelectableOverviewFormBasealready declared abuildRow()beside a bareheader(), so this is the module's own precedent as much as core's. The same applies totabRoute,collectionRoute,emptyText,savedMessage,storage,tableKey,actionOptions,batchTitle,selectionWarning,activeChipsandentityTypeId. Core's form template methods are consistently verb-prefixed:getCancelUrl()52 uses,getQuestion()50,getConfirmText()42. - The
of()readers. Core has noof-prefixed method anywhere. Four unrelated classes declaredof()and three more declaredofSlot(), each meaning something different, so each is renamed for what it returns rather than for its argument. - British spelling, in 408 places:
cancelled,cancelling,labelled,centre,colour,signalled,grey,catalogue.ResourceTypeCataloguewas British and also not core's word for "which of these are available here", so it becomesResourceTypeRepository, which is what core's own jsonapi calls the same job. - Hook and subscriber class suffixes. 371 of the 442 classes in core's
Hookdirectories end inHooks; 46 of ours did and 7 did not. 106 of the 127 classes in core'sEventSubscriberdirectories end inSubscriber; ten of ours did not. - camelCase variables. 29 parameter names and 57 local names were lowerCamel while the rest of the module already used snake_case, so the module disagreed with itself. Core uses snake_case for both.
What is deliberately not changed
Recorded here so a later audit does not "fix" them. Each was flagged by a first pass and then cleared by reading what core actually does.
- The stored value
cancelledstays a stored value. It is written into booking and transaction rows on a live site, into anorder_retentionconfig key, and into the orchestra workflow payloads that route on that literal. So the constant name is nowSTATE_CANCELEDwhile its value is still the old string. Changing the value is a data migration and a cross-module change, not a rename. - kessai's constants keep kessai's spelling, both
PaymentInterface::STATE_CANCELLEDandPaymentEvents::CANCELLED. - Bare-noun readers on value objects stay.
PolicyContext::lines(),PolicyOutcome::violations(),PolicyScope::host()andTransactionContext::transaction()read oddly, but core does the same in the same kind of class: jsonapi'sEntityConditionhasfield(),operator()andvalue(), and workflows'Statehasid(),label()andweight(). On config entities, core's ownNodeTypeInterfacedeclaresdisplaySubmitted(), which is the shape ofautoConfirms(). - Promoted constructor parameters stay lowerCamel, because they are properties. That distinction is what makes the variable sweep not a blind one.
- Snake_case properties on config entities stay, because the property name is the config key, as core's
NodeTypedeclares$new_revision. - Abstract classes not ending in
Basestay. 31 of the 110 abstract classes in core's lib are named that way, includingDraggableListBuilder, whichDraggableWeightedListBuilderdeliberately mirrors. - PascalCase constraint plugin ids stay, because that is what core uses (
AllowedValues,EntityBundleExists), unlike every other plugin type. - The service ids stay. The ones without a module prefix are core's own shapes:
logger.channel,cache_contextandplugin.manager. Onlyresource_type_cataloguemoved, and only for its spelling.
Also verified clean, with nothing to change: PascalCase type names and file names matching the type they declare; the Interface and Exception suffixes; UPPER_SNAKE constants; route names, permission names, menu, task and action link ids; entity type ids and plugin ids; and test classes ending in Test with no two consecutive capitals in a test method name.
Remaining tasks
Three follow-ups came out of this and are not in the merge request, because each is a coherent group of its own and folding them in would leave a half-done rename visible in the diff.
- The
forprefix. 33 declarations across 12 names (forResource,forOrder,forSlotand so on) against exactly one in core,forUpdate(), which is the SQL clause rather than a getter. BookingWorkflowStarteris in the wrong directory. It sits underEventSubscriberbut implementsWorkflowStarterInterface, notEventSubscriberInterface, so it is a misplaced file rather than a misnamed class, and moving it changes its namespace.WaitsForTheNextPageTraithas no users. It solves a real problem, a stale element reference after a submit, and nothing calls it. It is the tool for the remaining click sites that still go throughfind(...)->click().
AI-Generated: Yes (Claude Code was used to help draft this issue summary and to write the code on the merge request. I reviewed and ran the work myself before posting it.)
Issue fork yoyaku-3618938
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mably commentedComment #5
mably commented