Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 4.4.0 develop into 4.4.1 develop #1198

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4e81303
1144: Add checks and detailed error messages during plugin activation
Sep 12, 2022
d1837a8
Fixed new intellij version compatibility issues
bohdan-harniuk Sep 12, 2022
8ac85ad
1180: Fixed ClassCastException
bohdan-harniuk Sep 12, 2022
84ee9aa
Merge pull request #1183 from bohdan-harniuk/1180-fix-ClassCastException
VitaliyBoyko Sep 12, 2022
574b638
Merge branch '4.4.0-develop' into pre-release-4.4.0
bohdan-harniuk Sep 13, 2022
c168afc
Merge branch '4.4.0-develop' into 1179-fix-compatibility-issues
VitaliyBoyko Sep 13, 2022
72a6a6a
1143 fix NullPointerException at ObserverDeclarationInspection Class
Sep 13, 2022
43c7a5c
Merge branch '4.4.0-develop' into 1143-fix-nullPointerException-at-Ob…
Sep 13, 2022
e6a4fbb
Merge pull request #1186 from SilinMykola/1143-fix-nullPointerExcepti…
bohdan-harniuk Sep 14, 2022
e51176c
Merge branch '4.4.0-develop' of github.com:magento/magento2-phpstorm-…
bohdan-harniuk Sep 14, 2022
c747546
Updated CHANGELOG.md file
bohdan-harniuk Sep 14, 2022
b089766
Merge branch '4.4.0-develop' into 1144-error-magento-installation-path
bohdan-harniuk Sep 14, 2022
8273831
1144: Removed extra empty lines
bohdan-harniuk Sep 14, 2022
e6be25d
Merge pull request #1181 from makzef/1144-error-magento-installation-…
bohdan-harniuk Sep 14, 2022
c2cc9f1
Merge branch '4.4.0-develop' of github.com:magento/magento2-phpstorm-…
bohdan-harniuk Sep 14, 2022
f142cd0
Updated CHANGELOG.md file
bohdan-harniuk Sep 14, 2022
eba1ab6
Merge branch '4.4.0-develop' into 1179-fix-compatibility-issues
VitaliyBoyko Sep 14, 2022
877fd84
Merge pull request #1182 from bohdan-harniuk/1179-fix-compatibility-i…
VitaliyBoyko Sep 14, 2022
14fac74
Merge branch '4.4.0-develop' into pre-release-4.4.0
VitaliyBoyko Sep 14, 2022
36a8f1e
Revert "Fixed new intellij version compatibility issues"
VitaliyBoyko Sep 14, 2022
8195d9f
Merge pull request #1187 from magento/revert-1182-1179-fix-compatibil…
bohdan-harniuk Sep 14, 2022
e1afca4
Merge branch '4.4.0-develop' into pre-release-4.4.0
VitaliyBoyko Sep 14, 2022
f595d1b
Merge pull request #1147 from magento/pre-release-4.4.0
bohdan-harniuk Sep 14, 2022
893d6bf
1179: moved graphql dependent actions to the withJsGraphQl.xml config…
VitaliyBoyko Sep 16, 2022
adfae0d
Merge pull request #1193 from magento/1179-graphql-dependent-actions-…
bohdan-harniuk Sep 16, 2022
20082f2
1196: Fixed customer EAV attribute generation for Magento 2.4.4
bohdan-harniuk Sep 19, 2022
18b03d4
Merge pull request #1197 from bohdan-harniuk/1196-fix-customer-eav-at…
VitaliyBoyko Sep 19, 2022
1b9eede
Merge branch '4.4.0-develop' of github.com:magento/magento2-phpstorm-…
bohdan-harniuk Sep 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
- Code completion for `system.xml` and `config.xml` [#1077](https://github.com/magento/magento2-phpstorm-plugin/pull/1077)
- Added easier navigation through plugins [#1121](https://github.com/magento/magento2-phpstorm-plugin/pull/1121)
- Added inspection to check if type attr value in the virtual type tag attribute value exists [#1176](https://github.com/magento/magento2-phpstorm-plugin/pull/1176)
- Added checks and detailed error messages during plugin activation [#1181](https://github.com/magento/magento2-phpstorm-plugin/pull/1181)

### Fixed

- Fixed NullPointerException at ObserverDeclarationInspection.java:188 [#1143](https://github.com/magento/magento2-phpstorm-plugin/issues/1143)
- Fixed IncorrectOperationException: Rebind cannot be performed for class PolyVariantReferenceBase [#1173](https://github.com/magento/magento2-phpstorm-plugin/pull/1173)
- Fixed create an observer for an event doesn't work through the context menu [#1166](https://github.com/magento/magento2-phpstorm-plugin/pull/1166)
- Fixed IOException: Invalid file name at ReportBuilder [#1154](https://github.com/magento/magento2-phpstorm-plugin/pull/1154)
Expand Down
4 changes: 0 additions & 4 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
<separator/>
<!-- Context dependent actions -->
<action id="MagentoCreateAclFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewAclXmlAction"/>
<action id="MagentoCreateGraphQlSchemaFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewGraphQLSchemaAction"/>
<action id="MagentoCreateConfigFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewConfigXmlAction"/>
<action id="MagentoCreateCrontabFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewCrontabXmlAction"/>
<action id="MagentoCreateDiFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewDiXmlAction"/>
Expand Down Expand Up @@ -91,7 +90,6 @@
<action id="MagentoCreateACronjob" class="com.magento.idea.magento2plugin.actions.generation.NewCronjobAction" />
<action id="MagentoCreateACronGroup" class="com.magento.idea.magento2plugin.actions.generation.NewCronGroupAction" />
<action id="MagentoCreateAViewModel" class="com.magento.idea.magento2plugin.actions.generation.NewViewModelAction" />
<action id="MagentoCreateAGraphQlResolver" class="com.magento.idea.magento2plugin.actions.generation.NewGraphQlResolverAction" />
<action id="MagentoCreateCLICommand" class="com.magento.idea.magento2plugin.actions.generation.NewCLICommandAction" />
<action id="MagentoCreateEmailTemplate" class="com.magento.idea.magento2plugin.actions.generation.NewEmailTemplateAction" />
<action id="MagentoCreateUiComponentGrid" class="com.magento.idea.magento2plugin.actions.generation.NewUiComponentGridAction" />
Expand Down Expand Up @@ -621,7 +619,6 @@
<internalFileTemplate name="Magento Regular Class"/>
<internalFileTemplate name="Magento Observer Class"/>
<internalFileTemplate name="Magento Events XML"/>
<internalFileTemplate name="Magento GraphQL Resolver Class"/>
<internalFileTemplate name="Magento Cron Job Class"/>
<internalFileTemplate name="Magento Cron Tab XML"/>
<internalFileTemplate name="Magento CLI Command Class"/>
Expand All @@ -635,7 +632,6 @@
<internalFileTemplate name="Magento Routes XML"/>
<internalFileTemplate name="Magento Layout XML"/>
<internalFileTemplate name="Magento ACL XML"/>
<internalFileTemplate name="Magento GraphQL Schema"/>
<internalFileTemplate name="Magento Collection Class"/>
<internalFileTemplate name="Magento Model Class"/>
<internalFileTemplate name="Magento Resource Model Class"/>
Expand Down
16 changes: 16 additions & 0 deletions resources/META-INF/withJsGraphQl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
-->

<idea-plugin>
<actions>
<group id="GraphQL.MagentoContextBasedActionsGroup">
<add-to-group group-id="MagentoContextBasedActionsGroup" anchor="last"/>
<action id="MagentoCreateGraphQlSchemaFile"
class="com.magento.idea.magento2plugin.actions.context.xml.NewGraphQLSchemaAction"/>
</group>
<group id="GraphQL.MagentoNewModuleFileGroup"
text="GraphQL"
popup="false">
<add-to-group group-id="MagentoNewModuleFileGroup" anchor="last"/>
<action id="MagentoCreateAGraphQlResolver" class="com.magento.idea.magento2plugin.actions.generation.NewGraphQlResolverAction" />
</group>
</actions>
<extensions defaultExtensionNs="com.intellij">
<fileBasedIndex implementation="com.magento.idea.magento2plugin.stubs.indexes.graphql.GraphQlResolverIndex" />
<codeInsight.lineMarkerProvider language="PHP" implementationClass="com.magento.idea.magento2plugin.linemarker.php.GraphQlResolverUsageLineMarkerProvider"/>
Expand All @@ -22,5 +35,8 @@
enabledByDefault="true"
level="ERROR"
implementationClass="com.magento.idea.magento2plugin.inspections.graphqls.SchemaResolverInspection"/>

<internalFileTemplate name="Magento GraphQL Resolver Class"/>
<internalFileTemplate name="Magento GraphQL Schema"/>
</extensions>
</idea-plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ${CLASS_NAME} implements ${IMPLEMENTS}
$eavSetup->addAttributeToSet(
${CUSTOMER_METADATA_INTERFACE}::ENTITY_TYPE_CUSTOMER,
${CUSTOMER_METADATA_INTERFACE}::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'Default',
'${ATTRIBUTE_CODE}'
);

Expand Down
2 changes: 2 additions & 0 deletions resources/magento2/validation.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
validator.notEmpty=The {0} field must not be empty
validator.box.notEmpty=The {0} field must contain a valid selection from the dropdown
validator.package.validPath=Please specify a valid Magento 2 installation path
validator.package.validPathComposerFiles=File composer.json is missing in the current Magento 2 installation path
validator.package.validPathVendor=Vendor dir is corrupt or missing in the current Magento 2 installation path
validator.properties.notEmpty=The properties must not be empty
validator.alphaNumericCharacters=The {0} field must contain letters and numbers only
validator.alphaNumericAndUnderscoreCharacters={0} must contain letters, numbers and underscores only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.ide.highlighter.XmlFileType;
import com.intellij.openapi.externalSystem.service.execution.NotSupportedException;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
Expand Down Expand Up @@ -71,6 +72,10 @@ public void visitFile(final @NotNull PsiFile file) {
return;
}

// This added to cover case if file exists only in memory.
if (file.getContainingDirectory() == null) {
return;
}
final EventIndex eventIndex = new EventIndex(file.getProject());
final HashMap<String, XmlTag> targetObserversHash = new HashMap<>();

Expand Down Expand Up @@ -108,7 +113,8 @@ public void visitFile(final @NotNull PsiFile file) {
}

final String observerName = observerNameAttribute.getValue();
if (observerName == null) {
if (observerName == null
|| observerNameAttribute.getValueElement() == null) {
continue;
}

Expand Down Expand Up @@ -188,6 +194,11 @@ private List<HashMap<String, String>> fetchModuleNamesWhereSameObserverNameUsed(
final EventIndex eventIndex,
final PsiFile file
) {
if (file.getContainingDirectory() == null) {
throw new NotSupportedException(
"Operation is not supported for files in memory"
);
}
final List<HashMap<String, String>> modulesName = new ArrayList<>();
final String currentFileDirectory = file.getContainingDirectory().toString();
final String currentFileFullPath = currentFileDirectory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private <E extends PhpNamedElement> boolean isValidFqn(final E candidate) {
PhpClass targetClass = null;

if (candidate instanceof Method) {
targetClass = (PhpClass) candidate.getParent();
targetClass = ((Method) candidate).getContainingClass();
} else if (candidate instanceof PhpClass) {
targetClass = (PhpClass) candidate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,30 @@ public SettingsFormValidator(
*
* @throws ConfigurationException Exception
*/
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.AvoidDeeplyNestedIfStmts"})
public void validate() throws ConfigurationException {
if (form.isBeingUsed()) {
if (!MagentoBasePathUtil.isMagentoFolderValid(form.getMagentoPath())) {
final String magentoRootPath = form.getMagentoPath();
final boolean isMagentoFrameworkDirExist =
MagentoBasePathUtil.isMagentoFolderValid(magentoRootPath);

if (!MagentoBasePathUtil.isComposerJsonExists(magentoRootPath)) {
if (isMagentoFrameworkDirExist) {
throw new ConfigurationException(
validatorBundle.message("validator.package.validPathComposerFiles")
);
}
throw new ConfigurationException(
validatorBundle.message("validator.package.validPath")
);
}

if (!isMagentoFrameworkDirExist) {
throw new ConfigurationException(
validatorBundle.message("validator.package.validPathVendor")
);
}

final String magentoVersion = form.getMagentoVersion();
if (magentoVersion.length() == 0) {
throw new ConfigurationException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.magento.idea.magento2plugin.magento.files.ComposerJson;
import com.magento.idea.magento2plugin.magento.packages.Package;
import java.util.Arrays;
import org.jetbrains.annotations.NotNull;
Expand All @@ -18,7 +19,7 @@ public final class MagentoBasePathUtil {
private MagentoBasePathUtil() {}

/**
* Method detects Magento Framework Root.
* Method detects Magento Framework Root (check if magento framework exists).
*
* @param path String
* @return boolean
Expand All @@ -42,6 +43,25 @@ public static boolean isMagentoFolderValid(final String path) {
return false;
}

/**
* Check if composer.json exists in directory.
*
* @param path String
* @return boolean
*/
public static Boolean isComposerJsonExists(final String path) {
if (StringUtil.isEmptyOrSpaces(path)) {
return false;
}
final VirtualFile magentoRoot = LocalFileSystem.getInstance().findFileByPath(path);

if (magentoRoot == null || !magentoRoot.isDirectory()) {
return false;
}

return magentoRoot.findChild(ComposerJson.FILE_NAME) != null;
}

/**
* Check if specified path belongs to the correct vendor name.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function apply()
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'Default',
'multiselect_test'
);

Expand Down