PHP 7.1 void return type is unknown to Zend Studio

General discussion on Zend Studio
Post Reply
stef7535
Posts: 2
Joined: Wed May 31, 2017 10:00 am

PHP 7.1 void return type is unknown to Zend Studio

Post by stef7535 » Wed May 31, 2017 10:13 am

In the editor I've this fragment of code:

Code: Select all

<?php
class a
{
    public function f(): void
    {
        
    }
}
Zend Studio 13.6 warns me this way:
voidwarn.png
voidwarn.png (8.97 KiB) Viewed 2587 times
hovering the void word I can read in a popup:

"The type void cannot be resolved"

1 quick fix available:
- Inject missing use statement.

Am I missing something about using Zend Studio 13.6 or PHP 7.1 or this is a bug?

ben45
Posts: 1
Joined: Thu Jun 01, 2017 8:03 am
Contact:

Re: PHP 7.1 void return type is unknown to Zend Studio

Post by ben45 » Thu Jun 01, 2017 8:10 am

Hm,I think that my brother had similar problem. I don't remember how he solved it, but I think that it could be some kind of a bug, hard to tell. I'll try to reach out to him and then I'll let you know (or maybe the support team will be faster, they are really good:)).

mich6938
Zend Product Manager
Posts: 352
Joined: Wed Jul 16, 2014 12:32 pm

Re: PHP 7.1 void return type is unknown to Zend Studio

Post by mich6938 » Fri Jun 02, 2017 7:27 am

Hi,
The issue comes from extension PDT Extensions. It was most probably installed as a dependency to different plugin e.g. Symfony. To suppress those errors/warnings:
* open Preferences from the main menu
* go to General -> Capabilities and select PDT Extensions element
* close and open Preferences dialog
* go to PHP -> Validation -> Semantic Analysis
* select Enable semantic analysis and press Apply (press Yes when you will be asked to rebuild project)
* deselect Enable semantic analysis and press Apply (press Yes when you will be asked to rebuild project)
* warning should disappear

The workaround is a little bit long but should help. If something won't work let me know. HTH.

stef7535
Posts: 2
Joined: Wed May 31, 2017 10:00 am

Re: PHP 7.1 void return type is unknown to Zend Studio

Post by stef7535 » Mon Jun 05, 2017 8:46 am

Good! Your procedure works, but to make the warning disappear I had to restart Zend Studio also to make it work, as last step.

Thank you very much for your help.

Greetings,
Stefano

Post Reply