Skip to content

Variable type injection via docblock does not completion #678

Closed

Description

@maamo888

Info (example: slim framework)

Install

composer require slim/slim

Code (index.php)

<?php
require 'vendor/autoload.php';

/** @var \Slim\App $app */
$app->|

Phpactor (Snap shot)

phpactor_variable_type_not_completion_

In the case of phpcd.vim under the same condition (Snap shot)

phpcd_variable_type_not_completion_

https://github.com/lvht/phpcd.vim

Activity

  1. dantleech commented on Dec 20, 2018

    @dantleech
    Collaborator

    It will work if it was assigned:

    untitled

    But I'm not that familiar with Slim, what is the real use case here?

  2. maamo888 commented on Dec 21, 2018

    @maamo888
    Author

    In phpactor we could complete the complement by writing the symbol $app = null;.

    However phpstorm and phpcd.vim can complement without symbols.

    phpactor (snap shot)

    1_phpactor_variable_docblock_completion_1

    phpstorm (snap shot)

    2_phpstorm_variable_docblock_completion_1

    phpcd.vim (snap shot)

    3_phpcd_variable_docblock_completion_1

  3. dantleech commented on Dec 21, 2018

    @dantleech
    Collaborator

    Sure, but why would you want to do that? :)

    Also happy to change this behavior, just curious if there is an actual use case?

  4. maamo888 commented on Dec 22, 2018

    @maamo888
    Author

    Use case is Laravel.

    /** @var Illuminate\Database\Eloquent\Factory $factory */

    Ref posts: https://laravel-news.com/your-first-laravel-application

  5. dantleech commented on Dec 22, 2018

    @dantleech
    Collaborator

    I see, +1

  6. dantleech commented on Dec 22, 2018

    @dantleech
    Collaborator

    Fixed in #680

  7. maamo888 commented on Dec 22, 2018

    @maamo888
    Author

    Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions