I seem to have difficulties to use the array type to auto-complete function invocations. I've not found a way to get it work.
Additionally, the return type seems not to be able to be specified in WordPress notation (example 2).
The following code has been used in a new empty project, with all plugins disabled, except for this one. I'm not sure this is a bug, a missing feature, or I myself am missing something. Any help much appreciated!
I'm using PhpStorm 2023.1 (Build #PS-231.8109.199, built on March 29, 2023) on linux. Let me know if you need any additional information/log.
Thank you!
<?php
/**
* EXAMPLE 1: All good
*
* @var array $test {
* Configuration
*
* @type int $state Some more test
* }
*/
// works
$test['state'] = 6;
/**
* EXAMPLE 2:
* - parameter inside the body: OK
* - parameter on invocation: doesn't work
* - return value: doesn't work
*
* @param array $test {
* Configuration
*
* @type int $state Some more test
* }
* @return array {
* @type int $state Some more test
* }
*/
function x(
array $test
) {
// parameter works inside function body
echo $test['state'];
}
// parameter doesn't work
// return doesn't work
x('')[''];
/**
* EXAMPLE 3:
* - parameter inside the body: OK
* - parameter on invocation: doesn't work
* - return value: OK
*
* @param array $test = [
* 'state' => int // some state
* ]
*
* @return array = [
* 'state' => int // some state
* ]
*/
function y(
array $test
) {
// parameter works inside function body
echo $test['state'];
}
// parameter doesn't work
// return does work
y('')['state'];
/**
* EXAMPLE 4:
* - parameter inside the body: OK
* - parameter on invocation: doesn't work
* - return value: OK
*
* @param $test = ['state' => 7]
*
* @return array = ['state' => 7]
*/
function z(
array $test
) {
// parameter works inside function body
echo $test['state'];
}
// parameter doesn't work
// return does work
z('')['state'];
Hi there
Thank you for this amazing plugin!!!
I seem to have difficulties to use the array type to auto-complete function invocations. I've not found a way to get it work. Additionally, the return type seems not to be able to be specified in WordPress notation (example 2).
The following code has been used in a new empty project, with all plugins disabled, except for this one. I'm not sure this is a bug, a missing feature, or I myself am missing something. Any help much appreciated!
I'm using PhpStorm 2023.1 (Build #PS-231.8109.199, built on March 29, 2023) on linux. Let me know if you need any additional information/log.
Thank you!