docblockr: Uncaught TypeError: Cannot read property '1' of null with PHP Syntax Error
Steps to reproduce:
Type the following code and save it into a file called bug.php.
<?php
class Example {
private function get(number) {
return false;
}
}
Move just above the function and type /** and press enter. You’ll get the error.
Notice that my private function has a syntax error. It should be $number instead of number, but it would be awesome if docblockr didn’t throw an uncaught error here.
Atom Version: 1.4.2 System: Mac OS X 10.11.1 Thrown From: docblockr package, v0.7.3
Stack Trace
Uncaught TypeError: Cannot read property ‘1’ of null
At /Users/joel/.atom/packages/docblockr/lib/languages/php.js:67
TypeError: Cannot read property '1' of null
at DocsParser.PhpParser.get_arg_name (/Users/joel/.atom/packages/docblockr/lib/languages/php.js:67:19)
at DocsParser.parse_args (/Users/joel/.atom/packages/docblockr/lib/docsparser.js:265:48)
at DocsParser.format_function (/Users/joel/.atom/packages/docblockr/lib/docsparser.js:130:32)
at DocsParser.parse (/Users/joel/.atom/packages/docblockr/lib/docsparser.js:44:37)
at DocBlockrAtom.module.exports.DocBlockrAtom.parse_command (/Users/joel/.atom/packages/docblockr/lib/docblockr-worker.js:279:29)
at atom-workspace.<anonymous> (/Users/joel/.atom/packages/docblockr/lib/docblockr-worker.js:75:16)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:536:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:359:22)
at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeydown (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:97:36)
at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)
Commands
-3:57.1.0 core:move-up (atom-text-editor.editor.is-focused)
-3:56.2.0 core:move-down (atom-text-editor.editor.is-focused)
26x -3:55.6.0 core:move-left (atom-text-editor.editor.is-focused)
5x -3:53.9.0 core:select-left (atom-text-editor.editor.is-focused)
3x -3:51.3.0 core:backspace (atom-text-editor.editor.is-focused.autocomplete-active)
-3:49.4.0 core:move-up (atom-text-editor.editor.is-focused)
-3:47.6.0 docblockr:parse-enter (atom-text-editor.editor.is-focused)
-0:04.6.0 editor:select-to-first-character-of-line (atom-text-editor.editor.is-focused)
3x -0:04.1.0 core:backspace (atom-text-editor.editor.is-focused)
-0:02.4.0 docblockr:parse-enter (atom-text-editor.editor.is-focused)
-0:02.4.0 editor:newline (atom-text-editor.editor.is-focused)
-0:01.7.0 docblockr:parse-tab (atom-text-editor.editor.is-focused)
-0:01.7.0 snippets:next-tab-stop (atom-text-editor.editor.is-focused)
-0:01.7.0 snippets:expand (atom-text-editor.editor.is-focused)
-0:01.7.0 editor:indent (atom-text-editor.editor.is-focused)
-0:00.5.0 docblockr:parse-enter (atom-text-editor.editor.is-focused)
Config
{
"core": {},
"docblockr": {}
}
Installed Packages
# User
docblockr, v0.7.3
# Dev
No dev packages
About this issue
- Original URL
- State: open
- Created 8 years ago
- Comments: 18
Commits related to this issue
- Merge pull request #222 from jonathandelgado/patch-1 Fixes #162 — committed to nikhilkalige/docblockr by MoritzKn 8 years ago
I have the same issue for valid code in C/C++
void foo(int&);orvoid foo(int*);/**Atom Version: 1.3.1 System: “Arch Linux” Thrown From: docblockr package, v0.7.3
Stack Trace
Uncaught TypeError: Cannot read property ‘1’ of null
Commands
Config
Installed Packages