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

Support PSR-12 use statements #122

Open
d8vjork opened this issue Jul 29, 2019 · 6 comments
Open

Support PSR-12 use statements #122

d8vjork opened this issue Jul 29, 2019 · 6 comments
Labels
bug replicated syntax PHP syntax detection

Comments

@d8vjork
Copy link

d8vjork commented Jul 29, 2019

When enable fully qualify class names on the extension settings the extension doesn't get the full PSR-12 namespaces (implemented on the PHP intelephense extension)

@neild3r
Copy link
Owner

neild3r commented Jul 29, 2019

It should provided you have a use statement for the class you are type hinting. Have you got an example?

@d8vjork
Copy link
Author

d8vjork commented Jul 29, 2019

Yes, here I send an example:

<?php

namespace SkoreLabs\JsonApi\Http\Resources;

use Illuminate\Support\{Arr, Collection};

trait CollectsWithIncludes
{
    /**
     * Undocumented function
     *
     * @param Arr $arr
     * @return void
     */
    public function testFunction(Arr $arr)
    {}
}

@neild3r
Copy link
Owner

neild3r commented Jul 29, 2019

Thanks for providing an example.

It's because you are using the multiple use statement. Which isn't PSR-2 so I never do it and thus never implemented it. But it probably is possible to do this as well and the package should probably support it.

@tianyiw2013
Copy link
Contributor

Hope to support as soon as possible.

https://www.php-fig.org/psr/psr-12/

for example:
Short form of type keywords MUST be used i.e. bool instead of boolean, int instead of integer etc.

Thank you very much. @neild3r

@neild3r
Copy link
Owner

neild3r commented Jan 2, 2020

@tianyiw2013 there is already a config option for this

@tianyiw2013
Copy link
Contributor

@tianyiw2013 there is already a config option for this

ok.

But, I suggest that default to bool instead of boolean etc.

@neild3r neild3r added the syntax PHP syntax detection label Sep 1, 2021
@neild3r neild3r changed the title Support PSR-12 Support PSR-12 use statements Sep 7, 2021
@tianyiw2013 tianyiw2013 mentioned this issue Dec 10, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug replicated syntax PHP syntax detection
Projects
None yet
Development

No branches or pull requests

3 participants