PhpStorm complains -- and doesn't -- about magic methods

82 Views Asked by At

The code IS working. The question is not about whether one should or should not use magic methods, its advantages vs disadvantages and what not. This question will probably be reviewed by a moderator, saying that it is not a real problem and all, but bear with me.

In the screenshot you can see that I use two different buffers (from the same base class) to decide if or not to store a received file (it's a controller dealing with a POST request).

As it is Saturday night and I have no life at all, I decided to pay attention to the seemingly disparate squiggle lines being shown at only one object while the other object is from the same class. WTF moment for me. So I decided to ask what am I not seeing.

The objects are $original (a possibly first occurrence of an import request), and $register (the new import request register). Both are Eloquent Models (as seen on the right side of the screenshot).

I did the usual inspections and tinkering in, well, Artisan Tinker, only to confirm that the two objects are from the same class, both respond correctly to the ->property syntax, and that there's no hidden camera recording a practical joke on me. It must be because I AM the joke, for not being able to understand why PhpStorm complains about magic methods on one object, and not on the other.

I know how to turn off the warning, but that's not the point. The point is:

What is the difference between these two objects, since both are populated with a single record?

I've tried:

  1. annotating the class to create @property;
  2. using the static style syntax - ImporRegister::create();
  3. doing the rain dance in a desperate attempt there was something wrong with my eyes;

enter image description here

0

There are 0 best solutions below