Hello Internals of PHP, I’d like to get feedback on a potential language feature before considering whether it deserves an RFC.
Currently, PHP does not provide a general way to distinguish between: - a variable or property that has never been assigned, and - one that was explicitly assigned the value null. isset() treats both cases identically, property_exists() only reflects declarations, and ReflectionProperty::isInitialized() works only for typed properties and does not help differentiate explicit null from absence in the broader sense. There are workarounds involving reflection and string-based variable/property names, but these approaches rely on dynamic access, which is not ideal for developer experience, particularly regarding static analysis, IDE autocompletion, and refactoring safety. I’m interested in hearing whether there is openness to exploring a built-in mechanism that can reliably distinguish these states at the language level. At this point I’m only seeking initial feedback to understand whether this aligns with PHP’s direction, and whether it would be worth developing into a formal RFC. related issue: https://github.com/php/php-src/issues/20663 Thank you for your time. -- Hichem Taboukouyout. ------------------------------ Hichem Taboukouyout Full-stack Developer & Engineer in Industrial and Tertiary Systems (GSIT) 🌐 hichemtab-tech.me 💻 github.com/HichemTab-tech ✉️ [email protected] -- ────────────────────────── Hichem Taboukouyout Full-stack Developer & Engineer in Industrial and Tertiary Systems (GSIT) 📧 [email protected] <mailto:[email protected]> 🌐 hichemtab-tech.me <http://hichemtab-tech.me> LinkedIn: https://dz.linkedin.com/in/hichem-taboukouyout <https://dz.linkedin.com/in/hichem-taboukouyout> GitHub: github.com/HichemTab-tech <http://github.com/HichemTab-tech>
