Are you looking for a software engineer? Perfect: I am looking for a job!
Contact me and let's see what awesome things we can build together!

Write documentation as tests in PHP using Rusty

Languages such as Python, Rust, etc. provide a way to write code samples right inside doc-strings. They are supposed to be easy to read and they are called “documentation as tests” because they also can be executed.

I thought that it was a great way to ensure that your documentation is up-to-date with your code so I searched a way to do the same in PHP… but I could not find anything.

And Rusty was born.

Rusty is an attempt at implementing the “documentation as tests” idea in the PHP world. It already is able to extract code samples from both PHP doc-blocks and Markdown files (your documentation for instance).

I set up Rusty in RulerZ’s Ci process and it found a few mistakes in the documentation so there is a chance that even in the PHP world were nothing is compiled, documentation as tests could be beneficial.