Mago is a developer tool to improve the quality of the PHP code you write. In the era of AI it is important to have strict, reliable and fast guard rails to validate your code. We will talk about Coder, PHPStan and Mago - tools for static code analysis.
Basic PHP programming knowledge is useful, then you understand where static analysis tools can help you. This session is suitable for beginner and expert developers alike.
In this session I will present static analysis tools for PHP and practical configuration for Drupal.
- Introduction to static analysis: detecting problems before the code is deployed to production
- "php -l" linting code with PHP itself
- PHP CodeSniffer (PHPCS) and Coder to check coding standards
- PHP code beautifier (PHPCBF) to automatically fix coding standards
- Configuration examples for PHPCS
- PHPStan - static analysis like checking PHP types from type hints and doc comments
- Configuration examples for PHPStan
- Mago: a tool to check PHP code written in Rust
- Advantages of Mago: extremely fast speed provides fast feedback to humans, to your IDE and to LLMs
- Mago for formatting code
- Mago for linting code
- Mago for analyzing code
- Mago configuration for Drupal
- Continuous integration: using static analysis tools in your automated tests pipeline
Background information about the speaker: Klausi is the maintainer of Coder, Drupal's coding standard validation tool. He has contributed Drupal-specific improvements to Mago and PHP CodeSniffer. In his day job as Principal Engineer at Jobiqo he and his team use static analysis tools as an important part of the development workflow. Klausi also maintains the GraphQL module for Drupal and likes to contribute improvements to other modules used at Jobiqo.
This session will give you a good understanding and overview of the static analysis landscape for PHP. You will get practical insights and tips how to run and configure Mago and other tools. After this session you will be able to set up these tools for yourself and for your team.
