Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan documented properties like "Products[]" #2

Open
xskif opened this issue Jan 27, 2015 · 4 comments
Open

Scan documented properties like "Products[]" #2

xskif opened this issue Jan 27, 2015 · 4 comments

Comments

@xskif
Copy link

xskif commented Jan 27, 2015

/**
 * @property Order[] $orders
 */
class User extends ActiveRecord {
    public function getOrders() {
        return $this->hasMany(Order::className(), ['user_id'=>'id']);
    }
}

The code above works in client code like:

$user = User::findOne($id);
$user->order[0]->(some Order methods or properties)

because of magic getter method.

SublimeCodeIntel and SublimeCodeIntel3 scaned all doc blocks properties and give me tooltip like property name, but now, after i install today CodeComplice and clean up index, it's broke!

Also i don't see anymore some tooltips if i type something like this:

$user->orders[0]->prod

it's must to complite like products because Account class have @property Product[] $products in doc block

@xskif xskif changed the title No more scan documented properties No more scan documented properties like "Products[]" Jan 27, 2015
@xskif
Copy link
Author

xskif commented Jan 27, 2015

Update issue

@wizza-smile
Copy link
Contributor

hey @xskif,

sorry but your mind is playing tricks on you. The following code is the regular expression that is matched against @Property. It hasn't changed from Komodos code:

 _re_magic_property = re.compile(
        r'^\s*@property(-(?P<type>read|write))?\s+((?P<citdl>[\w\\]+)\s+)?(?P<name>\$\w+)(?:\s+(?P<doc>.*?))?', re.M | re.U)

As you can see, the array syntax is not supported, only word-characters and backslash (namespaces) are considered!

So the following is working:

class Order {
    public function orderMethod($value='')
    {
        return true;
    }
}

/**
 * @property Order $order
 */
class User {
    public function getOrder() {
        return $this->hasOne(Order::className(), ['id'=>'id']);
    }
}

$user = new User();
$user->order->(shows "orderMethod")

This is actually a feature request!

@xskif
Copy link
Author

xskif commented Jan 28, 2015

Really? I was pretty sure that this feature already working on. Strange.
Ok, let it be a feature request.

@xskif xskif changed the title No more scan documented properties like "Products[]" Scan documented properties like "Products[]" Jan 28, 2015
@xskif
Copy link
Author

xskif commented Feb 13, 2015

Because of this "feature" didn't work, i have a bug with autocompletion.

$user->orders[0]->(there is some User class methods, instead of empty completion or Order class methods)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants