International PHP Conference |
May 25 – 29, 2020 in Berlin

Getting the most out of PHPStan

Workshop
This talk originates from the archive. To the CURRENT program
Until February 6: ✓ Workshop Day for free ✓ Group discount ✓ Save up to € 700 Register now

More talks in the program:

Infos
Friday, October 25 2019
09:00 - 17:00
Booking note:
PHPStan Workshop
PHPStan is to PHP what the compiler is to Java. Java compiler won’t let you run a program with an obvious error like accessing an undefined variable or calling a method with wrong number of arguments. But PHP is very forgiving which is why you will find out about these obvious errors when you or users of your app execute the line of code with the error.
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.

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

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.

Stay tuned!

Behind the Tracks of IPC

PHP Core Technology
Best Practices & Application

General Web Development
General Web Development & more

Agile & Company Culture
Agility has become mainstream

Software Architecture
Concepts & Environments

Security
All about Web Security

Testing & Test Driven Development
An overview of the most important topics

DevOps & Continuous Delivery
DevOps is a philosophy

Docker, Kubernetes, Cloud
An overview of the most important topics

#slideless (pure coding)
An overview of the most important topics

PHP Frameworks
An overview of the most important topics

Content Management Systems
An overview of the most important topics