I faced an issue when I need to use the FQCN of my classes as a key for argumentsSet. When it is defined with FQCN in the way \Worker\Fixtures\UserFixture::class it does not work as expected, as in this case it takes all possible arguments, regardless of the key. Once it's set up as a string '\Worker\Fixtures\UserFixture' it works ex expected. It would be great if it's possible to use class constant instead fo the string. Here are examples of the source code
<?php
namespace Worker\Fixtures {
class UserFixture {
// accept some data
}
class DeviceFixture {
// accept some data
}
}
namespace Worker {
class Provider
{
public function add(array $data) {
return $this;
}
}
}
namespace {
use Worker\Fixtures;
$provider = new \Worker\Provider();
$provider
->add([
Fixtures\UserFixture::class => [
'attributes' => [
'', // get 4 unexpected fields (`firstName`, `lastName`, `deviceStatusId`, `externalId`)
]
]
])
;
}
In my example, if you try to add a new attribute, you will get the list of all 4 available attributes in the suggestion list (firstName, lastName, deviceStatusId, externalId) and it's not expected, as I need to see only 2 (firstName, lastName) by the key, which is Worker\Fixtures\UserFixture::class. If I change it to be simple string, it works as expected and I get the list of 2 expected elements (firstName, lastName). See the shortened samples of code with the string keys below:
<?php
namespace PHPSTORM_META {
// same as above
function fixture_set() {
return [
'Fixtures\UserFixture' => \PHPSTORM_META\fixture_data_set([
'firstName' => '',
'lastName' => '',
]),
'Fixtures\DeviceFixture' => \PHPSTORM_META\fixture_data_set([
'deviceStatusId' => '',
'externalId' => '',
]),
];
}
// same as above
}
worker.php
// same as above
namespace {
$provider = new \Worker\Provider();
$provider
->add([
'Fixtures\UserFixture'' => [
'attributes' => [
'', // get 2 expected fields (`firstName`, `lastName`)
]
]
])
;
}
Hi.
I faced an issue when I need to use the FQCN of my classes as a key for
argumentsSet
. When it is defined with FQCN in the way\Worker\Fixtures\UserFixture::class
it does not work as expected, as in this case it takes all possible arguments, regardless of the key. Once it's set up as a string'\Worker\Fixtures\UserFixture'
it works ex expected. It would be great if it's possible to use class constant instead fo the string. Here are examples of the source code.phpstorm.meta.php
worker.php
In my example, if you try to add a new attribute, you will get the list of all 4 available attributes in the suggestion list (
firstName
,lastName
,deviceStatusId
,externalId
) and it's not expected, as I need to see only 2 (firstName
,lastName
) by the key, which isWorker\Fixtures\UserFixture::class
. If I change it to be simple string, it works as expected and I get the list of 2 expected elements (firstName
,lastName
). See the shortened samples of code with thestring
keys below:worker.php