Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dotherightthing/25b66b1431ca2bfc554d889290cef68a to your computer and use it in GitHub Desktop.
Save dotherightthing/25b66b1431ca2bfc554d889290cef68a to your computer and use it in GitHub Desktop.
[Documenting required and optional @params] #php #documentation

Documenting required and optional @params

Created: 2017.04.24

Using phpDocumentor.

Strictly speaking, PHP doesn't know "optional parameters", but parameters with default values, that can be omitted when the function or method is called. What the documentation tries to tell you is that you should mention it yourself like:

@param string $encoding (optional) Encoding.

[PSR-5] Required option for option @param

PHPDoc assumes that all @type(/@var) tags are required by default as that is the way PHP's internals works with regards to parameters and all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment