When PHP meets FP 🚀🚀🚀🌚

What is Functional Programming?

  • Pure functions: The concrete input will produce always the same output.
  • Recursion: There are no loops. In order to get this approach, the functions can call themselves using recursivity.
  • Functions are First-Class: A function is treated as a variable, which means you can pass functions as function arguments.
  • Variables are immutables: A variable cannot change its value once it is declared, but it’s possible to create new ones.

Imperative vs Declarative


Practical examples of immutability in PHP

Mutability examples and their impacts

<?php declare(strict_types=1);final class ProductTransfer
{
public function __construct(
public string $name,
public float $price,
public array $tags,
public \DateTime $releaseDate,
) {}
public function toString()…


Being up-to-date and avoiding conflicts

  • Fork the repository into your account.


Dummy, Stub, Spy, Mock or Fake

Test Doubles

The five types of Test Doubles are:


It causes bugs when refactoring due to the highly coupling


1.- What is a test?

  • Unit test
  • Component test
  • Integration test
  • System test
  • Smoke test
  • Compatibility test
  • Security test
  • Stress test
  • Usability test

2.- Differences between test types

Unit test

Jesus Valera Reales

Competitive, entrepreneur and autodidact. Hard worker, lover of technology and free software.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store