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

Document Twig vs PHP types #4362

Merged
merged 1 commit into from
Sep 30, 2024
Merged

Document Twig vs PHP types #4362

merged 1 commit into from
Sep 30, 2024

Conversation

fabpot
Copy link
Contributor

@fabpot fabpot commented Sep 29, 2024

Refs #4256

@fabpot fabpot force-pushed the document-twig-types branch from 530480e to 66e8bce Compare September 29, 2024 16:40
@fabpot
Copy link
Contributor Author

fabpot commented Sep 29, 2024

I think this one is ready, comments are welcomed.
Note that this is about documenting "native" Twig types and not all types supported by the @types tag.

@fabpot fabpot force-pushed the document-twig-types branch from 66e8bce to ac47c88 Compare September 29, 2024 16:45
@fabpot
Copy link
Contributor Author

fabpot commented Sep 30, 2024

@drjayvee @ruudk I'd love to have your thoughts here.

@drjayvee
Copy link
Contributor

Thanks for the heads up, Fabian. I'll have a look at this tomorrow or Wednesday and will provide feedback.

Copy link
Contributor

@ruudk ruudk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

doc/templates.rst Outdated Show resolved Hide resolved
@fabpot fabpot force-pushed the document-twig-types branch from ac47c88 to aa5467c Compare September 30, 2024 21:02
@fabpot fabpot force-pushed the document-twig-types branch from aa5467c to 9690e7b Compare September 30, 2024 21:04
@fabpot fabpot merged commit a16053b into twigphp:3.x Sep 30, 2024
49 checks passed
@fabpot fabpot deleted the document-twig-types branch September 30, 2024 21:30
@drjayvee
Copy link
Contributor

drjayvee commented Oct 1, 2024

LGTM as well 👍

Twig Type PHP Type
=================== ===============================
string A string or a Stringable object
number An integer or a float
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the docs int is used here: https://twig.symfony.com/doc/3.x/tags/types.html#types
Do we specify for the new feature PHP types instead of Twig types?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

While the documentation states "The syntax for and contents of type strings are intentionally left out of scope", I do agree that "number" and "boolean" are better choices to align with the documentation on types.

I'll create a PR for updating the types documentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Voila: #4403

drjayvee added a commit to alisqi/Twig that referenced this pull request Oct 21, 2024
Specifically, "bool" => "boolean" and "int" => "number".

This aligns the `types` documentation with templates.rst. See twigphp#4362

Thanks, @alexander-schranz!
fabpot added a commit that referenced this pull request Oct 23, 2024
…nstead of PHP (drjayvee)

This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Documentation for types tag uses Twig types in examples instead of PHP

Specifically, "bool" => "boolean" and "int" => "number".

This aligns the `types` documentation with templates.rst. See #4362

Thanks, `@alexander`-schranz!

Commits
-------

f3e0a00 Documentation for types tag uses Twig types in examples instead of PHP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants