Permalink
Browse files

Add optional return types for PHP 7.

  • Loading branch information...
cabdesigns committed Aug 23, 2015
1 parent fd52cd8 commit 49a480f7a658c7c433aa1bf1a79abe8265529df4
Showing with 8 additions and 2 deletions.
  1. +8 −2 jsdocs.py
@@ -772,13 +772,15 @@ def parseFunction(self, line):
+ '(?P<name>' + self.settings['fnIdentifier'] + ')'
# function fnName
# (arg1, arg2)
+ '\\s*\\(\\s*(?P<args>.*)\\)',
+ '\\s*\\(\\s*(?P<args>.*)\\)'
# optional return type
+ '(\\s*?:\\s*(?P<retval>' + self.settings['typeIdentifier'] + '))?',
line
)
if not res:
return None

return (res.group('name'), res.group('args'), None)
return (res.group('name'), res.group('args'), res.group('retval'))

def getArgType(self, arg):

@@ -873,6 +875,10 @@ def getFunctionReturnType(self, name, retval):
return 'string'
if name == '__isset':
return 'bool' if shortPrimitives else 'boolean'

if (retval):
return retval

return JsdocsParser.getFunctionReturnType(self, name, retval)


0 comments on commit 49a480f

Please sign in to comment.