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

tprochazka 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 2e32e971416 Add PHPStan rule level 10
2e32e971416 is described below

commit 2e32e9714160a30cfd7819e22458f39d8d9362e1
Author: Tomas Prochazka <[email protected]>
AuthorDate: Sun Dec 1 18:05:59 2024 +0100

    Add PHPStan rule level 10
    
    Added new rule level.
    Removed special rendering of max rule level because "max" is individual 
option.
    Reference:
    - https://phpstan.org/user-guide/rule-levels
---
 .../php/analysis/options/AnalysisOptions.java      |  2 +-
 .../analysis/ui/PHPStanLevelListCellRenderer.java  | 43 ----------------------
 .../ui/analyzer/PHPStanCustomizerPanel.java        |  2 -
 .../analysis/ui/options/PHPStanOptionsPanel.java   |  2 -
 4 files changed, 1 insertion(+), 48 deletions(-)

diff --git 
a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/options/AnalysisOptions.java
 
b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/options/AnalysisOptions.java
index 9ab6a6d6fb3..1edc11740fd 100644
--- 
a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/options/AnalysisOptions.java
+++ 
b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/options/AnalysisOptions.java
@@ -58,7 +58,7 @@ public final class AnalysisOptions {
     private static final String PHPSTAN_CONFIGURATION = 
"phpstan.configuration"; // NOI18N
     private static final String PHPSTAN_MEMORY_LIMIT = "phpstan.memory.limit"; 
// NOI18N
     public static final int PHPSTAN_MIN_LEVEL = 
Integer.getInteger("nb.phpstan.min.level", 0); // NOI18N
-    public static final int PHPSTAN_MAX_LEVEL = 
Integer.getInteger("nb.phpstan.max.level", 9); // NOI18N
+    public static final int PHPSTAN_MAX_LEVEL = 
Integer.getInteger("nb.phpstan.max.level", 10); // NOI18N
     // Psalm - PHP Static Analysis Tool
     private static final String PSALM_PATH = "psalm.path"; // NOI18N
     private static final String PSALM_LEVEL = "psalm.level"; // NOI18N
diff --git 
a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/PHPStanLevelListCellRenderer.java
 
b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/PHPStanLevelListCellRenderer.java
deleted file mode 100644
index d98229b2d9c..00000000000
--- 
a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/PHPStanLevelListCellRenderer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.php.analysis.ui;
-
-import java.awt.Component;
-import javax.swing.JList;
-import javax.swing.ListCellRenderer;
-import org.netbeans.modules.php.analysis.options.AnalysisOptions;
-
-public class PHPStanLevelListCellRenderer implements ListCellRenderer<String> {
-
-    private final ListCellRenderer<? super String> defaultRenderer;
-
-    public PHPStanLevelListCellRenderer(ListCellRenderer<? super String> 
defaultRenderer) {
-        this.defaultRenderer = defaultRenderer;
-    }
-
-    @Override
-    public Component getListCellRendererComponent(JList<? extends String> 
list, String value, int index, boolean isSelected, boolean cellHasFocus) {
-        String level = value;
-        if (String.valueOf(AnalysisOptions.PHPSTAN_MAX_LEVEL).equals(level)) {
-            level += " (max)"; // NOI18N
-        }
-        return defaultRenderer.getListCellRendererComponent(list, level, 
index, isSelected, cellHasFocus);
-    }
-
-}
diff --git 
a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/analyzer/PHPStanCustomizerPanel.java
 
b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/analyzer/PHPStanCustomizerPanel.java
index 6912cf04a52..237d5956f1f 100644
--- 
a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/analyzer/PHPStanCustomizerPanel.java
+++ 
b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/analyzer/PHPStanCustomizerPanel.java
@@ -37,7 +37,6 @@ import javax.swing.LayoutStyle;
 import org.netbeans.modules.analysis.spi.Analyzer;
 import org.netbeans.modules.php.analysis.commands.PHPStan;
 import org.netbeans.modules.php.analysis.options.AnalysisOptions;
-import org.netbeans.modules.php.analysis.ui.PHPStanLevelListCellRenderer;
 import org.netbeans.modules.php.analysis.options.AnalysisOptionsValidator;
 import org.netbeans.modules.php.analysis.options.ValidatorPHPStanParameter;
 import org.netbeans.modules.php.analysis.ui.AnalysisDefaultDocumentListener;
@@ -121,7 +120,6 @@ public class PHPStanCustomizerPanel extends JPanel {
             phpStanLevelComboBox.addItem(String.valueOf(i));
         }
         phpStanLevelComboBox.addItem(PHPStan.MAX_LEVEL);
-        phpStanLevelComboBox.setRenderer(new 
PHPStanLevelListCellRenderer(phpStanLevelComboBox.getRenderer()));
         phpStanLevelComboBox.setSelectedItem(getValidLevel());
         phpStanLevelComboBox.addItemListener(e -> setLevel());
     }
diff --git 
a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/options/PHPStanOptionsPanel.java
 
b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/options/PHPStanOptionsPanel.java
index 1fe379d5fbf..7ae0ae3dbe4 100644
--- 
a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/options/PHPStanOptionsPanel.java
+++ 
b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/options/PHPStanOptionsPanel.java
@@ -39,7 +39,6 @@ import org.netbeans.modules.php.analysis.commands.PHPStan;
 import org.netbeans.modules.php.analysis.options.AnalysisOptions;
 import org.netbeans.modules.php.analysis.options.AnalysisOptionsValidator;
 import org.netbeans.modules.php.analysis.ui.AnalysisDefaultDocumentListener;
-import org.netbeans.modules.php.analysis.ui.PHPStanLevelListCellRenderer;
 import org.netbeans.modules.php.analysis.options.ValidatorPHPStanParameter;
 import org.netbeans.modules.php.analysis.util.AnalysisUiUtils;
 import org.netbeans.modules.php.api.validation.ValidationResult;
@@ -78,7 +77,6 @@ public class PHPStanOptionsPanel extends 
AnalysisCategoryPanel {
             phpStanLevelComboBox.addItem(String.valueOf(i));
         }
         phpStanLevelComboBox.addItem(PHPStan.MAX_LEVEL);
-        phpStanLevelComboBox.setRenderer(new 
PHPStanLevelListCellRenderer(phpStanLevelComboBox.getRenderer()));
         // add listener
         DocumentListener defaultDocumentListener = new 
AnalysisDefaultDocumentListener(() -> fireChange());
         
phpStanTextField.getDocument().addDocumentListener(defaultDocumentListener);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to