| Summary: | support for oop method overloading (__call) for php5 | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Sang Uk Seong <sang> | ||||||
| Component: | PDT | Assignee: | PHP UI <php.ui-inbox> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | exceptione, info, spektom, vadim.p | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Sang Uk Seong
based on http://us2.php.net/manual/en/language.oop5.overloading.php and http://us2.php.net/manual/en/language.oop5.overloading.php, I set up in AbstractClass to handle all setter calls and getter calls from __call() method. code assist of course cannnot see our dynamic getters and setters at the point. I know it won't be easy to implement this feature but this should be something PHP IDE needs to detect somehow -- since php offers this feature :) It would be nice that PHP IDE recognize this handler and offer code assist if a class extending this AbstractDefaultClass... some reason it doesn't save my bug content... or I don't see it? some reason, content of my bug is not submitted. based on http://us2.php.net/manual/en/language.oop5.overloading.php and http://us2.php.net/manual/en/language.oop5.overloading.php, I set up in AbstractClass to handle all setter calls and getter calls from __call() method. code assist of course cannnot see our dynamic getters and setters at the point. I know it won't be easy to implement this feature but this should be something PHP IDE needs to detect somehow -- since php offers this feature :) I have AbstractDefaultClass that contains following methods: /** * Dynmaic function call to set getter/setter * all variable must start lower case and mixed mode * e.g. property testPropertyName->getTestPropertyName() * @param string $method method of function call * @param Array $arguments String array arguments * @return Mixed */ public function __call($method, $arguments) { // allow isXXX for boolean if ($method[0] == "i" && $method[1] == "s") { $prefix = "is"; $property = strtolower(substr($method, 2, 1)) . substr($method, 3); } else { $prefix = strtolower(substr($method, 0, 3)); $property = strtolower(substr($method, 3, 1)) . substr($method, 4); } if (empty($prefix) || empty($property)) { return; } if (($prefix == "is" && is_bool($this->$property)) || ($prefix == "get" && isset($this->$property))) { return $this->$property; } if ($prefix == "set") { $this->$property = $arguments[0]; } } It would be nice that PHP IDE recognize this handler and offer code assist if a class extending this AbstractDefaultClass... Created attachment 52126 [details] sample code some reason, content of my bug is not submitted. based on http://us2.php.net/manual/en/language.oop5.overloading.php and http://us2.php.net/manual/en/language.oop5.overloading.php, I set up in AbstractClass to handle all setter calls and getter calls from __call() method. code assist of course cannnot see our dynamic getters and setters at the point. I know it won't be easy to implement this feature but this should be something PHP IDE needs to detect somehow -- since php offers this feature :) I have AbstractDefaultClass that contains following methods: It would be nice that PHP IDE recognize this handler and offer code assist if a class extending this AbstractDefaultClass... Created attachment 52127 [details]
BugContent... bugzilla doesn't save anything in content...
(In reply to comment #0) skipped... > > It would be nice that PHP IDE recognize this handler and offer code assist if a > class extending this AbstractDefaultClass... > I'm not sure I understand what should be suggested in code completion? Do you mean PDT should detect method names from your __call() by parsing it? (In reply to comment #6) I think he meant someting like @method? [http://manual.phpdoc.org/HTMLSmartyConverter/PHP/phpDocumentor/tutorial_tags.method.pkg.html] If that is the case, this bug can be closed since pdt 2.0.0 supports this. Yes, PDT 2.x supports @method tags. closing. |