PHP StringField is a PhpStorm plugin that adds navigation and references support for string parameters of property names.
Including nested fields accessed via dot notation ('profile.avatar.url').
- Navigation, reference, and find usages support.
- Add the
@string-fieldto a@paramphpdoc tag, to enable navigation through string path. - Use the
@string-field:callto interpret the last field to be treated as a callable method.
class User {
public Profile $profile;
/**
* @param string $path @string-field
*/
public function field(string $path) {
// ...
}
}
$user = new User();
$user->field('profile.avatar.url');Now you can navigate from 'profile.avatar.url' directly to the corresponding property or method in the class.