Tools ===== GNU social provides some tools to aid developers. Most of the more common ones can be accessed with the `make` command, for the corresponding `Makefile`. These tools range from giving you acess to a shell in the PHP docker container, a repl in the application environment, a PostgreSQL shell, running PHPStan, among others. Pre Commit Hooks ================ A `git` `pre-commit` hook is provided, which gets installed when `composer install` is run. This hook is responsible for running multiple things that aid in maintaing code quality. Specifically, we have setup: - PHP Code Style fixer - PHP Documenation Checker - PHPStan These can be disabled for a given commit by prepending the command with one of `SKIP_CS_FIX`, `SKIP_DOC_CHECK`, `SKIP_PHPSTAN` or `SKIP_ALL`, to disable the corresponding step. ### Example SKIP_PHPSTAN=1 git commit These should be used sparingly, but they're primarily useful for work in process commits and when rebasing. Make ==== Check the `Makefile` for an up to date list of commands available, but notable ones include: - `php-shell` - A shell in the PHP docker container, where you can run commands from the `bin` folder (see below) or `composer` - `php-repl` - A REPL in the context of the application, allowing you to run function for testing. Note that this requires explicitly importing the needed classes with `use Class;` like in a regular file - `psql-shell` - A PostgreSQL shell, if you need to edit the database contents manually - `database-force-schema-update` - If some entity changed, run this to add/remove/update any missing fields - `test` - Run PHPUnit tests - `phpstan` - Run PHPStan These can be run by using `make php-repl`, or the desired command Bin === In addition, some useful scripts are provided in the `bin/` directory. Typically, these should be run inside the Docker container. This can be done by running `make php-shell` Specifically: - `bin/console` - The Symfony console - `bin/generate_entity_fields` - Update autogenerated entity code. Must be run after changing database definitions, i.e. when altering the `schemaDef` static method in a class that extends `Entity` Check the [Symfony Console reference](https://symfony.com/doc/current/console.html) for details on available commands. In addition to those, we have added `app:events`, which lists the application events and their handlers and can be invoked as `bin/console app:event`