DirectoryTree / LdapRecord

A fully-featured LDAP framework.
https://ldaprecord.com
MIT License
514 stars 44 forks source link

[Feature] User query should return type #644

Closed vatsake closed 1 year ago

vatsake commented 1 year ago

Currently LdapRecord\Models\ActiveDirectory\User query()->get() returns \LdapRecord\Query\Collection.

But it should return \LdapRecord\Query\Collection<int, User> so IDE would autocomplete.

stevebauman commented 1 year ago

Hi @vatsake,

This won't be possible because the query builder methods apply to all models, so we cannot apply type hints to the query builder for specific models.

Unless you know of a creative way to do this of course.

vatsake commented 1 year ago

Oh ok. But doesn't Laravel query builder models retain their types?

stevebauman commented 1 year ago

I don't think so, but I'll check later today to see if they've been able to add them in somehow and use their approach if it works!