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

Make EntityDto generic #5572

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from
Open

Make EntityDto generic #5572

wants to merge 1 commit into from

Conversation

b1rdex
Copy link
Contributor

@b1rdex b1rdex commented Jan 15, 2023

Adding these annotations will provide types to the app. I'm tired of writing tones of @var annotations and assert()s.

Usage:

/**
 * @extends AbstractCrudController<Category>
 */
class CategoryCrudController extends AbstractCrudController
{
    public static function getEntityFqcn(): string
    {
        return Category::class;
    }

    public function detail(AdminContext $context)
    {
        $instance = $context->getEntity()->getInstance();
        \PHPStan\dumpType($instance); // $instance is Category
    }
}

Adding these annotations will provide types to the app. I'm tired of writing tones of `@var` annotations and `assert()`s.

Usage:
```php
/**
 * @extends AbstractCrudController<Category>
 */
class CategoryCrudController extends AbstractCrudController
{
    public static function getEntityFqcn(): string
    {
        return Category::class;
    }

    public function detail(AdminContext $context)
    {
        $instance = $context->getEntity()->getInstance();
        \PHPStan\dumpType($instance); // $instance is Category
    }
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant