DEVSENSE / phptools-docs

PHP Tools public content
Apache License 2.0
83 stars 10 forks source link

Return Type warning when type is correct #712

Closed murugappanrm closed 4 weeks ago

murugappanrm commented 4 weeks ago

My extension version : 1.52.16226

In the Laravel code shown below, the return type is defined as View and the return value is view but it generates a warning. I am not sure why?

Screenshot_3

jakubmisek commented 4 weeks ago

Thank you for the issue.

I think the View is a facade to "view" service, and we don't handle this case well.

murugappanrm commented 4 weeks ago

So how do i get rid of this type of error? Dont define the return type?

jakubmisek commented 4 weeks ago

For now, yes, you can not define the return type.

But it is a bug on our side.

jakubmisek commented 4 weeks ago

When I actually run the code, I'm getting this exception:

Return value must be of type View, Illuminate\View\View returned

I guess, you need to add use Illuminate\View\View; to make it work. I'm not getting the warning then:

image

murugappanrm commented 4 weeks ago

Yep, it works. The code action was also helpful. Otherwise it would be extremely difficult with Laravel being monolithic and messy. I am fan of Codeigniter which small, simple and fast (documentation needs a lot of improvement).

Thank you for your assistance. Leave it to you to determine if this issue should be closed.

jakubmisek commented 4 weeks ago

Thank you for the confirmation.

Since the warning is actually correct, we'll keep it as it is.