Create method of class from call
Hi!
I just start use PHPStorm as main IDE for develop, and i can't find any information about one usefull feature. For example i declare some class. After that i go to other class and call method of first class, that not exist yet. Here i think must be a feature that declare method of first class and drop my cursor inside this method. Here is example:
<?php
class User {}
?>
<?
class Order {
public function __construct(User $user) {
if (!$user->getName()) { // here i want do some magic and method getName declare in class User
throw new Exception('No order without user name');
}
}
}
?> How i may do it?
请先登录再写评论。
Hi Igor,
Place cursor on such undefined method call (
!$user->getName()) and press Alt+Enter (or click on light bulb that will appear after small delay) -- then choose "Add method" option.Andriy, thank you!