A copmile like feature. (Run instant error analysis) |
|
I've not spotted such a feature of phpEd until hgr mentioned here. Tested this, but, unfortunatelly, nothing happened.
Is this a bug, such feature should be implemented, I think this should be almost the same as in Zend Studio "Analyze code" feature. Cheers. |
||||||||||||
|
Site Admin
|
PhpED runs this analysis by default. For example if you enter code below: <? $a = 5 $b = c ?> it will underline $b because there is no semicolon after 5 If for any reason you turn this feature off in tools->settings->code insight, you may still run such checks manually. That's what the menu option is for. |
||||||||||||||
_________________ The PHP IDE team |
Veteran
|
Ok..
So a compile like feature, that will check the code more deeply (missing function overloads etc), would be a feature request right? |
||||||||||||
|
Site Admin
|
What I referred to is compiler. It compiles script and checks for its correctness. Other things that you asked about can't be verified in compile-time. They are pure run-time errors.
|
||||||||||||
_________________ The PHP IDE team |
Veteran
|
Well not true.
You can see if a interface is implemented, if an abstract method on the base class is indeed implemented in the child class or not. If you use a type in the function parameter that is not defined i.e public function (mytype $variable) and stuff like that, would be great if you could catch before runtime. |
||||||||||||
|
Site Admin
|
okay,
even if a class does not implement an interface it's not a problem at all. The problem may happen only if you use its instance as this interface. But instance is a run-time thing, isn't it? |
||||||||||||
_________________ The PHP IDE team |
Veteran
|
Well yes.
But imagine if you had such a tool to eliminate dummy errors in OOP. If you do not implement an interface you should get a runtime error, because you MUST implement the methods in an interface in OOP. If PHP5 does not complain about this runtime then the OOP part of php is not complete. The same goes for Abstract functions, they are declared in the abstract class, but any child classes that extends the abstract class MUST implement the abstract functions. All these errors could be caught by analyzing the source code, it does not have to be runtime. |
||||||||||||
|
Site Admin
|
I can only repeat, if a class does not implement an abstract method defined in its parent, it is not a problem at all. For example you may define them in a class derived from this. Why not? |
||||||||||||||
_________________ The PHP IDE team |
Veteran
|
Well it should be a problem. It is bad OOP design if child classes does not implement abstract methods. A warning by a compile feature would be nice. Better code, fewer errors. PHP is lacking strict type checking, compared to C# and Java. It would be nice to have a feature that will catch the most common mistakes, that are a little more complicated than forgetting a ; |
||||||||||||||||
|
Site Admin
|
why? Say I have a class named OBJECT which has two abstracts MOVE and DRAW defined. I can derive FLYINGOBJECT and define MOVE then I will derive FLY and define DRAW. I'm not going to create any instances of FLYINGOBJECT. What's wrong with this? Why would IDE blame such code and tell me that FLYINGOBJECT must have DRAW? |
||||||||||||||
_________________ The PHP IDE team |
Veteran
|
Well because if the DRAW function only makes sense for the FLY object and Move only makes sense for FLYINGOBJECT then they have nothing to do on the base OBJECT class, they belong to the CHILD class only. Base classes should only have functions that are general for all child classes. If a function is a general function but can not be implementet on the Base class because the individual implementation should basicly be different for each child, it must be declared Abstract and this enforces that child classes MUST implement these functions. Have a look at this URL http://www.developer.com/lang/php/article.php/3604111 |
||||||||||||||||
|
A copmile like feature. (Run instant error analysis) |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by