From 7b459831534fa13e427cc4ffd28e4b9046b45f07 Mon Sep 17 00:00:00 2001 From: David Owusu <33735090+Ryouzanpaku@users.noreply.github.com> Date: Thu, 26 Nov 2026 11:03:36 +0100 Subject: [PATCH 1/6] [CC-4239] Name SepaDirectDebit::setRecurring param $recurring + add SEPA PHPDoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../PaymentTypes/SepaDirectDebit.php | 21 ++++++++++++++++--- .../PaymentTypes/SepaDirectDebitTest.php | 15 +++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/Resources/PaymentTypes/SepaDirectDebit.php b/src/Resources/PaymentTypes/SepaDirectDebit.php index 8686525a..09169461 100755 --- a/src/Resources/PaymentTypes/SepaDirectDebit.php +++ b/src/Resources/PaymentTypes/SepaDirectDebit.php @@ -16,9 +16,7 @@ class SepaDirectDebit extends BasePaymentType { use CanDirectCharge; use CanPayout; - use CanRecur { - setRecurring as public; - } + use CanRecur; /** @var string $iban */ protected $iban; @@ -94,6 +92,23 @@ public function setHolder(?string $holder): self return $this; } + /** + * Sets whether this SEPA direct debit type is registered for recurring (mandate-based) collection. + * + * The intent is captured once at type registration: `true` yields a recurring (RCUR) mandate, + * `false` (the default) a one-off (OOFF) mandate. The PMP derives the mandate type from this flag; + * there is no recurrence data on the SEPA charge. + * + * @param bool $recurring + * + * @return $this + */ + public function setRecurring(bool $recurring): self + { + $this->recurring = $recurring; + return $this; + } + /** * Always exposes the recurring flag (default false) so the SEPA direct debit type registration * carries the mandate intent. diff --git a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php index 6bd5bf82..24bf045e 100755 --- a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php +++ b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php @@ -60,6 +60,21 @@ public function recurringSetterAndGetterWorkAsExpected(bool $value): void $this->assertSame($value, $sdd->isRecurring()); } + /** + * Verify the public setter parameter is named `$recurring`, so the PHP 8 named-argument form works. + * Since PHP 8 the parameter name is part of the public API; this pins it against accidental renames. + * + * @test + */ + public function recurringSetterAcceptsNamedArgument(): void + { + $sdd = new SepaDirectDebit('DE89370400440532013000'); + + $sdd->setRecurring(recurring: true); + + $this->assertTrue($sdd->isRecurring()); + } + /** * Verify the recurring flag is always exposed, defaulting to false when never set. * From 92ae37d78d69fb51879841c9b7e7d51d71a8c320 Mon Sep 17 00:00:00 2001 From: David Owusu <33735090+Ryouzanpaku@users.noreply.github.com> Date: Thu, 26 Nov 2026 11:08:47 +0100 Subject: [PATCH 2/6] [CC-4239] Keep setRecurring parameter name as $active (deliberate) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/Resources/PaymentTypes/SepaDirectDebit.php | 6 +++--- test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Resources/PaymentTypes/SepaDirectDebit.php b/src/Resources/PaymentTypes/SepaDirectDebit.php index 09169461..b02b7288 100755 --- a/src/Resources/PaymentTypes/SepaDirectDebit.php +++ b/src/Resources/PaymentTypes/SepaDirectDebit.php @@ -99,13 +99,13 @@ public function setHolder(?string $holder): self * `false` (the default) a one-off (OOFF) mandate. The PMP derives the mandate type from this flag; * there is no recurrence data on the SEPA charge. * - * @param bool $recurring + * @param bool $active * * @return $this */ - public function setRecurring(bool $recurring): self + public function setRecurring(bool $active): self { - $this->recurring = $recurring; + $this->recurring = $active; return $this; } diff --git a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php index 24bf045e..40d1d80d 100755 --- a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php +++ b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php @@ -61,8 +61,9 @@ public function recurringSetterAndGetterWorkAsExpected(bool $value): void } /** - * Verify the public setter parameter is named `$recurring`, so the PHP 8 named-argument form works. - * Since PHP 8 the parameter name is part of the public API; this pins it against accidental renames. + * Verify the public setter parameter is named `$active`, so the PHP 8 named-argument form works. + * Since PHP 8 the parameter name is part of the public API; this pins the chosen name against + * accidental renames. * * @test */ @@ -70,7 +71,7 @@ public function recurringSetterAcceptsNamedArgument(): void { $sdd = new SepaDirectDebit('DE89370400440532013000'); - $sdd->setRecurring(recurring: true); + $sdd->setRecurring(active: true); $this->assertTrue($sdd->isRecurring()); } From e40e313af5c03bfebab34e50d8ca3419b70ea9bf Mon Sep 17 00:00:00 2001 From: David Owusu <33735090+Ryouzanpaku@users.noreply.github.com> Date: Thu, 26 Nov 2026 11:12:23 +0100 Subject: [PATCH 3/6] [CC-4239] Pin setRecurring param name via reflection, not a named-arg call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../PaymentTypes/SepaDirectDebitTest.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php index 40d1d80d..c4611a14 100755 --- a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php +++ b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php @@ -61,19 +61,18 @@ public function recurringSetterAndGetterWorkAsExpected(bool $value): void } /** - * Verify the public setter parameter is named `$active`, so the PHP 8 named-argument form works. - * Since PHP 8 the parameter name is part of the public API; this pins the chosen name against - * accidental renames. + * Pin the public setter's parameter to `bool $active` (matching the shared CanRecur trait). Since + * PHP 8 the parameter name is part of the public API, so this guards the deliberate name against a + * silent rename. * * @test */ - public function recurringSetterAcceptsNamedArgument(): void + public function recurringSetterParameterIsNamedActive(): void { - $sdd = new SepaDirectDebit('DE89370400440532013000'); - - $sdd->setRecurring(active: true); + $parameter = (new \ReflectionMethod(SepaDirectDebit::class, 'setRecurring'))->getParameters()[0]; - $this->assertTrue($sdd->isRecurring()); + $this->assertSame('active', $parameter->getName()); + $this->assertSame('bool', (string) $parameter->getType()); } /** From a9460b7fc9031105d9620bc7782a6a03b96666a4 Mon Sep 17 00:00:00 2001 From: David Owusu <33735090+Ryouzanpaku@users.noreply.github.com> Date: Thu, 26 Nov 2026 11:13:32 +0100 Subject: [PATCH 4/6] [CC-4239] Drop the brittle param-name reflection test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../PaymentTypes/SepaDirectDebitTest.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php index c4611a14..6bd5bf82 100755 --- a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php +++ b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php @@ -60,21 +60,6 @@ public function recurringSetterAndGetterWorkAsExpected(bool $value): void $this->assertSame($value, $sdd->isRecurring()); } - /** - * Pin the public setter's parameter to `bool $active` (matching the shared CanRecur trait). Since - * PHP 8 the parameter name is part of the public API, so this guards the deliberate name against a - * silent rename. - * - * @test - */ - public function recurringSetterParameterIsNamedActive(): void - { - $parameter = (new \ReflectionMethod(SepaDirectDebit::class, 'setRecurring'))->getParameters()[0]; - - $this->assertSame('active', $parameter->getName()); - $this->assertSame('bool', (string) $parameter->getType()); - } - /** * Verify the recurring flag is always exposed, defaulting to false when never set. * From 47ca83cb11fa31f7ad1a0e04f417056b645fa308 Mon Sep 17 00:00:00 2001 From: David Owusu <33735090+Ryouzanpaku@users.noreply.github.com> Date: Thu, 26 Nov 2026 11:26:47 +0100 Subject: [PATCH 5/6] [CC-4239] Trim internal detail from setRecurring PHPDoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/Resources/PaymentTypes/SepaDirectDebit.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Resources/PaymentTypes/SepaDirectDebit.php b/src/Resources/PaymentTypes/SepaDirectDebit.php index b02b7288..a30ddfa0 100755 --- a/src/Resources/PaymentTypes/SepaDirectDebit.php +++ b/src/Resources/PaymentTypes/SepaDirectDebit.php @@ -93,11 +93,10 @@ public function setHolder(?string $holder): self } /** - * Sets whether this SEPA direct debit type is registered for recurring (mandate-based) collection. + * Enables or disables recurring collection for this SEPA direct debit type. * - * The intent is captured once at type registration: `true` yields a recurring (RCUR) mandate, - * `false` (the default) a one-off (OOFF) mandate. The PMP derives the mandate type from this flag; - * there is no recurrence data on the SEPA charge. + * Set to `true` to register the type for recurring (mandate-based) collection; defaults to `false` + * for one-off collection. Applied once, at type registration. * * @param bool $active * From d4c8ab5a6e48da9cd3e27615e0f91eb38d81faec Mon Sep 17 00:00:00 2001 From: David Owusu <33735090+Ryouzanpaku@users.noreply.github.com> Date: Thu, 26 Nov 2026 11:30:13 +0100 Subject: [PATCH 6/6] [CC-4239] Drop redundant @param/@return from setRecurring docblock 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) --- src/Resources/PaymentTypes/SepaDirectDebit.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Resources/PaymentTypes/SepaDirectDebit.php b/src/Resources/PaymentTypes/SepaDirectDebit.php index a30ddfa0..7a03ec67 100755 --- a/src/Resources/PaymentTypes/SepaDirectDebit.php +++ b/src/Resources/PaymentTypes/SepaDirectDebit.php @@ -97,10 +97,6 @@ public function setHolder(?string $holder): self * * Set to `true` to register the type for recurring (mandate-based) collection; defaults to `false` * for one-off collection. Applied once, at type registration. - * - * @param bool $active - * - * @return $this */ public function setRecurring(bool $active): self {