Hmm, your sample works pretty fine in PhpED:
probably you have another problem. Please check that Code Explorer shows SingletonExample class. If it does not, make sure that the file with this class is in the project, or in one of the directories listed in Code Insight Includes list. Finally, check that file has an extension associated with PHP5.
Quote: |
Even though I am providing two hints, one by specifying what the method returns and one by specifying the type of the actual instance variable. |
neither is required in your case because this code is not polymorphic and all types are clearly known without hints. See short version below:
But, if you used something like below, it would require hint.
function ($clsname) {
return new $clsname;
} |