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

[Twig] Improve Twig types support #1035

Open
Koc opened this issue Sep 30, 2017 · 6 comments
Open

[Twig] Improve Twig types support #1035

Koc opened this issue Sep 30, 2017 · 6 comments
Assignees
Labels

Comments

@Koc
Copy link
Contributor

Koc commented Sep 30, 2017

Follow-up of #972

{# @var pagerfanta \AppBundle\Entity\MeterValueDTO[] #}
{% for item in pagerfanta %}
{% endfor %}

MeterValueDTO is not clickable

{# @var \AppBundle\Entity\MeterValueDTO[] pagerfanta #}
{% for item in pagerfanta %}
{% endfor %}

item type not resolves properly because I've changed order of type and variable name. But PS supports both standards, even more second is consistent with @param declaration for methods - type first, variable name - second

@Haehnchen Haehnchen self-assigned this Oct 10, 2017
@Haehnchen Haehnchen added the todo label Oct 10, 2017
@Koc
Copy link
Contributor Author

Koc commented Dec 15, 2017

Iterators call also not resolved properly:

class GeneratedReport implements \IteratorAggregat
{
    /**
     * @return Row[]
     */
    public function getIterator()
    {
        // ...
    }
}
{% for report in reports %}
    {# @var report \App\Reporting\Generated\GeneratedReport #}
    <table cellspacing="0" border="0">

        {% for row in report %}
            {{ row.<NO AUTOCOMPLETE HERE> }}
            <tr>
                {% for cell in row %}

                    <td
                            {% if cell.colspan > 1 %}colspan="{{ cell.colspan }}"{% endif %}
                            {% if cell.rowspan > 1 %}colspan="{{ cell.rowspan }}"{% endif %}
                            class="{{ cell.purpose }}"
                    >
                        {{ cell.value }}
                    </td>
                {% endfor %}
            </tr>
        {% endfor %}
    </table>
{% endfor %}

Also I've tryed write {% for row in report.getRows() %} but getRows hasn't autocomplete inside for tag. But autocompletes ok inside twig output {{ report.getRows() }}

@Koc
Copy link
Contributor Author

Koc commented Dec 16, 2017

Ref #576

Haehnchen added a commit that referenced this issue Dec 18, 2017
Haehnchen added a commit that referenced this issue Dec 18, 2017
Haehnchen added a commit that referenced this issue Dec 18, 2017
improve Twig types support for inline type declaration {# @var Class variable #} and {# @var variable Class #} #1035
@Haehnchen
Copy link
Owner

first comment done.

@Koc
Copy link
Contributor Author

Koc commented Dec 18, 2017

Really cool, thank you!

@rwitchell
Copy link

great work 👍

Haehnchen added a commit that referenced this issue Dec 21, 2017
@Koc
Copy link
Contributor Author

Koc commented Dec 21, 2017

One interesting thing: types loosing inside nested blocks:

{% block one %}
    {# @var \Foo a #}
    {% set a = func() %}
    {{ a.<AUTOCOMPLETE OK> }}
    {% block two %}
            {{ a.<NO AUTOCOMPLETE HERE> }}
    {% endblock %}
{% endblock %}

Maybe PS bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants