==================== PHP coding standards ==================== Starting with Nextcloud 19 there is a shared `PHP Coding Standards Fixer `_ configuration you can use to automatically format your app's source code. For full details see the `repository on GitHub `_. Always use:: should not be used at the end of the file due to the `possible issue of sending white spaces `_. Comments -------- All API methods need to be marked with `PHPDoc `_ markup. An example would be: .. code-block:: php 'bar', 'spam' => 'ham', ); ?> Operators --------- Use **===** and **!==** instead of **==** and **!=**. Here's why: .. code-block:: php true var_dump("1" == "01"); // 1 == 1 -> true var_dump("10" == "1e1"); // 10 == 10 -> true var_dump(100 == "1e2"); // 100 == 100 -> true ?> Control structures ------------------ * Always use { } for one line ifs * Split long ifs into multiple lines * Always use break in switch statements and prevent a default block with warnings if it shouldn't be accessed .. code-block:: php Unit tests ---------- Unit tests must always extend the ``\Test\TestCase`` class, which takes care of cleaning up the installation after the test. If a test is run with multiple different values, a data provider must be used. The name of the data provider method must not start with ``test`` and must end with ``Data``. .. code-block:: php assertEquals($expected, \Dummy::method($input)); } }