Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

date return type numeric-string for specfic formats #9634

Closed
kkmuffme opened this issue Apr 10, 2023 · 2 comments
Closed

date return type numeric-string for specfic formats #9634

kkmuffme opened this issue Apr 10, 2023 · 2 comments
Labels
easy problems Issues that can be fixed without background knowledge of Psalm enhancement good first issue Help wanted type providers

Comments

@kkmuffme
Copy link
Contributor

https://psalm.dev/r/0264caa556

If the first argument of (gm)date matches ^[djNwzWmntLoyBgGhHisuvIZU]+$ then the return type should be numeric-string instead of string

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/0264caa556
<?php

$type = gmdate( 'H' );
/** @psalm-trace $type */;
Psalm output (using commit 2aaa577):

INFO: Trace - 4:26 - $type: string

INFO: UnusedVariable - 3:1 - $type is never referenced or the value is not used

@orklah
Copy link
Collaborator

orklah commented Apr 10, 2023

This may be too complicated to put into a stub. A return type provider would do the trick though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy problems Issues that can be fixed without background knowledge of Psalm enhancement good first issue Help wanted type providers
Projects
None yet
Development

No branches or pull requests

3 participants