linting

  • Typed properties and the constructor that got shorter

    7.4 landed on 28 November and the docblock is no longer the only type. Uninitialised is a new state, and arrow functions remove the use() clause.

  • The null coalescing assignment operator

    Setting a default only when a key is missing was $a[‘k’] = $a[‘k’] ?? $v;, which evaluates the subscript twice and reads as a statement about itself. The…

  • A baseline is what makes static analysis adoptable

    0.12 shipped in December and the ignoreErrors list can be deleted. A generated debt register, a ratchet that only shrinks, and a level to stop at.

  • Nullish coalescing is not the same as a logical or

    || falls through for every falsy value, so a default applied with it overrides a legitimate zero, an empty string and false. The third line is the one…

  • unknown is the type any should have been

    any switches the compiler off for that value and everything derived from it. unknown accepts anything and permits nothing until it has been narrowed. JSON.parse returns any, which…

  • TypeScript on a JavaScript codebase, one file at a time

    3.7 shipped optional chaining in November and the objection got smaller. allowJs, checkJs and a per-file opt-in — and strictNullChecks, which is the flag that pays.

  • is_countable before you call count

    Since 7.2 count() warns on anything that is not an array or Countable, and the guard everybody wrote by hand is now in the standard library. A generator…

  • Flexible heredoc finally indents like the code around it

    A heredoc closing marker had to sit at column zero, so a query or a template inside a method broke the indentation of the entire file and every…

  • Declaring a module for a library with no types

    A JavaScript dependency without types is an implicit any, and under noImplicitAny it is a compile error — so the choice is a declaration or a suppression. Describing…

  • Laravel 6 adopted semver, and the upgrade got boring

    5.8 to 6.0 is a smaller change than 5.7 to 5.8 was, which is the point. What semver means for a framework, and what LTS actually promises.