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

tests: improve tests for ide #406

Open
wants to merge 5 commits into
base: 1.x
Choose a base branch
from

Conversation

Chris53897
Copy link
Contributor

This helps the IDE (in my case PhpStorm) to read the code.
Please have a look if you find it useful and is correct.

@Chris53897 Chris53897 changed the title Feature/improve tests tests: improve tests for ide Jan 22, 2023
Copy link
Member

@nikophil nikophil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @Chris53897 thanks for your PR

IMO IDE-specific annotations should not land in the code.

tests/Functional/RepositoryProxyTest.php Outdated Show resolved Hide resolved
tests/Functional/RepositoryProxyTest.php Outdated Show resolved Hide resolved
tests/Functional/ProxyTest.php Outdated Show resolved Hide resolved
src/Test/TestState.php Outdated Show resolved Hide resolved
Chris53897 and others added 3 commits January 22, 2023 19:37
Co-authored-by: Nicolas PHILIPPE <nikophil@gmail.com>
Co-authored-by: Nicolas PHILIPPE <nikophil@gmail.com>
@Chris53897
Copy link
Contributor Author

I changed it and add the use statements.

PhpStorm does not yet understand it like this https://youtrack.jetbrains.com/issue/WI-55925.
I guess it can only understand it like this.
https://blog.jetbrains.com/phpstorm/2021/07/phpstorm-2021-2-release/#class-string

But maybe other ide's can understand it now. And hopefully phpstorm in the future

@nikophil
Copy link
Member

PhpStorm does not yet understand it

I've tried your PR, and trying to "ctrl + click" createMany() in this code, and it works pretty well

// \Zenstruck\Foundry\Tests\Functional\RepositoryProxyTest

    public function can_find_random_object(): void
    {
        $this->categoryFactoryClass()::createMany(5);

@nikophil
Copy link
Member

if PHPStorm does not understand it, we could change like this, maybe?

    /** @return class-string */
    abstract protected function categoryClass(): string;

    /** @return class-string<ModelFactory> */
    abstract protected function categoryFactoryClass(): string;

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

Successfully merging this pull request may close these issues.

None yet

3 participants