Recently I set up GitHub sponsors, if my content helps you, you can consider a one-time or monthly sponsorship.

PHP 8.2 in 8 code blocks

This is where the ad would go. Instead though, I'd like to point you towards my GitHub Sponsors page. If you're a regular reader and my content is helping you, you can consider a one-time or monthly sponsorship. If you're a company looking for dedicated ad placements on this blog or my newsletter, you can email me at

readonly class PostData
    public function __construct(
        public string $title,
        public string $author,
        public string $body,
        public DateTimeImmutable $createdAt,
        public PostState $state,
    ) {}

Readonly classes

$rng = $is_production
    ? new Random\Engine\Secure()
    : new Random\Engine\Mt19937(1234);
$randomizer = new Random\Randomizer($rng);


New random extension

function alwaysFalse(): false
    return false;

null, true, and false as standalone types

function generateSlug((HasTitle&HasId)|null $post) 
{ /* … */ }

Disjunctive Normal Form Types

trait Foo 
    public const CONSTANT = 1;
    public function bar(): int 
        return self::CONSTANT;

Constants in traits

function connect(
    string $user,
    #[\SensitiveParameter] string $password
) {
    // …

Redacted parameters

class Post {}

$post = new Post();

$post->title = 'Name';

// Deprecated: Creation of dynamic property is deprecated

Deprecated dynamic properties

enum A: string 
    case B = 'B';
    const C = [self::B->value => self::B];

Enum properties in const expressions