Problem
The tariff rename settled the vocabulary and reached the types. Entity types, classes and services carry no "tier": TierLookup is SlotTariffLookup, SingleTierPerRate is UniqueSlotTariff, groupTiers() is tariffsByClass(). Below the type level nothing moved, and reading the module now means holding three words for one thing.
Counted at c6103a3:
| non-test | tests | |
|---|---|---|
$tier, $tiers, $tier_id |
76, in 7 files | 324 |
$rate, $rates |
64 | 107 |
| comment lines saying "tier" | 177 | |
| comment lines saying "rate" | 275 | |
| files with either in prose | 85 |
The production locals cluster in seven files: PlaceSelectionController (23), SlotBookingForm (14), then ConstraintPolicyResolver, SlotTariffLookup, BookingCart, GenerateSlotsForm and BookingCartInterface. "rate" is never used in any other sense anywhere: no tax rate, no rate limit, no exchange rate. It always means a tariff.
Four things in there are more than untidiness:
hook_yoyaku_summary_alter()documents a key that does not exist.yoyaku.api.phpsays each ticket offers atier_key, "the line's price tier id, or '' when untiered", and its worked example calls$ticket['tier_key'].TransactionSummaryhas never built that key: a ticket carriestariffandtariff_id. Anybody who copied the example got an undefined array key and a NULL price, silently, because an unpriced ticket is a legal answer.policiesForTier()is a public method whose parameter is already typedBookingSlotTariffInterface, so its name is the last thing calling it a tier.- Six orphaned strings in the French translation carry
@rateand%tierplaceholders that no code emits: the "take one place at @rate" family and "The @count %tier places could not be found next to each other". They are the leftovers of a UI that has since been rebuilt, and they are what a translator sees. - Five live interface strings say "rate", including a field description a site builder reads on every booking and the seating strategy's own description in the plugin list.
The three tariff scopes are the reason this matters more than a synonym usually would. yoyaku_tariff is the definition in a preset, yoyaku_resource_tariff is what one production offers, yoyaku_slot_tariff is one session's override. A variable called $tier says which of the three it holds only by luck, and $rate says even less.
Proposed resolution
One sweep, by hand, naming each thing after what it actually holds rather than substituting one word for another:
$tieror$rateholding aBookingResourceTariffInterfacebecomes$tariff; one holding aBookingSlotTariffInterfacebecomes$slot_tariff. That distinction is the point, and it is why a search and replace is the wrong tool: the two are spelled the same today.- Prose says "tariff", and says which scope where the sentence depends on it.
policiesForTier()becomespoliciesForSlotTariff(), matching its parameter type.yoyaku.api.phpdocuments the keys a ticket actually carries, and its example becomes code that runs.- The six orphaned French entries go. The five live strings are reworded, and
translations/yoyaku.fr.pois updated in the same commit, since French already uses tarif everywhere else. - Test method names and test locals follow, including the
untieredfamily, which becomes "offers no tariff" rather than a coined word.
No entity type, field name, config key, route, service id or plugin id changes, so nothing on a site moves and there is no migration. The only signature that changes is policiesForTier(), whose callers are all in this module.
Remaining tasks
- The seven production files carrying locals, then the prose across the remaining files.
policiesForTier()and its callers.yoyaku.api.php: the documented keys, and an example that would run.- The five interface strings, the six orphaned entries, and
fr.po, in the same commit. - Test method names and locals. The suite passing unchanged is the proof, so no test's assertions may change: a renamed test that also changes what it asserts hides a behavior change inside a sweep.
docs/, about 65 hits across 12 files, 18 of them indocs/seating.md, whose prose calls a tariff a rate throughout.- Re-run every linter afterwards. A rewrap after a rename is where a docblock loses its closing line, so the prose gets read back rather than trusted to a script.
User interface changes
Five strings say "tariff" where they said "rate", and their French follows. Nothing moves and nothing is renamed that a site stores.
Issue fork yoyaku-3615245
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 #4
mably commented