Page MenuHomePhabricator

Remove "HeraldRepetitionPolicyConfig" and hide storage details inside HeraldRule
ClosedPublic

Authored by epriestley on Jan 25 2018, 4:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 21 2026, 6:09 PM
Unknown Object (File)
Apr 18 2026, 12:14 AM
Unknown Object (File)
Apr 12 2026, 3:24 PM
Unknown Object (File)
Mar 31 2026, 7:06 PM
Unknown Object (File)
Feb 4 2026, 4:36 PM
Unknown Object (File)
Oct 20 2025, 11:44 PM
Unknown Object (File)
Oct 18 2025, 6:31 PM
Unknown Object (File)
Sep 13 2025, 2:28 AM
Subscribers
None

Details

Summary

Depends on D18925. Ref T13048. Currently, HeraldRule stores policies as integers (0 or 1) in the database.

The application tries to mostly use strings ("first", "every"), but doesn't do a good job of hiding the fact that the values are integers deeper in the stack. So we end up with a lot of code like this:

$stored_int_value = $rule->getRepetitionPolicy();
$equivalent_string = HeraldRepetitionPolicyConfig::getString($stored_int_value);
$is_first = ($equivalent_string === HeraldRepetitionPolicyConfig::FIRST);

This happens in several places and is generally awful. Replace it with:

$is_first = $rule->isRepeatFirst();

To do this, merge HeraldRepetitionPolicyConfig into HeraldRule and hide all the mess inside the methods.

(This may let us just get rid of the integers in a later change, although I'm not sure I want to commit to that.)

Test Plan
  • Grepped for HeraldRepetitionPolicyConfig, no more hits.
  • Grepped for setRepetitionPolicy(...) and getRepetitionPolicy(...). There are no remaining callers outside of HeraldRule.
  • Browed and edited several rules. I'll vet this more convincingly after adding the new repetition rule.

Diff Detail

Repository
rP Phabricator
Branch
herald3
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 19175
Build 25893: Run Core Tests
Build 25892: arc lint + arc unit