-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Support @template/generic phpdoc syntax #1144
Comments
I don't know if this is what you will add support, but it would very great if you can recognize namespace Omega\Configuration;
interface ConfigurationReaderInterface
{
/**
* Returns a configuration value.
*
* @template T
* @param string $key
* @param T $default
* @return T
*/
public function getValue(string $key, $default = null);
} |
This may be noisy on an issue thread. If so apologies. My organization is considering switching from VSCode to PHPStorm over support for this. We'd like to stay on VSCode, so this is something we're really ready to use. |
This feature would be great! I just found a detailed description on PHPStan, Generics in PHP usin PHPDocs. Cheers 🍻 |
Any updates on this? |
we really need this! |
@bmewburn PHPStorm started using generics in their definitions: https://github.com/JetBrains/phpstorm-stubs/blob/60371693469c5c191f5f31780300629d4fddce12/standard/_types.php#L151-L163 /** @return Generator */
function gen(){ yield 3; }
$gen = gen();
foreach($gen as $item){
$item; // => @var \TYield $item
} |
Just a link to PHPStorms release documentation :-) https://blog.jetbrains.com/phpstorm/2021/07/phpstorm-2021-2-release/#generics |
Laravel 9.x now supports Generics in Collections (as seen in the PHPStorm blog) This will cause errors to be displayed from Intelephense until it is resolved. because Intelephense does not understand generics at all. Also: https://phpstan.org/blog/generics-in-php-using-phpdocs |
Can we start a financial goal for this / would there be interest in this? I've already paid for the plugin and I'd put at least $250-500 bucks 😆 of my own money in for generics & I appreciate the price I've already paid for premium is low but I'm feeling pretty upset that I'm stuck with what I feel is three options for more intricate PHP Development:
If anyone has any other suggestions for things to try that would be greatly appreciated (I'm fairly proficient with vim bindings so I'd be willing to use vim but I'm not if any open source or paid LSP supports template generics etc.) I feel ridiculous suggesting this but I can't really think of any other way I can make this happen short of writing my own LSP or switching and contributing to another open source one (nothing else compares: https://langserver.org/). I've used phpactor in the past and its seems viable for small projects but from what I gather it is not at the phpdoc stage much. @bmewburn I appreciate you might be inundated with work/life already so feel free to say otherwise but would a |
I should probably note my preferred method of support would be a subscription like PHPStorm so you can continue to work on improving the LSP :) |
Ben marked this for the 1.9 release so I assume he's in the middle of getting it done |
As much as I hate mindless thread bumps, count me in. The 10$ perpetual license is a steal. Many of us shell out way more for way less essential tools, and on a subscription basis at that. (I realize generics might be right around the corner, but the subscription idea would still stand.) (Also, I hope this doesn't come across as super pushy or anything. Just want to express my support and appreciation for your work.) |
Due to this issue PHPUnit's PHPUnit uses psalm templates so I thought I'd propose to add some more generic templates there. However, this is pointless as long as Intelephense doesn't support generics. |
A lot of generics type hinting is added in all sorts of packages, but can't make use of it with vscode. I am a long time vscode supporter, but starting to checking out phpstorm, because of this. Anyhow this can be pushed/supported? |
Just tried PHPTools (DevSense) because of the generics support... .. it does what I want regarding generics. But either I'm set in my ways, or it has very annoying quirks that make me want to get back to Intelephense very quickly. I paid 100,- once... I'd happily pay it every year or so to keep support going, but if I'm the only one saying that, it will not change things I reckon :). |
@jorismak As long you can choose to upgrade by a 100,- or keep the existing, I think it is fine. But not a required subscription. |
What i find disingenuous about this project now is that @genius257 recommended DevSense because Intelephense is essentially dead/stalled and the repo owner of Intelephense removed the comment. Some of us are just trying to find something that actually works. Thanks to @genius257 for pointing this out and thanks to github email or I would have never found it. This project will be my first goto but there's literally no communication from the one developer. So developer to developer let us talk about other software unless you want to make an announcement yourself about development or give us a roadmap.
@jorismak I've found the following settings to disable everything but the code completetions and hover:
|
@tm1000 it's not disingenuous. This issue board is for discussing issues in this extension. The internet is a big place, I'm sure there are many forums where you can discuss such things. Would you be OK with me going to your repos and commenting on alternatives that I perceive as better? This project hasn't progressed as quickly as I'd like it to, but a release with templates is just around the corner. |
You've said this many times before. But you have over 500 open issues here and not much communication from your standpoint. Which is why this thread (and others) continue to spiral and people start recommending alternatives. It's your project obviously you are free to do what you want but perhaps a blog or some announcements would be nice. See: #2245
If the project appears dead/stalled then people will comment alternatives. It's already happening. The fact that you removed the comment without even a word/comment from yourself is the issue. Everyone runs projects differently but if you expect people to not comment alternatives when you aren't giving anyone updates or roadmaps I think that's an unrealistic expectation. You've also left @jorismak comment intact which mentions the same thing? Why? |
@bmewburn I think it is fair if you make a new version to get paid for it - Like EA FIFA games each year get released with an upgraded version - or Adobe Photoshop Elements… |
I do agree that the tickets / issues are not to be used as a discussion
forum. Let's not make this a bigger problem then it needs to be .
Release right around the corner sounds like music to my ears , so i want to
focus on the good news :).
…On Wed, Dec 28, 2022, 22:08 Andrew Nagy ***@***.***> wrote:
This project hasn't progressed as quickly as I'd like it to, but a release
with templates is just around the corner.
You've said this many times before. But you have over 500 open issues here
and not much communication from your standpoint. Which is why this thread
(and others) continue to spiral and people start recommending alternatives.
Would you be OK with me going to your repos and commenting on alternatives
that I perceive as better?
If the project appears dead/stalled then people will comment alternatives.
It's already happening. The fact that you removed the comment without even
a word/comment from yourself is the issue.
—
Reply to this email directly, view it on GitHub
<#1144 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALMD2DRQBP3E7WAMRFWRFDDWPST6LANCNFSM4NCZRQMA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
The problem might not be money related . Thinking that with more money
comes more time to work on this , might not be true at all. He/she may have
different problems or different wishes to run his/her life .
Like with any project run by just one person or a very small team , I'm
glad for any work it gets .
…On Wed, Dec 28, 2022, 22:09 Bo Andersen ***@***.***> wrote:
@bmewburn <https://github.com/bmewburn> I think it is fair if you make a
new version to get paid for it - Like EA FIFA games each year get released
with an upgraded version - or Adobe Photoshop Elements…
—
Reply to this email directly, view it on GitHub
<#1144 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALMD2DWXZYOAARHIMEL4VLTWPSUBBANCNFSM4NCZRQMA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I don't know if the following is related at all to this thread, but i see that @KapitanOczywisty quoted I'm having an error function gen() { yield 'aaa'; }
echo (
fn (): string =>
gen()
->current()
)(); strangely the error goes away if i use an arrow function as generator (the code has the same result though): echo (
fn (): string =>
(fn()=>yield 'aaa')()
->current()
)(); Could anyone tell me, is this even related to the thread? Thanks |
@aetonsi , yes your issue will be resolved by this. |
First iteration of templates will be in the 1.9 release. Laravel 9 was used as a base test case. Please open new tickets for bugs/features. |
Syntax for generic
iterable
andArrayAccess
types is supported (iearray<int, Foo>
andCollection<int, Foo>
) but there is not currently support for user created generic classes and functions using@template
which has gained popularity in phan, phpstan, psalm etc.The text was updated successfully, but these errors were encountered: