Skip to content

Fix incorrect @param null docblock on verta() helper - #191

Merged
hekmatinasser merged 1 commit into
hekmatinasser:masterfrom
bahramsadin:fix/verta-helper-datetime-docblock
Oct 25, 2026
Merged

hekmatinasser merged 1 commit into
hekmatinasser:masterfrom
bahramsadin:fix/verta-helper-datetime-docblock

Conversation

@bahramsadin

Copy link
Copy Markdown
Contributor

The verta() helper in src/helpers.php documents both parameters as accepting only null:

/**
 * @param null $datetime
 * @param null $timezone
 * @return Verta
 */
function verta($datetime = null, $timezone = null): Verta

This doesn't match reality — the function just forwards to new Verta($datetime, $timezone), and Verta extends Jalali, whose constructor (and its own resolve() docblock) accepts Jalali|DateTime|string|int|null for the datetime and DateTimeZone|string|null for the timezone. Calling verta($someDateString) or verta($carbonInstance) works fine at runtime, but the incorrect docblock makes static analysis tools (PHPStan/Larastan) flag every call site that passes an actual datetime value as a type error, even though the code is correct.

@hekmatinasser
hekmatinasser merged commit 08e3f65 into hekmatinasser:master Oct 25, 2026
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.

2 participants