Intelisense Tweak - Static Methods
11 posts
• Page 1 of 2 • 1, 2
Intelisense Tweak - Static Methods
If I call a static method from an instantiated object, Intellisense doesn't work. This seems a little odd, given that I believe it's perfectly acceptable to call a static method as an object method. Can this be tweaked to give the appropriate Intellisense?
-
AndyM84 - Posts: 69
- Joined: August 6th, 2012, 3:24 pm
- Location: Boston, MA, USA
Re: Intelisense Tweak - Static Methods
This was actually intended as a feature, trying to keep your code clean.
PHP allows call of static method on an instance, but we still don't know why would somebody do that If it is a common PHP developer scenario, we can enable it.
PHP allows call of static method on an instance, but we still don't know why would somebody do that If it is a common PHP developer scenario, we can enable it.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Intelisense Tweak - Static Methods
I usually do it as a matter of convenience. I grab a singleton of a class first to do a couple other things, and then call the doAuth() static method using the singleton instance.
I'm honestly not sure if it's common practice, but it's just something I've used to save myself time (and generally speaking calling methods from an object instance is faster than calling them statically if memory serves).
I'm honestly not sure if it's common practice, but it's just something I've used to save myself time (and generally speaking calling methods from an object instance is faster than calling them statically if memory serves).
-
AndyM84 - Posts: 69
- Joined: August 6th, 2012, 3:24 pm
- Location: Boston, MA, USA
Re: Intelisense Tweak - Static Methods
We can allow calling static methods on instance object, I think there might be more users expecting this to work.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Intelisense Tweak - Static Methods
Hi,
I just downloaded the trial version and I have the same problem.
If I can do something to get the intelisense as I expect, please tell me what should I do.
This is an example of code:
Thank you
I just downloaded the trial version and I have the same problem.
If I can do something to get the intelisense as I expect, please tell me what should I do.
This is an example of code:
- Code: Select all
<?php
class StaticClass
{
public static $title = '';
public static $db = null;
function __construct(){}
public static function InitFunction()
{
self::$title = 'test';
self::Mysql_start();
}
public static function Mysql_start()
{
self::$db = new MyDb();
self::$title = self::$db->DoSomething(); // here intelisense isn't working
}
}
class MyDb
{
public $data = '';
public function DoSomething($varData = 'MyData')
{
return $varData;
}
}
class MyProgram
{
private $db = null; // this is a local copy of the StaticClass::$db
function __construct()
{
StaticClass::InitFunction();
echo(StaticClass::$title."\n");
$this->db = StaticClass::$db;
StaticClass::$title = $this->db->DoSomething($varData = 'ProgData'); // I am expecting to get intellisense here.
echo(StaticClass::$title."\n");
}
}
$myp = new MyProgram();
?>
Thank you
- virgil66ro
- Posts: 10
- Joined: August 19th, 2012, 9:32 am
Re: Intelisense Tweak - Static Methods
virgil66ro wrote:If I can do something to get the intelisense as I expect, please tell me what should I do.
Thank You for the sample code. We will update IntelliSense to work nice with your sample case in upcoming update or the next one after.
If you have any other test case, please feel free to attach onto our forum.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Intelisense Tweak - Static Methods
We have allowed static functions after object operator (->) in the latest update (1.1.3385).AndyM84 wrote:If I call a static method from an instantiated object, Intellisense doesn't work.
Latest update supports that constructs. You can try and give us a note how it works for you.virgil66ro wrote:self::$db->DoSomething();// here intelisense isn't working
$this->db->DoSomething($varData = 'ProgData'); // I am expecting to get intellisense here.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Intelisense Tweak - Static Methods
Thank you Jakub,
It's seems to work fine.
I am planning to test this tool for the next 2 weeks so if you don't mind, I will come back with remarks or suggestions.
Thank you again.
It's seems to work fine.
I am planning to test this tool for the next 2 weeks so if you don't mind, I will come back with remarks or suggestions.
Thank you again.
- virgil66ro
- Posts: 10
- Joined: August 19th, 2012, 9:32 am
Re: Intelisense Tweak - Static Methods
Great! Thanks for checking the feature again. Please give us any feedback You find useful, we are continuously improving the tool based on user's comments.virgil66ro wrote:It's seems to work fine.
I am planning to test this tool for the next 2 weeks so if you don't mind, I will come back with remarks or suggestions.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Intelisense Tweak - Static Methods
Hi again,
Maybe I am not the only one who need this feature, but I would like to have intelisense on a mysql result.
I mean all results are stored on arrays, from where we can extract data based on the column names of the mysql table witch is queried.
ex:
Also there will be useful to have intelisense any time we have an array.
Please note that on php we have arrays like $_SERVER witch have many definitions.
http://www.php.net/manual/en/reserved.v ... server.php
Thank you,
Virgil
Maybe I am not the only one who need this feature, but I would like to have intelisense on a mysql result.
I mean all results are stored on arrays, from where we can extract data based on the column names of the mysql table witch is queried.
ex:
- Code: Select all
$sql = "select idUser, firstName, lastName, edge from TableUser order by idUser asc limit 1 ";
$res = mysql_query($sql);
$userName = $res['firstName'].' '.$res['lastName']; // it will be nice to have listed all the column names when after the $res[
Also there will be useful to have intelisense any time we have an array.
Please note that on php we have arrays like $_SERVER witch have many definitions.
http://www.php.net/manual/en/reserved.v ... server.php
Thank you,
Virgil
- virgil66ro
- Posts: 10
- Joined: August 19th, 2012, 9:32 am
11 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 42 guests