Episode - https://laracasts.com/series/how-to-contribute-to-open-source/episodes/5
Let’s not worry about code structure, just build a solution.
Instead of creating new files, Luke creates the methods needed directly in the playground script. He does something similar:
1function steps() {2 return new class {3 public function add(Closure $step, Closure|false $revert = null) {4 ...5 }6 }7}
(I never considered before having a function returning an anonymous class.)
By running the playground script we keep getting errors until all the necessary methods are created (even if empty). This definitely looks like TDD.
Once all methods are implemented, that’s the time to create a new StepBuilder
class and dump in there the anonymous class.