barryvdh / laravel-ide-helper

IDE Helper for Laravel
MIT License
14.13k stars 1.15k forks source link

Real-Time Facade Support #680

Open tobzsc opened 6 years ago

tobzsc commented 6 years ago

I have tried several version from latest stable to latest master. The package does not have real-time facade support, doesn't it?

Is there any way to add such a feature?

tobzsc commented 6 years ago

There was also a discussion about this for laravel https://github.com/laravel/ideas/issues/647

beNjiox commented 6 years ago

That would be awesome indeed!

Laravel generates files that I believe could be leveraged by the package (as mentioned by @barryvdh in the discussion linked above) to provide the necessary doc blocks / jump to source capabilities. See screenshot of generated files: https://cl.ly/9cac6d888a9a

🙏

i-bajrai commented 4 years ago

This would be a giant help especially with testing, anyone got any ideas on how to start it?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

rogatty commented 4 years ago

The issue is still present in v2.7.0.

yangm97 commented 4 years ago

Meanwhile, is there a workaround for this?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

rogatty commented 3 years ago

The issue is still present in v2.8.1. I don't know of any workarounds but am slowly starting to think we need to stop using real time facades in our project 🙄

mfn commented 3 years ago

No the right place for this discussion I know, but I don't use Facades at all.

It's always better to explicitly declare your dependencies (constructor injection).

Of course these are not "your next blog" projects, but they're bigger etc. ide-helper is still invaluable especially the phpdoc of properties on models, now that static analyzers also take advantage of them.

Not all but most/many facades to have already very useful phpdoc in Laravel so most things will work already sufficient enough in modern IDEs.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

prattcmp commented 2 years ago

+1

beNjiox commented 2 years ago

For anyone looking at this thread, in your folder storage/framework/cache, you will find files like

facade-0ddfd85831f9b9c062057cf8727fa4f6ec6410ef.php

Inside, you'll have the real time facade generated, looking like

<?php

namespace Facades\App\Services\CreateProductImages;

use Illuminate\Support\Facades\Facade;

/**
 * @see \App\Services\CreateProductImages\CreateProductImages
 */
class CreateProductImages extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'App\Services\CreateProductImages\CreateProductImages';
    }
}

Doing a search and replace on @see --> @mixin will give PHPStorm (didn't test on other IDEs) auto "jump to source" and autocomplete.

This is not ideal but it works. Not sure if this is laravel-ide-helper territory though.

Hope this helps!

barryvdh commented 1 year ago

I'm not using them either, but if it's easy to do, we might add them? If there is a PR, let me know.

filipac commented 1 year ago

@barryvdh I created a PR for this now :) https://github.com/barryvdh/laravel-ide-helper/pull/1455

Pab89 commented 10 months ago

Any plans to look at this ? Could be real helpfull!