-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
refactor: Fix phpstan codeigniter.modelArgumentInstanceOf #9391
base: develop
Are you sure you want to change the base?
refactor: Fix phpstan codeigniter.modelArgumentInstanceOf #9391
Conversation
02138c8
to
2fa1eee
Compare
RESTFul uses |
* | ||
* @return void | ||
*/ | ||
public function setModel($which = null) | ||
{ | ||
if ($which !== null) { | ||
$this->model = is_object($which) ? $which : null; | ||
$this->modelName = is_object($which) ? null : $which; | ||
$this->modelName = is_object($which) ? '' : $which; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change, any test for it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->modelName
is always a string
. Why is there null there? model()
will throw an error if you pass null
.
What test do you need? You even need to change the type $this->modelName
Description
I need help.
I still don't understand how to work with generics. I can add simple hints, but any condition raises questions.
How do I specify here "If $which is
class-string<Model> ? class-string<Model> : Model|object|string|null
" and then update the hint formodel($this->modelName)
The phpstan documentation is small. There is no description of most use cases. Did I miss something?
Checklist: