Skip to content

Commit

Permalink
Merge branch 'bugfix/php' of https://github.com/RobertoRoos/breathe
Browse files Browse the repository at this point in the history
  • Loading branch information
vermeeren committed Feb 4, 2021
2 parents ddca094 + 936b384 commit 886a07d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
39 changes: 32 additions & 7 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,26 @@ class PyClasslike(BaseObject, python.PyClasslike):

# ----------------------------------------------------------------------------

# Create multi-inheritance classes to merge BaseObject from Breathe with
# classes from phpdomain.
# We use capitalization (and the namespace) to differentiate between the two

if php is not None:
class PHPNamespaceLevel(BaseObject, php.PhpNamespacelevel):
"""Description of a PHP item *in* a namespace (not the space itself)."""
pass

class PHPClassLike(BaseObject, php.PhpClasslike):
pass

class PHPClassMember(BaseObject, php.PhpClassmember):
pass

class PHPGlobalLevel(BaseObject, php.PhpGloballevel):
pass

# ----------------------------------------------------------------------------

if cs is not None:
class CSharpCurrentNamespace(BaseObject, cs.CSharpCurrentNamespace):
pass
Expand Down Expand Up @@ -239,12 +259,13 @@ class DomainDirectiveFactory:

if php is not None:
php_classes = {
'function': (php.PhpNamespacelevel, 'function'),
'class': (php.PhpClasslike, 'class'),
'attr': (php.PhpClassmember, 'attr'),
'method': (php.PhpClassmember, 'method'),
'global': (php.PhpGloballevel, 'global'),
'function': (PHPNamespaceLevel, 'function'),
'class': (PHPClassLike, 'class'),
'attr': (PHPClassMember, 'attr'),
'method': (PHPClassMember, 'method'),
'global': (PHPGlobalLevel, 'global'),
}
php_classes_default = php_classes['class'] # Directive when no matching ones were found

if cs is not None:
cs_classes = {
Expand Down Expand Up @@ -291,8 +312,12 @@ def create(domain: str, args) -> ObjectDescription:
else:
if arg_0 in ['variable']:
arg_0 = 'global'
cls, name = DomainDirectiveFactory.php_classes.get(
arg_0, (php.PhpClasslike, 'class'))

if arg_0 in DomainDirectiveFactory.php_classes:
cls, name = DomainDirectiveFactory.php_classes[arg_0] # type: ignore
else:
cls, name = DomainDirectiveFactory.php_classes_default # type: ignore

elif cs is not None and domain == 'cs':
cls, name = DomainDirectiveFactory.cs_classes[args[0]] # type: ignore
else:
Expand Down
6 changes: 6 additions & 0 deletions documentation/source/directives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,12 @@ Config Values
"h" : "cpp",
}

You can also use this to enable support for Doxygen XML generated from PHP code::

breathe_domain_by_extension = {
"php" : "php",
}

.. confval:: breathe_domain_by_file_pattern

Allows you to specify domains for particular files by wildcard syntax. This
Expand Down

0 comments on commit 886a07d

Please sign in to comment.