Skip to content

Mago 1.60.2

Latest

Choose a tag to compare

@github-actions github-actions released this 16 Nov 02:28
1.60.2
3de548f

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 null or false failure result of preg_* calls with literal patterns. (#2723, 0aa1f13)

🐛 Bug Fixes

Analyzer

  • Loose comparisons: keeps loosely equal scalars, such as int and float, when narrowing == and !=. (#2716, #2730, 82ce437)
  • is_subclass_of(): narrows a class-string checked against an unrelated interface to an intersection, not never. (#2724, 38eaee5)
  • is_array() on iterables: keeps class-string keys when narrowing an iterable to an array. (a68b39b)
  • Psl\Iter\contains(): narrows like strict in_array(), so false only 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-scope in 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 null keys into '' in nested writes, as PHP does. (#2720, 48644ac)
  • Null index messages: adds the missing space before of variable in 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 $code property of the exception and its subclasses. (3cca74e)
  • Number casts: allows (int) and (float) casts of SimpleXMLElement and GMP. (#2721, c46fc88)
  • Property reads on never: keeps never when reading a property of a never value. (8246d77)
  • Superglobals: types APP_DEBUG in $_ENV and $_SERVER as a string, so proc_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 in includes unknown. (#2722, e6350fd)
  • Class-string comparisons: ignores type arguments, so ArrayIterator::class fits class-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, nullable Iterator returns, and WeakReference variance. (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:

Full Changelog: 1.60.1...1.60.2