Since working extensively on PHP at my company on a ever growing projet, I became increasingly interested in PHP's type system and everything it can do for us developer regarding bug discovery and prevention.
PHP's manual is excellent but the information about the type system can be found split overall in several pages so that it can be hard to get a whole picture.
Plus, beside PHP's type system itself, there are a lot of topics that are interesting to cover like static analysis and the various tools that enables it (like PHPDocs, static analysers themselves, other tools...).
So I decided to try compile all of theses information in one place and with a languge that looks natural/friendly to me (something that sometime lacks in the manual).
You can find these on my PHP Type System Github repository with the following table of content:
- PHP type system in depth
- Typing systems
- Typehint syntax
- Why use types ?
- Built-in typehints
- Numeric strings
- Union and intersection types
- Getting type information from a variable
- Comparing and juggling types
- Strict types
- Dealing with nulls
- Tools for static analysis
- References Various relevant links to the PHP manual, RFCs for all type related features over the years, and community links
I hope you will find it usefull and contribute to convince you to embrace that "modern" aspect of PHP (even if it really started with PHP7.0, already 7 years ago).
English isn't my first language and even if I practice it extensively through my work and hobbies (like movies), I known there is probably dozens of typos and weird sentences.
Feel free to ping me via email or Twitter if you spots fixes to make, or if you have relevant links to add to the references.
As is customary in Open Source, contributions via issues and PR are always welcomme.