Return value of type undefined is required
See the error squiggle under the return; the error generated is "Return value of type undefined is required". It seems to be caused by the @return in the comment above the function. If I completely remove the line " * @return undefined " the error goes away.
If I put it back it comes back, but not always right away!
So, my question is this. Why does the commented line above cause the return statement in this Javascript function ( pulled from the jCarousel source ) to show as an error in phpStorm?
O.
Please sign in to leave a comment.
Change it to @return void
in javascript isn't void and undefined the same thing? So why does void work and not undefined?
void 0 === undefined <-- evaluates to true after all.
But more importantly, how does the comment affect the return statement in the code? That's what has me confused.
O.
Not sure about the void === undefined aspect, but the comment is saying that the return type is incorrect and marking it for you.
fair enough!
Now the big question.
Why is the comment marking this? Does it have something to do with the '@' before the return? Is this phpDoc stuff at work? I've tried doing a bit of research, but I'm coming up fairly blank as to the mechanics behind this comment interaction stuff and how it's supposed to be employed!
O.
Ah, yes. Sorry, I thought just assumed you were familiar with PHPStorm and how it uses the PHPDoc syntax to specify parameter types (in PHP) and return types (in PHP or JS.)
Not a problem!
I'm easily confused! ;)
I've only been programming regularly in php and javascript since May 2nd! I have a lot of catchup to do.
Coming to this from .NET so it's been interesting.
Loving phpStorm and it's focused environment over eclipse or Netbeans (the other two IDE's I've tried for php development) a lot!
So much to learn!
O.