Skip to content

Mago 1.63.0

Latest

Choose a tag to compare

@github-actions github-actions released this 03 Dec 23:54
1.63.0
3d867d0

Mago 1.63.0 gives checks that only a docblock type makes redundant or impossible their own issue codes, and fixes 35 bugs, most of them in the PHP stubs, the semantics checks, and the parser. Many stub fixes record the PHP version that added a symbol, so Mago now reports its use on older versions. Update pragmas and baselines that name the old codes for these checks.

✨ Features

Analyzer

  • Docblock-only checks: reports a check that only a docblock type makes redundant or impossible under its own code. (3a71664)

docblock-type-contradiction replaces impossible-condition, impossible-type-comparison, impossible-null-type-comparison, impossible-key-check, impossible-nonnull-entry-check and no-value for these checks. redundant-condition-given-docblock-type replaces redundant-condition, redundant-comparison, redundant-type-comparison and similar codes. Each report notes that PHP does not check docblock types at runtime.

🐛 Bug Fixes

Analyzer

  • Missing type hints: no longer asks for a native hint that PHP cannot express, such as a resource or a callable property. (eee20d2)
  • isset() on objects: narrows an object to ArrayAccess when an isset() check on one of its offsets passes. (3d14c32)
  • Magic properties: skips non-documented-property when __get() or __set() gives the property a type. (fba7a28)
  • defined() checks: a defined() check removes the unavailable-constant report for the constant it guards. (#2874, #2875, f25cfba)
  • Extension signatures: reports a missing method in a first-class callable when an extension provides signatures. (#2914, #2915, b01b12d)

Codex

  • Variadic callables: accepts a callable with a variadic parameter where one with fewer parameters is expected. (#2903, #2906, a3a40d5)
  • Generic first-class callables: binds templates nested in an iterable parameter. (#2856, 6374b02)

Prelude

  • Functions and constants: marks 10 functions and 27 constants that PHP 8.1 to 8.5 added with their versions. (#2866, #2867, d8766a5)
  • Class members: marks 14 members that PHP 8.1 to 8.5 added to existing classes with their versions. (#2868, #2869, 81a9678)
  • Date symbols: marks the date symbols that PHP 8.2, 8.3 and 8.4 added with their versions. (#2861, #2862, 19bc90e)
  • Reflection members: marks the members that PHP 8.1, 8.2 and 8.4 added, and corrects two versions. (#2863, #2864, 31269b6)
  • PHP 8.6 reflection: adds the new ReflectionAttribute and ReflectionParameter methods. (#2870, #2871, 8518b2b)
  • nl_langinfo() constants: marks the constants that PHP has only from 8.2 on with their version. (#2872, #2873, 49316be)
  • curl symbols: marks the symbols PHP 8.1 to 8.5 added, CURLStringFile among them, and corrects 17 versions. (#2904, #2905, 9384719)
  • OpenSSL constants: marks the constants that PHP 8.3 to 8.5 added, and corrects four versions. (#2919, #2920, 4947d1a)
  • Sodium symbols: marks the Ristretto255 and XChaCha20 symbols that PHP 8.1 added. (#2921, #2922, 4aaf7b4)
  • Removed symbols: marks the symbols that PHP 8.0 removed, and drops two members that PHP does not have. (#2859, #2860, 2cb4a26)
  • OpenSSL parameters: accepts PEM strings as certificates, and the key openssl_csr_new() fills by reference. (#2857, #2858, 4d59504)
  • Phar: PharData no longer extends Phar, and OPENSSL_SHA* values and inherited method types match PHP. (#2885, #2886, 3be8369)
  • mb_parse_str(): accepts any variable as the $result argument, as PHP does. (#2887, #2888, c3c8279)
  • curl_multi_exec(): makes the $still_running argument required, as PHP does. (#2889, #2890, 582eec0)
  • Reflection constants: fixes the values of ReflectionClass::SKIP_* and ReflectionClassConstant::IS_FINAL. (#2901, #2902, 3b2aae2)
  • curl constants: gives four curl constants the values PHP uses. (#2912, #2913, 2faa294)
  • stream_context_get_options(): types the options it returns as array<string, array<string, mixed>>. (dc4dc0e)

Formatter

  • Single named arguments: always-break-named-arguments-list now breaks a call with a single named argument. (#2665, #2694, 93e3a1c)

Linter

  • braced-string-interpolation: its fix keeps the meaning of "${name}" and "$$name". (#2877, #2878, eab52a6)

PHPDoc Syntax

  • Callable type aliases: parses prefixed callable type aliases, such as @phpstan-type, with named parameters. (#2809, #2810, 01d9d7d)

Semantics

  • final property hooks: reports a property hook with more than one final modifier. (#2893, #2894, 098edb8)
  • Asymmetric visibility: reports an untyped property with asymmetric visibility. (#2897, #2898, e439b73)
  • Readonly promoted properties: reports an untyped readonly promoted property. (#2899, #2900, af32687)
  • #[\NoDiscard]: reports it on a constructor, a void magic method, or a property hook. (#2895, #2896, 22bdba0)
  • never as a class name: reports never as the name of a class-like from PHP 8.1 on. (#2907, #2908, 8b67d3a)

Syntax

  • enum as a name: parses a leading enum as a name when no enum name follows, as in Enum::create(). (#2876, #2879, 11ec1a0)
  • Property hook modifiers: parses modifiers before &, as in final &get, as PHP does. (#2891, #2892, 3438bd8)
  • Heredoc indentation: reports a heredoc or nowdoc body line that lacks the closing marker's indentation. (#2909, #2910, d703abe)

🏗️ Internal

CI

  • PGO builds: stops building macOS x86 binaries with profile-guided optimization. (92a38fd)
  • Fuzz workspaces: seeds the fuzz workspaces with the root lockfile. (52d80e2)

🧩 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.62.0...1.63.0