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

Type hints for repositories #116

Merged
merged 1 commit into from
Feb 8, 2018
Merged

Type hints for repositories #116

merged 1 commit into from
Feb 8, 2018

Conversation

enleur
Copy link
Contributor

@enleur enleur commented Feb 7, 2018

It helps IDE to get correct type if you do calls like this

$user = $this->userRepository->find(1);
$user->getId(); //IDE knows that this is a User class and gives correct autocomplete

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

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

I like this! And putting all PHPdocs in the class makes it really concise. Thanks @enleur.

Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

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

Very clever... :)

@enleur
Copy link
Contributor Author

enleur commented Feb 7, 2018

Should I fix code style?

@weaverryan
Copy link
Member

Yes please :). Unless it’s recommending to use array() instead of [] - that is currently a false recommendation (we use the short syntax)

@enleur
Copy link
Contributor Author

enleur commented Feb 7, 2018

Done

@weaverryan
Copy link
Member

Thank you Sergey!

@weaverryan weaverryan merged commit e7dfff0 into symfony:master Feb 8, 2018
weaverryan added a commit that referenced this pull request Feb 8, 2018
This PR was merged into the 1.0-dev branch.

Discussion
----------

Type hints for repositories

It helps IDE to get correct type if you do calls like this

```php
$user = $this->userRepository->find(1);
$user->getId(); //IDE knows that this is a User class and gives correct autocomplete
```

Commits
-------

e7dfff0 Add type hints for repository templates
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.

3 participants