Repository navigation
Mago 1.60.2 stops reporting the failure results of PCRE calls with literal patterns, and fixes 22 bugs in the analyzer, type system, stubs, semantics checks, and Twig formatter.
✨ Features
Analyzer
- PCRE results: stops reporting the
nullorfalsefailure result ofpreg_*calls with literal patterns. (#2723, 0aa1f13)
🐛 Bug Fixes
Analyzer
- Loose comparisons: keeps loosely equal scalars, such as
intandfloat, when narrowing==and!=. (#2716, #2730, 82ce437) is_subclass_of(): narrows aclass-stringchecked against an unrelated interface to an intersection, notnever. (#2724, 38eaee5)is_array()on iterables: keepsclass-stringkeys when narrowing an iterable to an array. (a68b39b)Psl\Iter\contains(): narrows like strictin_array(), sofalseonly rules out values the haystack surely holds. (#2728, c58dd15)- Static properties: forgets narrowed static properties after a static call that can change them. (#2718, 610a5aa)
- Foreach keys: writes every key a foreach over a literal list supplies, so later reads are not possibly undefined. (#2729, 23874a7)
- Foreach references: stops reporting
reference-reused-from-confusing-scopein nested foreach loops by reference. (#2726, e97e902) - Keys after loops: keeps keys optional after an always-entered loop unless the loop added them. (35ac751)
- Nested array writes: turns
nullkeys into''in nested writes, as PHP does. (#2720, 48644ac) - Null index messages: adds the missing space before
of variablein null array index messages. (0332a90) - Runtime classes: treats
get_class($object)::and$object::class::like$object::, so interfaces no longer warn. (#2725, bce958d) - Spread arguments: stops reporting too few arguments when spreading an array of unknown size. (7328ebf)
- Exception codes: types
getCode()from the$codeproperty of the exception and its subclasses. (3cca74e) - Number casts: allows
(int)and(float)casts ofSimpleXMLElementandGMP. (#2721, c46fc88) - Property reads on
never: keepsneverwhen reading a property of anevervalue. (8246d77) - Superglobals: types
APP_DEBUGin$_ENVand$_SERVERas a string, soproc_open()accepts$_ENV. (#2715, f9de5b2)
Codex
- Inherited return docblocks: expands constant references before narrowing an inherited
@return, keeping its scalars. (#2727, 21b4e54) - Vendored classes: a
class_alias()call no longer makes types from classes inincludesunknown. (#2722, e6350fd) - Class-string comparisons: ignores type arguments, so
ArrayIterator::classfitsclass-string<ArrayIterator<K, V>>. (14c3548)
Prelude
- MongoDB: matches the MongoDB stubs to version 2.5.7 of the driver. (969e149)
- Core stubs: fixes
call_user_func()callbacks,stat()keys, nullableIteratorreturns, andWeakReferencevariance. (969e149)
Semantics
- Magic method types: reports declared types of magic methods that PHP rejects, such as
__toString(): ?string. (#2713, #2714, 777d2b4)
Twig Formatter
- Hugged last arguments: hugs a last hash or array argument that spans several lines instead of breaking the call. (#2731, a1c2cc3)
🧩 Extension Protocol
No protocol changes in this release.
🙏 Thank You
Contributors
Thank you to everyone who contributed to this release:
Issue Reporters
Thank you to everyone who reported issues that shaped this release:
- @bendavies: #2724, #2725, #2726, #2727, #2728, #2729, #2731
- @kamil-tekiela: #2720, #2721, #2722
- @mathroc: #2718
- @mytskine: #2723
- @thunderer: #2713
- @UweOhse: #2715, #2716
Full Changelog: 1.60.1...1.60.2