You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by tm...@apache.org on 2020/11/20 09:22:31 UTC

[netbeans] branch master updated: [NETBEANS-5029] PHP - generated methods are public by default

This is an automated email from the ASF dual-hosted git repository.

tmysik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 5d115a7  [NETBEANS-5029] PHP - generated methods are public by default
     new 43c2cea  Merge pull request #2537 from KacerCZ/netbeans-5029-generator-default-public
5d115a7 is described below

commit 5d115a793d01c690b1a8b1ff95559bb46fb72442
Author: Tomas Prochazka <ka...@razdva.cz>
AuthorDate: Sun Nov 15 06:55:08 2020 +0100

    [NETBEANS-5029] PHP - generated methods are public by default
    
    https://issues.apache.org/jira/browse/NETBEANS-5029
    
    Changes default value for generating public modifier of constructor/getters/setters to enabled.
---
 .../src/org/netbeans/modules/php/editor/codegen/CGSGenerator.java     | 2 +-
 .../src/org/netbeans/modules/php/editor/codegen/CGSInfo.java          | 2 +-
 .../php/editor/codegen/SelectedPropertyMethodsCreatorTest.java        | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/codegen/CGSGenerator.java b/php/php.editor/src/org/netbeans/modules/php/editor/codegen/CGSGenerator.java
index adfeb83..5ca6da2 100644
--- a/php/php.editor/src/org/netbeans/modules/php/editor/codegen/CGSGenerator.java
+++ b/php/php.editor/src/org/netbeans/modules/php/editor/codegen/CGSGenerator.java
@@ -425,7 +425,7 @@ public final class CGSGenerator implements CodeGenerator {
                 cgsInfo.setHowToGenerate(GenWay.AS_JAVA);
             }
             cgsInfo.setFluentSetter(preferences.getBoolean(FLUENT_SETTER_PROJECT_PROPERTY, false));
-            cgsInfo.setPublicModifier(preferences.getBoolean(PUBLIC_MODIFIER_PROJECT_PROPERTY, false));
+            cgsInfo.setPublicModifier(preferences.getBoolean(PUBLIC_MODIFIER_PROJECT_PROPERTY, true));
         }
         DialogDescriptor desc = new DialogDescriptor(genType.createPanel(cgsInfo), genType.getDialogTitle());
         Dialog dialog = DialogDisplayer.getDefault().createDialog(desc);
diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/codegen/CGSInfo.java b/php/php.editor/src/org/netbeans/modules/php/editor/codegen/CGSInfo.java
index 4df39f4..810fd69 100644
--- a/php/php.editor/src/org/netbeans/modules/php/editor/codegen/CGSInfo.java
+++ b/php/php.editor/src/org/netbeans/modules/php/editor/codegen/CGSInfo.java
@@ -116,7 +116,7 @@ public final class CGSInfo {
         hasConstructor = false;
         this.generateDoc = true;
         fluentSetter = false;
-        isPublicModifier = false;
+        isPublicModifier = true;
         this.howToGenerate = CGSGenerator.GenWay.AS_JAVA;
         this.phpVersion = phpVersion != null ? phpVersion : PhpVersion.getDefault();
     }
diff --git a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/codegen/SelectedPropertyMethodsCreatorTest.java b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/codegen/SelectedPropertyMethodsCreatorTest.java
index 94176ff..72581f7 100644
--- a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/codegen/SelectedPropertyMethodsCreatorTest.java
+++ b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/codegen/SelectedPropertyMethodsCreatorTest.java
@@ -212,24 +212,28 @@ public class SelectedPropertyMethodsCreatorTest extends PHPTestBase {
 
     public void testGetterWithType_01() throws Exception {
         CGSInfo cgsInfo = getCgsInfo("class Foo {^", PhpVersion.PHP_70);
+        cgsInfo.setPublicModifier(false);
         checkResult(new SelectedPropertyMethodsCreator().create(
                 selectAllProperties(cgsInfo.getPossibleGetters()), new SinglePropertyMethodCreator.SingleGetterCreator(cgsInfo)));
     }
 
     public void testGetterWithType_02() throws Exception {
         CGSInfo cgsInfo = getCgsInfo("class Foo {^", PhpVersion.PHP_55);
+        cgsInfo.setPublicModifier(false);
         checkResult(new SelectedPropertyMethodsCreator().create(
                 selectAllProperties(cgsInfo.getPossibleGetters()), new SinglePropertyMethodCreator.SingleGetterCreator(cgsInfo)));
     }
 
     public void testGetterWithMoreTypes_01() throws Exception {
         CGSInfo cgsInfo = getCgsInfo("class Foo {^", PhpVersion.PHP_70);
+        cgsInfo.setPublicModifier(false);
         checkResult(new SelectedPropertyMethodsCreator().create(
                 selectAllProperties(cgsInfo.getPossibleGetters()), new SinglePropertyMethodCreator.SingleGetterCreator(cgsInfo)));
     }
 
     public void testGetterWithMoreTypes_02() throws Exception {
         CGSInfo cgsInfo = getCgsInfo("class Foo {^", PhpVersion.PHP_56);
+        cgsInfo.setPublicModifier(false);
         checkResult(new SelectedPropertyMethodsCreator().create(
                 selectAllProperties(cgsInfo.getPossibleGetters()), new SinglePropertyMethodCreator.SingleGetterCreator(cgsInfo)));
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists