8000 Type constraint link to removed php function and is not used in symfony · Issue #17665 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Type constraint link to removed php function and is not used in symfony #17665

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

Closed
alamirault opened this issue Jan 5, 2023 · 2 comments
Closed

Comments

@alamirault
Copy link
Contributor

On this page https://symfony.com/doc/current/reference/constraints/Type.html#type, we have a link to some php is_* functions.

* :phpfunction:`array <is_array>`
* :phpfunction:`bool <is_bool>`
* :phpfunction:`callable <is_callable>`
* :phpfunction:`float <is_float>`
* :phpfunction:`double <is_double>`
* :phpfunction:`int <is_int>`
* :phpfunction:`integer <is_integer>`
* :phpfunction:`iterable <is_iterable>`
* :phpfunction:`long <is_long>`
* :phpfunction:`null <is_null>`
* :phpfunction:`numeric <is_numeric>`
* :phpfunction:`object <is_object>`
* :phpfunction:`real <is_real>`
* :phpfunction:`resource <is_resource>`
* :phpfunction:`scalar <is_scalar>`
* :phpfunction:`string <is_string>`

is_real is deprecated since php 8.0.

And Type Validator does not use this function (same for is_double)

https://github.com/symfony/symfony/blob/ed96673e64ebaca3f47012c230823dcddd59a2ba/src/Symfony/Component/Validator/Constraints/TypeValidator.php#L24-L41

WDYT to update doc, and for each type, precise real php function used.

Maybe something like this ? (I don't know if it's a valid syntax for SymfonyDocsBuilder)

:phpfunction:`float, double, real <is_float>`
@MrYamous
Copy link
Contributor
MrYamous commented Jan 6, 2023
:phpfunction:`float, double, real <is_float>`

This is valid syntax yes, but what do you think about keeping one type per list item ?

@alexislefebvre
Copy link
Contributor

is_real is deprecated since php 8.0.

Actually it was removed, according to this link.

@alamirault alamirault changed the title Type constraint link to deprectated php function and is not used in symfony Type constraint link to removed php function and is not used in symfony Jan 6, 2023
javiereguiluz added a commit that referenced this issue Jan 7, 2023
This PR was merged into the 5.4 branch.

Discussion
----------

[Validator] Update constraint Type types

Follow of #17665

New sort is same like code https://github.com/symfony/symfony/blob/ed96673e64ebaca3f47012c230823dcddd59a2ba/src/Symfony/Component/Validator/Constraints/TypeValidator.php#L23-L52

No type is deprecated so for now I think we should document all available types

Commits
-------

60dab01 Update constraint Type types
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

No branches or pull requests

3 participants
0