Skip to content

phrost 0.1.6

Latest

Choose a tag to compare

@github-actions github-actions released this 02 Dec 02:38
v0.1.6
c1b05ee

mago -- the parser, linter and formatter underneath -- is 1.62.0. The PHP stubs stay at 1.60.1:
bringing them forward is a step of its own.

The type checker

  • A docblock that adds a shape to a class reads the properties the shape names:
    @var Transaction&object{commits: int, rollbacks: int} on private Transaction $transaction, the
    way a test types a double that extends the class and counts what it was asked. Both were reported
    as undefined properties, because the native hint won over the docblock and a shape was read only
    where no class was named. The same holds for a @param. Symfony's own tests write the idiom: five
    false findings go there.
  • decimal-int-string, non-decimal-int-string, non-empty-scalar, callable-array and
    callable-object are types -- string, the scalar union, and callable -- where they read as
    class names nobody declares and silenced every check that met one. WordPress writes
    decimal-int-string in nineteen files, and now gets the findings its declared types imply.
  • Two refinements of one string written as an intersection are the stronger of them:
    non-empty-string&non-decimal-int-string is a non-empty-string. Kept as an intersection, a
    str_replace() on one answered string|array.
  • A WordPress hash on a tag other than @return, or one that never closes, says array where it
    said nothing.

The linter

  • WordPress's hash notation -- @type string $key Description. inside { } -- is no longer an
    invalid docblock: under --lint all, valid-docblock on WordPress falls from 1 180 to 6.
  • literal-named-argument (clarity) looks at function calls only again, as before 0.1.4.

The formatter

  • A method chain broken by hand inside an argument list, an assignment or a condition is laid out
    differently: the enclosing list breaks and the chain is indented under it, where 0.1.5 left it
    hugged in place. Reprinting four projects, 22 of 29 076 files change, 20 of them in Drupal core,
    and only in line breaks and indentation.