OpenEuropa and all its components are built with public contribution in mind. In order for all contributions and components to look and feel familiar, OpenEuropa has agreed on a set of coding standards that all contributors must follow.
Although OpenEuropa does not define any coding standard as such, all the standards it follows are usually based on well known standards such as PSR-1 and PSR-2.
The following are a list of coding standards guidelines, defined using IETF RFC 2119 conformance keywords.
In order to make it easier for contributors to create new components or to modify existing ones the Code Review component has been created.
Coding standards MUST be validated using the OpenEuropa Code Review component across all different OpenEuropa components.
Please refer to the Code Review documentation for more information on its usage.
All Drupal based components MUST follow the already defined Drupal Coding Standards.
Drupal themes are based on the Europa Component Library and should follow the ECL Coding Standards.
All PHP based components that are not part of the Drupal ecosystem MUST adhere to the PSR-2 standards. This applies to any library or component that is mainly developed in PHP.
Type declarations are mandatory for both parameters and return values in all methods.
No type declaration should be added when extending/implementing existing classes/interfaces that do not have type
declarations in their method signatures already, to keep intact the signature itself.
To ensure that only variables of exact type of the type declaration are accepted, all PHP files should have the strict
type declaration statement at the top.