This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Extend autocompletion in PHP editor for custom frameworks, which do not use new... for class instanciation | ||
---|---|---|---|
Product: | php | Reporter: | skurfuerst |
Component: | Editor | Assignee: | Ondrej Brejla <obrejla> |
Status: | NEW --- | ||
Severity: | normal | CC: | junichi11, skurfuerst, soko, tmysik |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | PC | ||
OS: | Mac OS X | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
skurfuerst
2010-03-24 10:59:40 UTC
Why not use an interface to represent the return type? Your requirement is too Typo3 design specific so I don't think it is doable without making things complicated. However I am not a NB developer. So I think we need to wait for the feedback from the core team (In reply to comment #1) > Why not use an interface to represent the return type? Because those methods return whatever you ask them for. There is an interface for the FLOW3 object manager, but the create method has "@return object" for that reason. > Your requirement is too Typo3 design specific so I don't think it is doable > without making things complicated. It is perfectly possible with PDT now (see http://www.twitvid.com/RIU0N and http://github.com/skurfuerst/org.typo3.eclipse.extender), and I dare to say they don't give a damn about TYPO3. This would be useful for any factory code that is capable of creating more than one type. FLOW3 and TYPO3 are certainly not the only one's doing that. batch reassigning Magento (the shop system) has a Mage::getModel('module/class') method. So TYPO3 isn't the only system the uses a "magic factory". I confirm this is widely used. A very common example is DI containers. I would like to run code completion like this issue with plugin. e.g. In the following case of CakePHP Framework, $post is Post class: class SomeController extends AppController { public function index(){ $post = ClassRegistry::init('Post'); } } But NetBeans will not be able to recognize it as a post class within class methods.I don't know how to implement it with plugin. If this feature is implemented, many NetBeans users will be more happy! I strongly hope it. Thanks! And what about using a PHPDoc comment like /* @var $post \Post */ $post = ClassRegistry::init('Post'); ? This would avoid you the pain on writing *and maintaining* a plugin. Setup a code template (Tools/Options/Editor/Code Templates in NB8.2) if you want to avoid the "pain" of writing these two lines every time. Such code template will be WAY easier to do than a plugin and core changes. |