I'm not sure why I'm seeing this error. I'm a newbie to the PhpStorm IDE and didn't see these kinds of errors when I was developing in SublimeText2/3.
The error when I hover over the red text just says @property-write
In my Users Model class it looks like this:
What am I doing wrong? What are the best practices to fix errors like these?
Property declared using PHPDoc's @property-write
tag represents a property that can have write-only access outside of the class (i.e. you can write to it/assign new value but cannot read from it).
In your example you are trying to read from that property.
https://phpdoc.org/docs/latest/references/phpdoc/tags/property-write.html
What am I doing wrong?
First of all -- who did generate that @propert-write mixed $timezone
line in first place?
(without knowing your project details)
@property
)?What are the best practices to fix errors like these?
The most common fix would be just changing the tag to be @property
-- it will allow both write
and read
access.
I'm a newbie to the PhpStorm IDE and didn't see these kinds of errors when I was developing in SublimeText2/3.
PhpStorm knows more about your code (PHP in this particular case) because of its Inspections. You may also install 3rd party "Php Inspections (EA Extended)" plugin to add even more inspections.