Skip to content

Full function signature in rST (functions & methods)#20

Open
n-peugnet wants to merge 1 commit intoavalanche123:masterfrom
club-1:n-peugnet-full-signature
Open

Full function signature in rST (functions & methods)#20
n-peugnet wants to merge 1 commit intoavalanche123:masterfrom
club-1:n-peugnet-full-signature

Conversation

@n-peugnet
Copy link

@n-peugnet n-peugnet commented Apr 4, 2023

The only part we need to strip from the signature is the 'function' one, sphinxcontrib-phpdomains handles pretty well the rest of the signature.
This adds a lot more details to the docs, by showing where the parameters are, their default values and the optional return value Type hint.

This also allows to visually differentiate instance methods from class
methods.

Example

class SphinxInventoryParser {

	/**
	 * Parse a readable stream into an indexed :php:class:`SphinxInventory` object.
	 *
	 * @param resource	$stream		The resource to parse, opened in read mode.
	 * @param string	$baseURI	The base string to prepend to an object's location to get its final URI.
	 *
	 * @return SphinxInventory		The inventory parsed from the stream.
	 * @throws UnexpectedValueException	If an unexpected value is encountered while parsing.
	 */
	public function parse($stream, string $baseURI = ''): SphinxInventory {

Before:

2023-04-04-184449_718x515_scrot

After:

2023-04-04-184418_718x515_scrot

The only part we need to strip from the signature is the 'function' one,
sphinxcontrib-phpdomains handles pretty well the rest of the signature.
This adds a lot more details to the docs, by showing where the
parameters are, their default values and the optional return value Type
hint.

This also allows to visually differentiate instance methods from class
methods.
@n-peugnet n-peugnet marked this pull request as ready for review April 4, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant