diff --git a/php.editor/src/org/netbeans/modules/php/editor/model/impl/MethodScopeImpl.java b/php.editor/src/org/netbeans/modules/php/editor/model/impl/MethodScopeImpl.java --- a/php.editor/src/org/netbeans/modules/php/editor/model/impl/MethodScopeImpl.java +++ b/php.editor/src/org/netbeans/modules/php/editor/model/impl/MethodScopeImpl.java @@ -75,6 +75,7 @@ private boolean scanned; private MethodDeclaration originalNode; private ModelVisitor visitor; + private boolean isMagic; //new contructors MethodScopeImpl(Scope inScope, String returnType, MethodDeclarationInfo nodeInfo, ModelVisitor visitor, boolean isDeprecated) { @@ -91,6 +92,7 @@ assert inScope instanceof TypeScope : inScope.getClass().toString(); classNormName = inScope.getNormalizedName(); scanned = true; + isMagic = true; } MethodScopeImpl(Scope inScope, BaseFunctionElement element) { @@ -148,7 +150,7 @@ @Override public boolean isMagic() { - return PredefinedSymbols.MAGIC_METHODS.contains(getName().toLowerCase()); + return isMagic || PredefinedSymbols.MAGIC_METHODS.contains(getName().toLowerCase()); } @Override diff --git a/php.editor/src/org/netbeans/modules/php/editor/verification/MethodRedeclarationHintError.java b/php.editor/src/org/netbeans/modules/php/editor/verification/MethodRedeclarationHintError.java --- a/php.editor/src/org/netbeans/modules/php/editor/verification/MethodRedeclarationHintError.java +++ b/php.editor/src/org/netbeans/modules/php/editor/verification/MethodRedeclarationHintError.java @@ -50,6 +50,7 @@ import org.netbeans.modules.csl.api.OffsetRange; import org.netbeans.modules.php.editor.model.FileScope; import org.netbeans.modules.php.editor.model.FunctionScope; +import org.netbeans.modules.php.editor.model.MethodScope; import org.netbeans.modules.php.editor.model.ModelUtils; import org.netbeans.modules.php.editor.model.TypeScope; import org.netbeans.modules.php.editor.parser.PHPParseResult; @@ -128,6 +129,12 @@ private void checkDeclaredFunctions(Collection declaredFunctions) { Set declaredMethodNames = new HashSet<>(); for (FunctionScope functionScope : declaredFunctions) { + if (functionScope instanceof MethodScope) { + MethodScope methodScope = (MethodScope) functionScope; + if (methodScope.isMagic()) { + continue; + } + } if (!isInConditionStatament(functionScope)) { String fullyQualifiedFunctionName = functionScope.getFullyQualifiedName().toString(); if (declaredMethodNames.contains(fullyQualifiedFunctionName)) {