[
https://issues.apache.org/jira/browse/NETBEANS-3002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16958571#comment-16958571
]
Czukowski commented on NETBEANS-3002:
-------------------------------------
Yes, I think it warns about an unused ignore pattern in the configuration file,
which is not an error in any of the inspected sources, but rather in the
configuration itself, so there's no file name or error lines and column numbers.
> NullPointerExceptions during PHPStan inspection
> -----------------------------------------------
>
> Key: NETBEANS-3002
> URL: https://issues.apache.org/jira/browse/NETBEANS-3002
> Project: NetBeans
> Issue Type: Bug
> Components: php - Code Analysis
> Affects Versions: 11.0, 11.1
> Environment: Windows 10
> Reporter: Czukowski
> Assignee: Junichi Yamamoto
> Priority: Major
> Attachments: PHPStanException.zip
>
>
> PHPStan code analysis support reports NullPointerExceptions at some
> occasions. When the exception occurs, the Inspect dialog window is not closed
> on its own.
> I've been able to reproduce it using the uploaded sample project. Run
> {{composer install}}, then configure NetBeans to use PHPStan from
> {{vendor/bin}} and the configuration from {{phpstan.neon}} file in the
> project root.
> The configuration file contains {{ignoreErrors}} section with a pattern to
> ignore known errors. The exception seems to depend on whether this pattern is
> there or not (to disable, comment the line with {{#}}).
> To reproduce, select the {{app}} folder and run PHPStan inspection with the
> scope: Current folder (app).
> With the setup above I've encountered two types of the stack traces:
> *Without ignore pattern (commented line)*
> Output:
> {code}
> "C:\Workspace\Test\PHPStanException\vendor\bin\phpstan.bat" "analyse"
> "--no-ansi" "--no-progress" "--no-interaction" "--error-format=checkstyle"
> "--level=5" "--configuration=C:\Workspace\Test\PHPStanException\phpstan.neon"
> "C:\Workspace\Test\PHPStanException\app"
> <?xml version="1.0" encoding="UTF-8"?>
> <checkstyle>
> <file name="app\Something.php">
> <error line="13" column="1" severity="error" message="Binary operation
> "+" between string and 2 results in an error." />
> </file>
> <file name="app\index.php">
> <error line="9" column="1" severity="error" message="Anonymous function
> should return string but returns void." />
> <error line="9" column="1" severity="error" message="Result of closure
> (void) is used." />
> </file>
> </checkstyle>
> Done.
> {code}
> Stack trace:
> {code}
> java.lang.NullPointerException
> at org.netbeans.modules.php.analysis.util.Mappers.map(Mappers.java:54)
> at
> org.netbeans.modules.php.analysis.PHPStanAnalyzerImpl.doAnalyze(PHPStanAnalyzerImpl.java:140)
> at
> org.netbeans.modules.php.analysis.PHPStanAnalyzerImpl.analyze(PHPStanAnalyzerImpl.java:92)
> at
> org.netbeans.modules.analysis.RunAnalysis$1$1.doRunAnalyzer(RunAnalysis.java:186)
> at
> org.netbeans.modules.analysis.RunAnalysis$1$1.run(RunAnalysis.java:142)
> at
> org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
> at
> org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
> at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
> [catch] at
> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
> {code}
> *With ignore pattern*
> Output:
> {code}
> "C:\Workspace\Test\PHPStanException\vendor\bin\phpstan.bat" "analyse"
> "--no-ansi" "--no-progress" "--no-interaction" "--error-format=checkstyle"
> "--level=5" "--configuration=C:\Workspace\Test\PHPStanException\phpstan.neon"
> "C:\Workspace\Test\PHPStanException\app"
> <?xml version="1.0" encoding="UTF-8"?>
> <checkstyle>
> <file name="app\Something.php">
> <error line="13" column="1" severity="error" message="Binary operation
> "+" between string and 2 results in an error." />
> </file>
> <file name="app\index.php">
> <error line="9" column="1" severity="error" message="Anonymous function
> should return string but returns void." />
> <error line="9" column="1" severity="error" message="Result of closure
> (void) is used." />
> </file>
> <file>
> <error severity="error" message="Ignored error pattern #Call to an
> undefined method Cz\\Test\\Nothing# was not matched in reported errors." />
> </file>
> </checkstyle>
> Done.
> {code}
> Stack trace:
> {code}
> java.lang.NullPointerException
> at
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.sanitizeFileName(PHPStanReportParser.java:199)
> at
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.getCurrentFile(PHPStanReportParser.java:180)
> at
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.processFileStart(PHPStanReportParser.java:133)
> at
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.startElement(PHPStanReportParser.java:114)
> at
> java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510)
> at
> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1397)
> at
> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710)
> at
> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
> at
> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
> at
> java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
> at
> java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
> at
> java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
> at
> java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
> at
> java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
> at
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.create(PHPStanReportParser.java:68)
> at
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.parse(PHPStanReportParser.java:77)
> at
> org.netbeans.modules.php.analysis.commands.PHPStan.analyze(PHPStan.java:117)
> at
> org.netbeans.modules.php.analysis.PHPStanAnalyzerImpl.doAnalyze(PHPStanAnalyzerImpl.java:133)
> at
> org.netbeans.modules.php.analysis.PHPStanAnalyzerImpl.analyze(PHPStanAnalyzerImpl.java:92)
> at
> org.netbeans.modules.analysis.RunAnalysis$1$1.doRunAnalyzer(RunAnalysis.java:186)
> at
> org.netbeans.modules.analysis.RunAnalysis$1$1.run(RunAnalysis.java:142)
> at
> org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
> at
> org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
> at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
> [catch] at
> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
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