ApiOpenStudio adheres to the es2021 Extended coding style. See ES2021 for the full formal definition.
All indents ahould be 2 spaces.
Always end a file in a newline.
Literal quotes should be sigle quotes, to avoid possible escaping, e.g.:
const myVar = 'hello world!'
End of statement semi-colons are not necessary, unless statements require it.
File names should be camel-case, e.g.:
processorInfo.vue
Variables should be camel-case (lower-case first), e.g.:
const myVariable
Functions should be camel-case, e.g.:
const myFunction = () => {}
Global constants should always be avoided, but if needed they should be upper snake-case, e.g.:
MY_CONSTANT
Classes should should be Pascal case, e.g.:
class MyClass {
constructor(var1) {
this.var1 = var1;
}
}
const myVar = new MyClass('hi')
ApiOpenStudio adheres to the PSR-12 Extended coding style. See PSR-12 for the full formal definition.
squizlabs/php_codesniffer
is installed as a require-dev in Composer, so phpcs
and phpcbf
are available in the vendor directory.
A line of code should not exceed 120 characters.
All indents ahould be 4 spaces.
The following curly brackets should not be on a new line. e.g.:
if (a == b) {
// Do something.
} elseif (a != b) {
// Do something else.
} else {
// We would never get here. But who cares, it's only an example.
}
try {
// Do something.
} catch(Excption $e) {
// Handle the expection.
}
Standard PHPDOC rules apply.
Should be in the following format:
/**
* File description.
*
* @package ...
*/
Should be in the following format:
/**
* Short description.
*
* Long description (optional).
*
* @param type $var Comment.
*
* @return type Comment (optional).
*
* @throws ApiException Comment (optional).
*/
Type hints are not required (to accommodate mixed types), but are recommended. The curly brackets must be on a new line.
e.g.:
public function functionName(string $a, int $b, $c)
{
}