- DO NOT CHANGE BASE CLASSES in
src/Base!!! - AVOID TO CHANGE OTHER CLASSES in
src!!! - Try to fix existing test-files in the first place, in exceptional cases, fix src classes.
- NEVER normalize or format the input data in type-classes, use the given value as it is (no trim(), strtolower(), etc.).
- Create a new type class in
src/{TypeName}/or deeper toSpecificetc. directory. - Create a new type class in
src/{TypeName}/Alias/or deeper directory. - Create a new exception class in
src/Exception/{TypeName}/or deeper directory, name has reverted order of words, forIntegerPositiveit'sPositiveIntegerTypeException. - Create a new test class in
tests/Unit/{TypeName}/{TypeName}Test.phpfile. Make 100% code/type/mutation coverage, copy the nearest tests file cases, use "Fix test" rules. - Add to the test a
covers({TypeName}::class); - Type class should not contain data formatters, validate data as it is.
- Run
docker-compose exec -ti php csto fix code style. - Run
docker-compose exec -ti php composer scato check Psalm static analysis. - Run
docker-compose exec -ti php composer test -- --filter="newTypeClassName"to run tests. - Run
docker-compose exec -ti php composer type -- --filter="newTypeClassName"to run type coverage. - Run
docker-compose exec -ti php composer coverageto run code coverage. - Run
docker-compose exec -ti php ./vendor/bin/pest tests/Unit/"newTypeClassName" --mutate --covered-only --parallel --min=100to run mutation tests.
- Run
docker-compose exec -ti php composer scato check Psalm static analysis.
- FIX ONLY TEST FILES, DO NOT CREATE NEW TEST FILES, DO NOT CHANGE CLASSES FROM
src. - Tests style Use PEST syntax, wrap all tests in describe(), use it() and with() for datasets.
- Try to find a proper describe() group for a new test.
- If a mock class is created in a test – choose a name "ClassName" + Test to comply with psr-4 autoloading standard.
- Add a proper namespace and add
use Stringable;anduse stdClass;if any used in code. - Choose short but meaningful names for test\describe methods, must be unique in a file.
- Avoid duplicate test cases or same data in a single test.
- Run
docker-compose exec -ti php composer test -- --filter="failedTypeClassName"to run tests. - Run
docker-compose exec -ti php composer type -- --filter="failedTypeClassName"to run type coverage. - Run
docker-compose exec -ti php composer coverageto run code coverage (use no options). - For mutation fails: run for each
docker-compose exec -ti php composer mutate -- --id=****with a mutation error id.
- Core: PHP 8.4 with
declare(strict_types=1);. - Standards: Follow PSR-12. Use clean, meaningful naming conventions.
- Static Analysis: Psalm v6 (Level 3).
- Tests: PEST v3.
- Environment: Linux bash.