Static Analysis Crash Course for Framework Developers

Avatar of Ondřej Mirtes Ondřej Mirtes

In recent years, static analysis tools like PHPStan have become super popular in the PHP world. These tools do something cool: they can spot all sorts of mistakes in your code before you even run it.

Usually, people try these tools on their own code. But if you're the person behind a framework or library that others use, guess what? They're probably using these tools too. So, the code people write using your stuff also needs to pass these checks.

This creates an extra thing you need to worry about. You've got to make sure your framework or library works nicely with these tools. And if you're smart about it, you can even help guide other developers to use your code the right way.

In my talk I'll take you through three important steps:

1) Laying the Foundation: I'll start by covering the essentials. This involves establishing a basic standard, ensuring that users achieve a green build when working with your framework.

2) Empowering with Strong Types: The second part focuses on the potential of strong types. We'll explore how they can effectively steer users towards correct usage.

3) Going Advanced with Custom Rules: Lastly, I'll teach you how to do something advanced but useful. You can create special checks for your framework using PHPStan. I'll give you examples from big frameworks like Symfony and Doctrine so you can see how it works.

By the end you'll have the knowledge you need to make sure your framework works great, and people love using it.

Delivered in English
Symfony room

Thursday, December 7, 2023 at 15:15 PM – 15:50 PM