Skip to content

Commit

Permalink
Merge pull request #468 from DmitryFurs/403-backport-3.1.0
Browse files Browse the repository at this point in the history
[Backport 3.1.0] Extend .phpstorm.meta.php for more convenient autocomplete
  • Loading branch information
Vitaliy authored Feb 2, 2021
2 parents 41a28d4 + d0ef6e6 commit 081fc74
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).

## 3.1.0

### Added

- Extended `.phpstorm.meta.php` for more convenient autocomplete

## 3.0.4

### Fixed
Expand Down
117 changes: 117 additions & 0 deletions resources/phpstorm.meta.php/di-autocomplete.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,123 @@
<?php

declare(strict_types=1);

namespace PHPSTORM_META {

override(\Magento\Framework\ObjectManagerInterface::get(0), map(['' => '@']));
override(\Magento\Framework\ObjectManagerInterface::create(0), map(['' => '@']));

override(\Magento\Framework\View\LayoutInterface::createBlock(0), map(['' => '@']));
override(\Magento\Framework\View\TemplateEngine\Php::helper(0), map(['' => '@']));

override(
\Magento\Framework\Controller\ResultFactory::create(0),
map(
[
\Magento\Framework\Controller\ResultFactory::TYPE_FORWARD => \Magento\Framework\Controller\Result\Forward::class,
\Magento\Framework\Controller\ResultFactory::TYPE_JSON => \Magento\Framework\Controller\Result\Json::class,
\Magento\Framework\Controller\ResultFactory::TYPE_LAYOUT => \Magento\Framework\View\Result\Layout::class,
\Magento\Framework\Controller\ResultFactory::TYPE_PAGE => \Magento\Framework\View\Result\Page::class,
\Magento\Framework\Controller\ResultFactory::TYPE_RAW => \Magento\Framework\Controller\Result\Raw::class,
\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT => \Magento\Framework\Controller\Result\Redirect::class,
]
)
);

expectedArguments(
\Magento\Framework\Controller\ResultFactory::create(),
0,
\Magento\Framework\Controller\ResultFactory::TYPE_FORWARD,
\Magento\Framework\Controller\ResultFactory::TYPE_JSON,
\Magento\Framework\Controller\ResultFactory::TYPE_LAYOUT,
\Magento\Framework\Controller\ResultFactory::TYPE_PAGE,
\Magento\Framework\Controller\ResultFactory::TYPE_RAW,
\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT
);

registerArgumentsSet(
'scope_types',
\Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE
);
expectedArguments(
\Magento\Framework\App\Config\ScopeConfigInterface::getValue(),
1,
argumentsSet('scope_types')
);
expectedArguments(
\Magento\Framework\App\Config\ScopeConfigInterface::isSetFlag(),
1,
argumentsSet('scope_types')
);
expectedArguments(
\Magento\Framework\App\Config\MutableScopeConfigInterface::setValue(),
2,
argumentsSet('scope_types')
);

registerArgumentsSet(
'condition_types',
'eq',
'in',
'is',
'to',
'finset',
'from',
'gt',
'gteq',
'like',
'lt',
'lteq',
'moreq',
'neq',
'nin',
'notnull',
'null'
);
expectedArguments(\Magento\Framework\Api\SearchCriteriaBuilder::addFilter(), 2, argumentsSet('condition_types'));
expectedArguments(\Magento\Framework\Api\FilterBuilder::setConditionType(), 0, argumentsSet('condition_types'));

expectedArguments(
\Magento\Framework\Api\SearchCriteriaBuilder::addSortOrder(),
0,
\Magento\Framework\Api\SortOrder::SORT_ASC,
\Magento\Framework\Api\SortOrder::SORT_DESC
);

registerArgumentsSet(
'field_types',
'button',
'checkbox',
'checkboxes',
'column',
'date',
'editablemultiselect',
'editor',
'fieldset',
'file',
'gallery',
'hidden',
'image',
'imagefile',
'label',
'link',
'multiline',
'multiselect',
'note',
'obscure',
'password',
'radio',
'radios',
'reset',
'select',
'submit',
'text',
'textarea',
'time'
);
expectedArguments(\Magento\Framework\Data\Form\AbstractForm::addField(), 1, argumentsSet('field_types'));
expectedArguments(\Magento\Framework\Data\Form\Element\Fieldset::addField(), 1, argumentsSet('field_types'));

}

0 comments on commit 081fc74

Please sign in to comment.