Skip to content

Commit 68ea1b0

Browse files
author
Vitaliy Boyko
committed
Merge remote-tracking branch 'origin/3.1.1-develop' into 3.1.1-develop
2 parents 5bc86d5 + 39381dc commit 68ea1b0

File tree

42 files changed

+1426
-183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1426
-183
lines changed

CHANGELOG.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,24 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
66

77
## 3.1.1
88

99
## 3.1.0
1010

11+
### Added
12+
13+
- Extended `.phpstorm.meta.php` for more convenient autocomplete [#467](https://github.com/magento/magento2-phpstorm-plugin/pull/467)
14+
- Code generation for message queue in [#411](https://github.com/magento/magento2-phpstorm-plugin/pull/411)
15+
- Code generation for declarative schema [#453](https://github.com/magento/magento2-phpstorm-plugin/pull/453)
16+
- Inspection warning for disabled observer [#432](https://github.com/magento/magento2-phpstorm-plugin/pull/432)
17+
- The action item to the context menu to copy file path in the Magento format [#451](https://github.com/magento/magento2-phpstorm-plugin/pull/451)
18+
19+
### Fixed
20+
21+
- The null pointer exception on the Create Module Dialog
22+
1123
## 3.0.4
1224

1325
### Fixed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![Version](http://phpstorm.espend.de/badge/8024/version)](https://plugins.jetbrains.com/plugin/8024)
1010
[![Downloads](http://phpstorm.espend.de/badge/8024/downloads)](https://plugins.jetbrains.com/plugin/8024)
1111
![merge-chance-badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fmerge-chance.info%2Fbadge%3Frepo%3Dmagento/magento2-phpstorm-plugin)
12+
[![Made With Love](https://img.shields.io/badge/Made%20With-Love-orange.svg)](https://magento.com)
1213

1314
## Installation
1415

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PHPSTORM_META {
6+
7+
override(\Magento\Framework\ObjectManagerInterface::get(0), map(['' => '@']));
8+
override(\Magento\Framework\ObjectManagerInterface::create(0), map(['' => '@']));
9+
10+
override(\Magento\Framework\View\LayoutInterface::createBlock(0), map(['' => '@']));
11+
override(\Magento\Framework\View\TemplateEngine\Php::helper(0), map(['' => '@']));
12+
13+
override(
14+
\Magento\Framework\Controller\ResultFactory::create(0),
15+
map(
16+
[
17+
\Magento\Framework\Controller\ResultFactory::TYPE_FORWARD => \Magento\Framework\Controller\Result\Forward::class,
18+
\Magento\Framework\Controller\ResultFactory::TYPE_JSON => \Magento\Framework\Controller\Result\Json::class,
19+
\Magento\Framework\Controller\ResultFactory::TYPE_LAYOUT => \Magento\Framework\View\Result\Layout::class,
20+
\Magento\Framework\Controller\ResultFactory::TYPE_PAGE => \Magento\Framework\View\Result\Page::class,
21+
\Magento\Framework\Controller\ResultFactory::TYPE_RAW => \Magento\Framework\Controller\Result\Raw::class,
22+
\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT => \Magento\Framework\Controller\Result\Redirect::class,
23+
]
24+
)
25+
);
26+
27+
expectedArguments(
28+
\Magento\Framework\Controller\ResultFactory::create(),
29+
0,
30+
\Magento\Framework\Controller\ResultFactory::TYPE_FORWARD,
31+
\Magento\Framework\Controller\ResultFactory::TYPE_JSON,
32+
\Magento\Framework\Controller\ResultFactory::TYPE_LAYOUT,
33+
\Magento\Framework\Controller\ResultFactory::TYPE_PAGE,
34+
\Magento\Framework\Controller\ResultFactory::TYPE_RAW,
35+
\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT
36+
);
37+
38+
registerArgumentsSet(
39+
'scope_types',
40+
\Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
41+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
42+
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE
43+
);
44+
expectedArguments(
45+
\Magento\Framework\App\Config\ScopeConfigInterface::getValue(),
46+
1,
47+
argumentsSet('scope_types')
48+
);
49+
expectedArguments(
50+
\Magento\Framework\App\Config\ScopeConfigInterface::isSetFlag(),
51+
1,
52+
argumentsSet('scope_types')
53+
);
54+
expectedArguments(
55+
\Magento\Framework\App\Config\MutableScopeConfigInterface::setValue(),
56+
2,
57+
argumentsSet('scope_types')
58+
);
59+
60+
registerArgumentsSet(
61+
'condition_types',
62+
'eq',
63+
'in',
64+
'is',
65+
'to',
66+
'finset',
67+
'from',
68+
'gt',
69+
'gteq',
70+
'like',
71+
'lt',
72+
'lteq',
73+
'moreq',
74+
'neq',
75+
'nin',
76+
'notnull',
77+
'null'
78+
);
79+
expectedArguments(\Magento\Framework\Api\SearchCriteriaBuilder::addFilter(), 2, argumentsSet('condition_types'));
80+
expectedArguments(\Magento\Framework\Api\FilterBuilder::setConditionType(), 0, argumentsSet('condition_types'));
81+
82+
expectedArguments(
83+
\Magento\Framework\Api\SearchCriteriaBuilder::addSortOrder(),
84+
0,
85+
\Magento\Framework\Api\SortOrder::SORT_ASC,
86+
\Magento\Framework\Api\SortOrder::SORT_DESC
87+
);
88+
89+
registerArgumentsSet(
90+
'field_types',
91+
'button',
92+
'checkbox',
93+
'checkboxes',
94+
'column',
95+
'date',
96+
'editablemultiselect',
97+
'editor',
98+
'fieldset',
99+
'file',
100+
'gallery',
101+
'hidden',
102+
'image',
103+
'imagefile',
104+
'label',
105+
'link',
106+
'multiline',
107+
'multiselect',
108+
'note',
109+
'obscure',
110+
'password',
111+
'radio',
112+
'radios',
113+
'reset',
114+
'select',
115+
'submit',
116+
'text',
117+
'textarea',
118+
'time'
119+
);
120+
expectedArguments(\Magento\Framework\Data\Form\AbstractForm::addField(), 1, argumentsSet('field_types'));
121+
expectedArguments(\Magento\Framework\Data\Form\Element\Fieldset::addField(), 1, argumentsSet('field_types'));
122+
123+
}

resources/META-INF/plugin.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@
236236
<extensions defaultExtensionNs="com.jetbrains.php">
237237
<frameworkProjectConfigurableProvider implementation="com.magento.idea.magento2plugin.project.ConfigurableProvider"/>
238238
<frameworkUsageProvider implementation="com.magento.idea.magento2plugin.project.UsagesProvider"/>
239-
<libraryRoot id="phpstorm.meta.php" path="/phpstorm.meta.php/" runtime="false"/>
239+
<libraryRoot id="phpstorm.meta.php" path="/.phpstorm.meta.php/" runtime="false"/>
240240
</extensions>
241-
242241
</idea-plugin>

resources/fileTemplates/internal/Magento Data Model Interface.php.ft

+10-5
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,20 @@ interface ${NAME}
2828
#set ($propertyLowerCamel = $propertyData.get(4))
2929

3030
/**
31-
* @return $propertyType
31+
* Getter for $propertyUpperCamel.
32+
*
33+
* @return $propertyType|null
3234
*/
33-
public function get$propertyUpperCamel();
35+
public function get$propertyUpperCamel(): ?$propertyType;
3436

3537
/**
36-
* @param $propertyType $$propertyLowerCamel
37-
* @return $this
38+
* Setter for $propertyUpperCamel.
39+
*
40+
* @param $propertyType|null $$propertyLowerCamel
41+
*
42+
* @return void
3843
*/
39-
public function set$propertyUpperCamel($$propertyLowerCamel);
44+
public function set$propertyUpperCamel(?$propertyType $$propertyLowerCamel): void;
4045
#end
4146
#end
4247
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!--
2+
/*
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<html lang="en">
8+
<body>
9+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
10+
<tr>
11+
<td><font face="verdana" size="-1">
12+
The data model interface indicates all the setters and getters for the related data model.
13+
This used to maintain the integrity of the data, even if there is any changes in the model you will always get consistent data.
14+
</font><br>
15+
</td>
16+
</tr>
17+
</table>
18+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
19+
<tr>
20+
<td colspan="3"><font face="verdana" size="-1">Predefined variables explanation:</font></td>
21+
</tr>
22+
<tr>
23+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${NAMESPACE}</b></font></nobr></td>
24+
<td width="10">&nbsp;</td>
25+
<td width="100%" valign="top"><font face="verdana" size="-1">A fully qualified name of the field namespace without a leading slash.
26+
</font>
27+
</td>
28+
</tr>
29+
<tr>
30+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${USE}</b></font></nobr></td>
31+
<td width="10">&nbsp;</td>
32+
<td width="100%" valign="top"><font face="verdana" size="-1">List of imports separated by comma.
33+
</font>
34+
</td>
35+
</tr>
36+
<tr>
37+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${NAME}</b></font></nobr></td>
38+
<td width="10">&nbsp;</td>
39+
<td width="100%" valign="top"><font face="verdana" size="-1">PHP Class name.
40+
</font>
41+
</td>
42+
</tr>
43+
<tr>
44+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${EXTENDS}</b></font></nobr></td>
45+
<td width="10">&nbsp;</td>
46+
<td width="100%" valign="top"><font face="verdana" size="-1">Name of PHP class that the Class extends.
47+
</font>
48+
</td>
49+
</tr>
50+
<tr>
51+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${IMPLEMENTS}</b></font></nobr></td>
52+
<td width="10">&nbsp;</td>
53+
<td width="100%" valign="top"><font face="verdana" size="-1">Name of PHP class that the Class implements.
54+
</font>
55+
</td>
56+
</tr>
57+
<tr>
58+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${PROPERTIES}</b></font></nobr></td>
59+
<td width="10">&nbsp;</td>
60+
<td width="100%" valign="top"><font face="verdana" size="-1">Class member variables.
61+
</font>
62+
</td>
63+
</tr>
64+
</table>
65+
</body>
66+
</html>

resources/fileTemplates/internal/Magento Data Model.php.ft

+46-4
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,75 @@
99
#foreach ($use in $uses.split(","))
1010
use $use;
1111
#end
12+
#if (${HASINTERFACE} == "true")
13+
#set ($hasInterface = true)
14+
#else
15+
#set ($hasInterface = false)
16+
#end
1217

13-
class ${NAME} #if (${EXTENDS})extends ${EXTENDS} #end #if (${IMPLEMENTS})implements ${IMPLEMENTS}#end
18+
class ${NAME} #if (${EXTENDS})extends ${EXTENDS} #end #if (${IMPLEMENTS} && $hasInterface)implements ${IMPLEMENTS}#end
1419
{
20+
#if (${PROPERTIES} && !$hasInterface)
21+
/**
22+
* String constants for property names
23+
*/
24+
#set ($properties = ${PROPERTIES})
25+
#foreach ($property in $properties.split(","))
26+
#set ($propertyData = $property.split(";"))
27+
#set ($propertyUpperSnake = $propertyData.get(0))
28+
#set ($propertyLowerSnake = $propertyData.get(1))
29+
const $propertyUpperSnake = "$propertyLowerSnake";
30+
#end
31+
32+
#end
1533
#if (${PROPERTIES})
1634
#set ($properties = ${PROPERTIES})
1735
#foreach ($property in $properties.split(","))
1836
#set ($propertyData = $property.split(";"))
1937
#set ($propertyUpperSnake = $propertyData.get(0))
38+
#set ($propertyType = $propertyData.get(2))
2039
#set ($propertyUpperCamel = $propertyData.get(3))
2140
#set ($propertyLowerCamel = $propertyData.get(4))
2241
#if(!($foreach.first))
2342

2443
#end
44+
#if ($hasInterface)
2545
/**
2646
* @inheritDoc
2747
*/
28-
public function get$propertyUpperCamel()
48+
#else
49+
/**
50+
* Getter for $propertyUpperCamel.
51+
*
52+
* @return $propertyType|null
53+
*/
54+
#end
55+
public function get$propertyUpperCamel(): ?$propertyType
2956
{
57+
#if($propertyType == 'string')
3058
return $this->getData(self::$propertyUpperSnake);
59+
#{else}
60+
return $this->getData(self::$propertyUpperSnake) === null ? null
61+
: ($propertyType) $this->getData(self::$propertyUpperSnake);
62+
#end
3163
}
3264

65+
#if ($hasInterface)
3366
/**
3467
* @inheritDoc
3568
*/
36-
public function set$propertyUpperCamel($$propertyLowerCamel)
69+
#else
70+
/**
71+
* Setter for $propertyUpperCamel.
72+
*
73+
* @param $propertyType|null $$propertyLowerCamel
74+
*
75+
* @return void
76+
*/
77+
#end
78+
public function set$propertyUpperCamel(?$propertyType $$propertyLowerCamel): void
3779
{
38-
return $this->setData(self::$propertyUpperSnake, $$propertyLowerCamel);
80+
$this->setData(self::$propertyUpperSnake, $$propertyLowerCamel);
3981
}
4082
#end
4183
#end

0 commit comments

Comments
 (0)