|
| 1 | +This is a php based project. php 8.3 is the minimum version required to run this project. |
| 2 | +php 8.4 features are not used in this project. codeception is used for testing. |
| 3 | + |
| 4 | +## Key Guidelines |
| 5 | + - Do not modify `composer.json` or `composer.lock` files. |
| 6 | + |
| 7 | +## Code Standards |
| 8 | + |
| 9 | + - Use symfony coding standards. |
| 10 | + - Follow PSR-12 for PHP code style. |
| 11 | + - Use spaces for indentation (4 spaces per indent level). |
| 12 | + - Use camelCase for variable and method names, and PascalCase for class names. Constants should be in uppercase with underscores. |
| 13 | + - Use single quotes for strings unless interpolation is needed. |
| 14 | + - Use `===` for comparisons and avoid using `==` unless necessary. |
| 15 | + - Make new classes final unless they are intended to be extended. |
| 16 | + - Dont add '@param' to methods unless the parameter type is not clear from the method signature. |
| 17 | + - Dont add '@return' to methods unless the return type is not clear from the method signature. |
| 18 | + - Follow the principle of least surprise, meaning that code should be easy to understand and follow common conventions. |
| 19 | + - Follow the principle of return early, meaning that if a function can return early, it should do so to avoid deep nesting. |
| 20 | + - Use dependency injection for classes and services. |
| 21 | + - Use interfaces for classes that are intended to be used as services. |
| 22 | + - Use interfaces for dependency injection to allow for easier testing and mocking. |
| 23 | + - Avoid using static methods and properties unless absolutely necessary. |
| 24 | + - Use contructor injection for dependencies. |
| 25 | + - Avoid using global state and singletons. |
| 26 | + - Use constructer promotion for class properties. |
| 27 | + - Follow the principle of minimal visibility, meaning that class properties and methods should be as private as possible. |
| 28 | + - Use interfaces for classes that are intended to be used as services. |
| 29 | + - Avoid using abstract classes unless absolutely necessary. |
| 30 | + - Add a `@throws` annotation to methods that can throw exceptions, and document the exceptions that can be thrown. |
| 31 | + - Add a new line at the end of each file. Use UTF-8 encoding for files. |
| 32 | + - Use `null` coalescing operator (`??`) for default values when applicable. |
| 33 | + - Use `match` expressions for simple value comparisons. |
| 34 | + - Use `array_map`, `array_filter`, and `array_reduce` for array transformations instead of loops when applicable. |
| 35 | + - Use `declare(strict_types=1);` at the top of each file to enforce strict typing. |
| 36 | + |
| 37 | +## Repository Structure |
| 38 | + |
| 39 | + - Use the `src/` directory for application code. |
| 40 | + - Use the `tests/Unit` directory for unit tests. |
| 41 | + - Use the `config/` directory for configuration files. |
| 42 | + - Use the `public/` directory for public assets and entry points. |
| 43 | + - Use the `vendor/` directory for third-party dependencies managed by Composer. |
| 44 | + - Use the `translations/` directory for translation files. |
| 45 | + - Use the `doc/` directory for documentation files. |
| 46 | + |
| 47 | +## Testing |
| 48 | + |
| 49 | + - Use Codeception for testing. |
| 50 | + - Follow the Codeception documentation for writing tests. |
| 51 | + - Write unit tests for new functionality. Use mocks and stubs where applicable. |
| 52 | + - Use `codeception.dist.yml` for Codeception configuration. |
| 53 | + - Run tests using `vendor/bin/codecept run` command. |
| 54 | + |
| 55 | +## Documentation |
| 56 | + |
| 57 | + - Use `@deprecated` annotation for deprecated methods or classes. |
| 58 | + - Use `@example` annotation for providing examples of usage. |
| 59 | + - Keep documentation up to date with code changes. |
| 60 | + - Suggest changes to the `doc/` folder when appropriate |
0 commit comments