Skip to content

Commit

Permalink
Add optional return types for PHP 7.
Browse files Browse the repository at this point in the history
  • Loading branch information
cabdesigns committed Aug 23, 2015
1 parent fd52cd8 commit 49a480f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions jsdocs.py
Expand Up @@ -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):

Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit 49a480f

Please sign in to comment.