09:00 - 17:00
That’s where PHPStan comes in – it scans your whole codebase and points out errors even in deep nested conditions. It will also tell you when some code is unreachable because a condition can never be true, and hundreds of other types of errors.
In this workshop, the attendees will learn how to install, configure and run PHPStan, and also receive tips on how to write code so that PHPStan can be as powerful as possible. They will also be able to write their own PHPStan rules and extensions.
Content & Process
Attendees will learn how to get going with PHPStan and how to configure it to fit their needs. They will have the opportunity to try out PHPStan on their own projects and I’ll troubleshoot the common pitfalls in front of the group.
I will also give them tips on how to write PHP code so it’s well understood by the static analyser. Special section is dedicated to everything that’s possible to express in phpDocs to further enhance the analysis.
PHPStan makes it really easy to write custom rules for proprietary codebases. If you encounter the same problem over and over during manual code reviews, you can automate the detection away and delegate it to PHPStan. Attendees will learn how to do it.
PHPStan also allows to write other types of custom extensions. Attendees will learn how to:
* describe magic behaviour in __call, __get and __set.
* describe methods with different return types based on their inputs
* describe custom functions and methods that specify types of values (like assertInstanceOf).
* implement custom error formatters for different output formats of PHPStan
Audience & Requirements
Attendees should be familiar with PHP 7.x syntax and features and should have installed PHP 7.1 or later on their computers. Feel free to bring their own projects to try PHPStan on.