Skip to content

[interface] add $resetRequestLifetime to generateResetToken() signature - #362

Open
dyodemb wants to merge 1 commit into
SymfonyCasts:mainfrom
dyodemb:fix/interface-lifetime-param
Open

dyodemb wants to merge 1 commit into
SymfonyCasts:mainfrom
dyodemb:fix/interface-lifetime-param

Conversation

@dyodemb

@dyodemb dyodemb commented Aug 19, 2026

Copy link
Copy Markdown

ResetPasswordHelperInterface::generateResetToken() has always accepted an optional $resetRequestLifetime, but the interface commented out the parameter rather than declaring it, with a note "to be added to interface in 2.0". This means any consumer relying on the interface type-hint (e.g. for static analysis, mocking, or decorating) sees a 1-parameter method while the concrete ResetPasswordHelper takes 2, which PHPStan (and other tools) correctly flag as an arity mismatch.

This exact change already landed on the 2.x branch in #300, but that branch has had no activity since August 2024. Since PHP allows calling a method with more arguments than an interface declares (extra args are simply ignored, not a fatal error) and adding an optional trailing parameter to an interface doesn't break existing implementations, this is safe to land on main without waiting for a 2.0 release.

Also drops the now-stale PHPStan baseline entry for the docblock/signature mismatch this was previously suppressing.

ResetPasswordHelperInterface::generateResetToken() has always accepted an
optional $resetRequestLifetime, but the interface commented out the
parameter rather than declaring it, with a note "to be added to interface
in 2.0". This means any consumer relying on the interface type-hint (e.g.
for static analysis, mocking, or decorating) sees a 1-parameter method
while the concrete ResetPasswordHelper takes 2, which PHPStan (and other
tools) correctly flag as an arity mismatch.

This exact change already landed on the 2.x branch in SymfonyCasts#300, but that
branch has had no activity since August 2024. Since PHP allows calling a
method with more arguments than an interface declares (extra args are
simply ignored, not a fatal error) and adding an optional trailing
parameter to an interface doesn't break existing implementations, this
is safe to land on main without waiting for a 2.0 release.

Also drops the now-stale PHPStan baseline entry for the docblock/signature
mismatch this was previously suppressing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant