PHP / Magento Dev Blog

  • Publikacje
  • O autorze
  • Kontakt

PHP 9.0 first RFCs – what gets removed, typed arrays discussion, timeline

by Henryk Tews / Tuesday, 03 February 2026 / Published in PHP

PHP 9.0 is a future major release that will remove all the deprecated features accumulated since PHP 8.0. The first RFCs are being discussed and voted on. Typed arrays are the most debated addition. I show what is confirmed for removal, what new features are in discussion, and a realistic timeline for when PHP 9.0 will matter for Magento projects.

Confirmed removals in PHP 9.0

<?php

// 1. Dynamic properties (deprecated in PHP 8.2)
class Product {}
$p = new Product();
// $p->extraField = 'value'; // TypeError in PHP 9.0
// Fix: declare properties or use #[AllowDynamicProperties]

// 2. Implicit nullable parameters (deprecated in PHP 8.4)
// function foo(string $x = null) {} // Error in PHP 9.0
// Fix: function foo(?string $x = null) {}

// 3. utf8_encode() and utf8_decode() (deprecated in PHP 8.2)
// utf8_encode($str) // Error in PHP 9.0
// Fix: mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1')

// 4. String interpolation with curly brace variables (deprecated in PHP 8.2)
// $name = "world"; echo "Hello ${name}"; // Error in PHP 9.0
// Fix: echo "Hello {$name}"; or echo "Hello $name";

// 5. Passing non-integer to array functions expecting int (deprecated in PHP 8.0)
// array_slice($arr, 1.5); // TypeError in PHP 9.0

// 6. Returning non-bool from comparison callbacks in usort (deprecated in PHP 8.0)
// usort($arr, fn($a, $b) => $a['x'] - $b['x']); // must return -1/0/1 or use <=>

Typed arrays – the big RFC debate

<?php

// What typed arrays COULD look like (RFC discussion, not confirmed):

// Option 1: array type hints with element types
function processOrders(Order[] $orders): void { }
// PHP currently accepts array, not array<Order>

// Option 2: Generic-style typed arrays
function processOrders(array<Order> $orders): void { }

// Challenges (why this is hard):
// 1. Runtime enforcement = O(n) type check on every call
// 2. array<Order> and array are not compatible for existing code
// 3. PHP arrays can have mixed integer and string keys
// 4. Covariance rules become complex

// Current workaround with PHPStan (zero runtime cost):
/** @param Order[] $orders */
function processOrders(array $orders): void { }
// PHPStan enforces Order[] at analysis time, no runtime overhead

// RFC status (Q1 2026): "discussing" - no vote date set
// Most likely outcome: typed arrays land in PHP 9.1 or 9.2, not 9.0

PHP 9.0 timeline and what it means for Magento

PHP release timeline (projected):
  PHP 8.5: November 2025 (released)
  PHP 8.6: November 2026 (projected)
  PHP 9.0: November 2026 or 2027 (TBD - major versions skip a year sometimes)

PHP 8.x support end dates:
  PHP 8.3: December 2026 (security only from November 2025)
  PHP 8.4: November 2027 (active support until November 2026)
  PHP 8.5: November 2028 (active support until November 2027)

What this means for Magento:
- No need to worry about PHP 9.0 for existing projects until 2028+
- Start Rector-based cleanup NOW to avoid technical debt
- Magento 2.4.x will almost certainly support PHP 8.5 and 8.6
- PHP 9.0 support for Magento will arrive 12-18 months after PHP 9.0 GA

Preparing your codebase now

# Automated PHP 9.0 preparation with Rector
composer require --dev rector/rector

# rector.php
# $rectorConfig->phpVersion(PhpVersion::PHP_90);
# $rectorConfig->sets([SetList::PHP_80, SetList::PHP_81, SetList::PHP_82, SetList::PHP_83]);

# Run analysis (dry-run first)
vendor/bin/rector process app/code/ --dry-run

# Most common Rector fixes:
# - AddDefaultValueForUndeclaredPropertyRector (dynamic properties)
# - NullToStrictStringFuncCallArgRector (null to built-in functions)
# - Utf8DecodeEncodeToMbConvertEncodingRector (utf8_encode/decode)
# - ExplicitNullableParamTypeRector (implicit nullable)

# PHPStan to catch what Rector misses:
vendor/bin/phpstan analyse app/code/ --level=8 --php-version=9.0

# Run both as CI checks on every PR - catch issues before they accumulate

Summary

PHP 9.0 is 1-2 years away and its scope is mainly cleanup of eight years of deprecations. The removals are not surprises – they have been deprecated with warnings since PHP 8.x. Start Rector cleanup now and add it as a CI check; the work done incrementally is a fraction of the effort of a big-bang migration. Typed arrays remain under discussion and will likely not land in 9.0. For Magento projects, PHP 8.5 is the current target; PHP 9.0 planning can wait until 2027.

About Henryk Tews

What you can read next

PHP 7.2 – object type hint, sodium instead of mcrypt, deprecations

© 2026 Created by

TOP
Zarządzaj zgodą
Aby zapewnić jak najlepsze wrażenia, korzystamy z technologii, takich jak pliki cookie, do przechowywania i/lub uzyskiwania dostępu do informacji o urządzeniu. Zgoda na te technologie pozwoli nam przetwarzać dane, takie jak zachowanie podczas przeglądania lub unikalne identyfikatory na tej stronie. Brak wyrażenia zgody lub wycofanie zgody może niekorzystnie wpłynąć na niektóre cechy i funkcje.
Funkcjonalne Always active
Przechowywanie lub dostęp do danych technicznych jest ściśle konieczny do uzasadnionego celu umożliwienia korzystania z konkretnej usługi wyraźnie żądanej przez subskrybenta lub użytkownika, lub wyłącznie w celu przeprowadzenia transmisji komunikatu przez sieć łączności elektronicznej.
Preferencje
Przechowywanie lub dostęp techniczny jest niezbędny do uzasadnionego celu przechowywania preferencji, o które nie prosi subskrybent lub użytkownik.
Statystyka
Przechowywanie techniczne lub dostęp, który jest używany wyłącznie do celów statystycznych. Przechowywanie techniczne lub dostęp, który jest używany wyłącznie do anonimowych celów statystycznych. Bez wezwania do sądu, dobrowolnego podporządkowania się dostawcy usług internetowych lub dodatkowych zapisów od strony trzeciej, informacje przechowywane lub pobierane wyłącznie w tym celu zwykle nie mogą być wykorzystywane do identyfikacji użytkownika.
Marketing
Przechowywanie lub dostęp techniczny jest wymagany do tworzenia profili użytkowników w celu wysyłania reklam lub śledzenia użytkownika na stronie internetowej lub na kilku stronach internetowych w podobnych celach marketingowych.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
Zobacz preferencje
  • {title}
  • {title}
  • {title}