I'm trying to use the .phpstorm.meta.php file to manually define intellisense to a function I use to get and set dynamic settings in the database.
So imagine a class that looks like this:
class Setting
{
public function get(string $key) {
// ...
}
public function set(string $key, $value) {
// ...
}
}
Then, to define the possible values that can go in the $key argument, I can do this in the meta file:
namespace PHPSTORM_META {
expectedArguments(
\App\Models\Setting::get(),
0,
'foo',
'bar',
'baz'
);
expectedArguments(
\App\Models\Setting::set(),
0,
'foo',
'bar',
'baz'
);
}
The thing is, the list of possible values is quite extensive, and duplicating them is a pain. Is there a way to define these values on multiple functions using the same statement? Or maybe put them in an array and use it somehow? I couldn't get it to work.
Thanks!
PhpStorm version: 2021.3.3.