You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description
This references this (partly) fixed bug: #2330
Since last fix, this works now, no matter if it's in __construct() or not, MY_API constant will be in global scope like it should.
define("MY_API", newMyAPIObject());
BUT there's still something clitching. Here's how to reproduce the issue;
classMyClass {
publicMyAPIObject$Object;
publicfunction__construct() {
define("MY_API", $this->MyAPIObject = newMyAPIObject());
// MY_API will be available in global scope, and references to $this->MyAPIObject and works ok,// but intelephense does not recognize for being MyAPIObject instance, not within this class, or global scope // - and gives no suggestions.
}
}
Same thing happens if it's written like this:
classMyClass {
publicMyAPIObject$Object;
publicfunction__construct() {
$this->MyAPIObject = newMyAPIObject();
define("MY_API", $this->MyAPIObject);
// MY_API will be available again in global scope, but Intelephense does not recognize it// for being MyAPIObject instance. Not within this class, or global scope.
}
}
Also @alxgarshin has commented on closed case #2330 something that might be part of as described above
Thank you very much! Now I'm able to use a constant defined with a "new" pattern. However, it's still impossible to use a singleton pattern.
Expected behavior
On all these cases intelephense should recognize MY_API constant for being instance of MyAPIObject. Within object instance and global scope, as like PHP itself recognizes it.
Platform and version
Win10 / Latest Intelephense / Latest VSCodium
The text was updated successfully, but these errors were encountered:
pjylkka
changed the title
recognizing defined constants for being Objects is still buggy
Recognizing defined constants for being objects has still an another bug
Apr 24, 2024
Bug description
This references this (partly) fixed bug: #2330
Since last fix, this works now, no matter if it's in
__construct()
or not, MY_API constant will be in global scope like it should.BUT there's still something clitching. Here's how to reproduce the issue;
Same thing happens if it's written like this:
I also tried to give hints to it with no success.
Also @alxgarshin has commented on closed case #2330 something that might be part of as described above
Expected behavior
On all these cases intelephense should recognize MY_API constant for being instance of MyAPIObject. Within object instance and global scope, as like PHP itself recognizes it.
Platform and version
Win10 / Latest Intelephense / Latest VSCodium
The text was updated successfully, but these errors were encountered: