-
-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
Description
Sometimes you need to add those annotations manually:
/** @var \Queue\Model\Table\QueuedJobsTable $queuedJobsTable */
$queuedJobsTable = TableRegistry::getTableLocator()->get('Queue.QueuedJobs');( in case you cannot or don't want to use ModelAwareTrait and loadModel() call )
And usually also the query results for all():
/** @var \App\Model\Entity\Module[] $modules */
$modules = $query->all()->toArray();In order for the IDE/PHPStan/Psalm to know the collection item and autocomplete entity properties etc.
As well as first() calls:
/** @var \App\Model\Entity\AttributeValue $attributeValueToMove */
$attributeValueToMove = $this->AttributeValues->find()
->where(['attribute_id' => $attribute, 'position' => $oldPos])
->firstOrFail();
$attributeValueToMove->position = $newPos;I am sure there are other use cases for inline annotations that are occurring over and over again.
We should try to find a way to auto fix that for us if we encounter such cases.
Since this is too complex for tokenizing, we will need a AST based tool here that also is able to modify code (similar to rector) etc.