Repository navigation
[CC-4239] Add SEPA-specific PHPDoc to SepaDirectDebit::setRecurring - #256
Conversation
…EPA PHPDoc QA (CC-4239 comment 495774) on the merged PR #247 found the public setter's parameter is $active (inherited via `use CanRecur { setRecurring as public; }`), not $recurring as the ticket specified. Since PHP 8 makes the parameter name part of the public API, `->setRecurring(recurring: true)` threw "Unknown named parameter $recurring". Replace the trait alias with an explicit public override `setRecurring(bool $recurring): self` on SepaDirectDebit, carrying SEPA-specific PHPDoc (RCUR/OOFF mandate intent) — this fixes the parameter name (bug 1) and the missing docblock (bug 2) together. `use CanRecur` is kept, so isRecurring(), the deprecated activateRecurring() and the ResourceService class_uses(CanRecur) capability gate are unchanged (verified by reflection probe). Added a unit test pinning the named-argument form. Note: 4.1.0 is unreleased, so this only shapes the setter before release — no CHANGELOG churn. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reverts the parameter name from $recurring back to $active. With the method already named setRecurring, `$active` reads better than the redundant `setRecurring(recurring: true)` — a deliberate maintainer decision that supersedes the ticket AC's suggested `$recurring`. The important BC point still holds: the public parameter name is settled before release (4.1.0 unreleased), so there is no future named-argument break. The explicit public override is kept for the SEPA-specific PHPDoc (bug 2); only the parameter name changes. Named-argument test updated to `active: true`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… call A named-argument call (setRecurring(active: true)) reads contrived for a single-parameter setter. Replace it with a reflection assertion on the parameter (name `active`, type `bool`) — that pins the actual public-API surface directly and matches the repo's existing signature-pinning idiom (legacySignatureDataProvider). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A reflection test that hard-pins the parameter name is brittle and low-value: PHP parameter-name stability is only a BC concern if the library promises named-argument support, which this SDK does not (cf. Symfony excluding param names from its BC promise / @no-named-arguments). Behaviour is already covered by the setter/getter, expose, and response-mapping tests. The parameter stays $active for consistency with the CanRecur trait — no test needed to enforce it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the PMP / RCUR-OOFF mandate-derivation and charge-payload internals from the public docblock — that is internal platform behaviour an integrator should not need to know. Keep only the caller-facing contract: true = recurring (mandate-based) collection, false (default) = one-off, applied at type registration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The parameter and return types are already declared in the typed signature (setRecurring(bool $active): self), so the @param/@return tags add nothing. Keep the descriptive text only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Khaled-Mahmoud-Unzer
left a comment
There was a problem hiding this comment.
QA review against the bugs from CC-4239 comment 495774. I ran the CC-4239 tests in php-sdk-test-automation (offline and live sandbox) against this branch: 24 of 27 pass. The 3 failures are bugs 1 and 3 below, which are not part of this PR.
Fixed
- Bug 2:
SepaDirectDebit::setRecurring()now has its own SEPA docblock. I checked the "applied once, at type registration" part on the live sandbox: changingrecurringwith an update (PUT) afterwards is silently ignored and the value from registration stays, so the docblock is correct.
Not fixed
- Bug 1: the parameter stays
$activeinstead of$recurring. I accept keeping it, since the SDK doesn't promise stable parameter names. Two notes:SepaDirectDebitnow has its own method and is the only type wheresetRecurring()is public, so a rename here wouldn't conflict with the trait.- The ticket's acceptance criteria still say
setRecurring(bool $recurring). Please update the AC to$active, as was done for the "always sendrecurring" decision.
- Bug 3: a
nullor""recurringvalue in a response still crashes the fetch. I agree it belongs in a separate ticket, because it affects allCanRecurtypes.
Also verified
- Backward compatibility is kept:
use CanRecur,isRecurring(),activateRecurring()and theResourceServicegate still work. - Card, Paypal and SepaDirectDebitSecured still don't send
recurring.
Approving.
sixer1182
left a comment
There was a problem hiding this comment.
Approving. No behaviour change: the explicit public setRecurring(bool $active): self has the same body as the trait method, and isRecurring(), activateRecurring() and the always-exposed recurring flag are untouched. Keeping $active for consistency with CanRecur is fine.
Non-blocking wording nit: "recurring (mandate-based) collection" suggests one-off collection has no mandate, which is not the case for SEPA. "recurring collection (recurring mandate)" would be exact.
|
One follow-up to my approval: the acceptance criteria in CC-4239 still specify |
Addresses the QA review on CC-4239 (comment 495774) against the merged PR #247 (the
recurringflag feature is unreleased, part of 4.1.0).Bug 2 (low) — missing PHPDoc: fixed (the substantive change)
SepaDirectDebitnow overridessetRecurring(bool $active): selfwith a SEPA-specific docblock stating the caller contract —trueregisters the type for recurring (mandate-based) collection,false(default) for one-off, applied at type registration. (Replaces theuse CanRecur { setRecurring as public; }alias.) The docblock is kept to the caller contract only; internal platform mechanics are deliberately not documented.Bug 1 (medium) — parameter name: keeping
$active, treated as a non-blockerThe parameter stays
$active, consistent with the sharedCanRecur::setRecurring(bool $active)used by allCanRecurtypes; renaming only this type would contradict the trait. A PHP parameter-name change is only breaking if the library guarantees named-argument stability, which this SDK doesn't (same stance as Symfony — param names excluded from the BC promise). So the AC's$recurringis not treated as a required change, and no name-pinning test is added. Standardising on the property name would be a trait-wide change for a future major.Preserved (reflection-probe-verified)
use CanRecurkept →isRecurring(), deprecatedactivateRecurring(), and theResourceServiceclass_uses(CanRecur)capability gate unchanged.recurringstill always exposed, defaultfalse.Bug 3 (low, pre-existing) — deferred
null/""recurringin a response makes the typed setter throw on fetch. Affects allCanRecurtypes; fix belongs in the shared trait / mapper. Not reachable via the real API. Suggested as a separate low-priority ticket.Verification
$activeand behaviour unchanged).🤖 Generated with Claude Code