Skip to content

Releases

phrost 0.1.6

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.

phrost 0.1.5

Choose a tag to compare

@github-actions github-actions released this 30 Nov 16:58
v0.1.5
61b527e
  • A variable written with ??= counts as read, since ??= keeps what the variable already holds. A
    memo -- static $parameters = []; return $parameters[$class] ??= ...; -- was reported as assigned
    and never read; Symfony's own source had eighteen of them.
  • A hook dispatched through a service held in an untyped property -- protected $moduleHandler;,
    assigned in the constructor, as Drupal code written before typed properties does it -- is no
    longer reported as dispatched by nothing.
    $this->moduleHandler->invokeAll('webhook_event_alter', [&$events]) made every implementation of
    hook_webhook_event_alter() read as code that never runs.

phrost 0.1.4

Choose a tag to compare

@github-actions github-actions released this 15 Nov 12:49
v0.1.4
5032947

mago -- the parser, linter and formatter underneath -- is 1.60.1, and so are the PHP stubs.

The type checker

  • The stubs know more of PHP 8.4 and 8.5: CurlSharePersistentHandle and
    curl_share_init_persistent(), ReflectionConstant's methods,
    opcache_is_script_cached_in_file_cache(), the Filter\FilterException family, and the optional
    parameters added to the ldap_*, openssl_* and grapheme_* functions -- ldap_bind($ldap)
    with one argument was reported as two short.
  • ArrayObject and ArrayIterator declare __serialize() and __unserialize(), which were
    reported as undefined, and the SPL classes take PHP 8's parameter names, which is what a named
    argument is checked against: ArrayObject::offsetGet($key),
    new RegexIterator($iterator, $pattern).
  • class_parents() of an object no longer returns false; only a class name it cannot load does.
  • $message and $code on Exception and Error are typed string and int, so a subclass that
    writes something else to them is reported: $this->code = 'HY000' in a RuntimeException.
    PDOException's $code stays int|string.
  • ctype_digit() no longer narrows its argument to numeric-string, as the stubs no longer say it
    does: a string it answers false for can still be numeric ("1.5").
  • A callable whose docblock return ends in [] keeps its return:
    @return callable(string): string[] was read as a bare callable, so what a call to it returned
    had no type.

The linter

  • Two new rules, for a project that asks for their category in phrost.toml:
    no-unused-return-value (redundancy) reports a private method whose result every call throws
    away, and prefer-null-coalescing-assignment (best practices) suggests $this->ids ??= $read()
    for $this->ids ?? ($this->ids = $read()).
  • literal-named-argument (clarity) looks at method and static calls as well as functions.

The formatter

  • Some files are laid out differently from 0.1.3: reprinting six projects, 290 of 17 554 files came
    out changed, 250 of them WordPress templates that mix HTML with <?php echo ... ?>. What moves is
    line breaks, trailing commas and where a trailing comment sits, not what the code does.

Building

  • phrost builds with Rust 1.100, which mago 1.60 requires; rust-toolchain.toml pins it.

phrost 0.1.3

Choose a tag to compare

@github-actions github-actions released this 10 Nov 22:52
v0.1.3
87fbb20
  • A variable completes again in Zed. $ap was answered with $app and the editor showed nothing:
    the item was sent to be filtered without its $, and Zed counts the $ as part of the word.
    Every variable and static property was affected, in 0.1.0 through 0.1.2.
  • Accepting a variable in a closure's use (...) no longer doubles the $: use ($al became
    use ($$alpha).
  • Of several classes with one short name, the one the name already means in the file -- by an
    import, or by the namespace the file is in -- is offered first. In a file with
    use RuntimeException;, new RuntimeE put the MongoDB extension's class ahead of PHP's and wrote
    its full path when accepted.
  • A completion that goes on from what is already typed replaces only the last word of it, so an
    editor that filters a list by the text an item replaces -- rather than by the word at the cursor,
    as Zed does -- no longer drops it: a use path (use App\Http\Resp), a name written from the
    root (new \RuntimeE) and a service id past its dot (service('application.ma')).
  • A name the file imports is offered ahead of the rest and is always in the list. The list is
    ordered project code first and cut at two hundred rows with no knowledge of the file's use
    lines, so Da under use Illuminate\Support\Facades\Date; offered two hundred other names and
    not Date, and a function brought in with use function stood behind classes of the same name.
  • A class completed in a docblock is written the way the file's docblocks already write one. It was
    always written from the root -- @param \WP_Post, @throws \App\Lock\LockException beside a
    use line for that class -- which is Drupal's and Laravel's convention and nobody else's. A file
    whose docblocks name classes as its code does now gets the name its code would write, and a file
    that writes them from the root, or has named none yet, is completed as before.
  • A docblock's type position offers the template parameters and type aliases in scope: @return TVa
    under a class's @template TValue offered every class that began that way and not TValue.
  • A type in a docblock goes on past the space after a callable's colon and the spaces some write
    round a |: @param callable(TValue, TKey): TMap and @return string | Tra offered nothing.
  • The enclosing class's own name before ::, or an ancestor's, offers instance methods as self::
    and parent:: do: Base::__construct($id) in a subclass, PclZip::privErrorLog(...) inside
    PclZip. Only static members and constants were offered.
  • Renaming a property or a method also renames the @property or @method tag that documents it on
    the same class, and find-references lists the tag. @property-read string $scheme above a
    declared protected $scheme was left naming the old property.
  • phrost check no longer reports on code a framework keeps outside vendor/ when it is committed
    beside the project's own -- Drupal's core and contributed modules in a site that commits them. The
    editor never checked them and the command line did, so CI and the editor disagreed by tens of
    thousands of findings on such a checkout.
  • A class is not imported a second time under a name a use line already holds. Where the file's
    own import named a class the project cannot see -- a dependency that is not installed -- accepting
    a namesake added a second use for the same name, which PHP refuses to load. It is written with
    its full path instead, and the "Import" quick fix is not offered.
  • setrawcookie() takes its options array: setrawcookie($name, $value, ['expires' => $at]) was
    reported as an array given for an int, because the stubs declared the function's two forms
    separately and only the first was read.

phrost 0.1.2

Choose a tag to compare

@github-actions github-actions released this 10 Nov 18:25
v0.1.2
a228a83

The linter

  • printf, sprintf and fprintf given an unpacked value -- printf('%s %d', ...$row) -- are no
    longer reported as missing arguments, and a call that really is short says how many values it was
    given rather than repeating how many it needs.
  • A deprecation raised the way Symfony and Drupal ask for it,
    @trigger_error('...', E_USER_DEPRECATED), is no longer reported as an unsafe use of @. Every
    other silenced call still is. In Drupal core that was 368 of the rule's 483 findings.
  • The deprecation rules that need PHP 8.1 or later run: an implicitly nullable parameter, a class
    named _, (integer) and the other long casts, a case ended by a semicolon, the backtick
    operator, a reference returned from a void function. They never had, because the linter was told
    no PHP version and took 8.0. A deprecation is shown as a warning, and a rule that advises newer
    syntax follows the oldest PHP composer.json requires.
  • assert-description and sensitive-parameter are reported only where a project names them in
    phrost.toml: the first objects to assert($x instanceof T), which the type checker narrows
    through, and the second decides by a parameter's name.
  • strict-behavior asks base64_decode for strict decoding, where it said strict comparison.

The type checker

  • A method an extension overloads, or declares differently for the library it was built against,
    takes every form the extension does: Imagick::convolveImage() with a kernel object or a matrix,
    setImageBluePrimary() and its siblings with two coordinates or three, IntlCalendar::set() with
    a field and a value or a whole date. The stubs declared each twice and only the last counted, so
    the other form was reported as a wrong or an extra argument.

Faster

  • Diagnostics for a file of define() calls, or any long run of calls taking literals: a 3317-line
    stub file went from 145 ms to 6 ms.
  • Code actions in a file naming classes nothing declares, which is every file of a project before
    composer install: at a cursor in Laravel's own tests, p95 from 1 489 ms to 19 ms.
  • A value handed to hundreds of calls in one function: 800 calls, from 335 ms to 53 ms.

phrost 0.1.1

Choose a tag to compare

@github-actions github-actions released this 09 Nov 10:46
v0.1.1
0093010
  • Less memory on macOS: mimalloc is the process's allocator under lspkit_heap::Heap, so what the
    parser frees leaves the process. On a 29 094-file Drupal checkout the server after bootstrap went
    from 170 MB to 151-156 MB, and with 20 files open from 178 MB to 164-170 MB, with request
    latencies unchanged. Linux keeps glibc.
  • phrost perf reads its memory figure after the release the server does at the end of bootstrap,
    and on macOS reports the footprint, which is what the machine gives up, rather than ps's
    resident set, which never falls there.

phrost 0.1.0

Choose a tag to compare

@github-actions github-actions released this 06 Nov 21:37
v0.1.0

The first release.

The language server, phrost serve, over stdio, for Zed, Neovim, Helix, Claude Code and any
other LSP client:

  • go to definition, declaration, type definition and implementation; find references; document
    highlight; call and type hierarchy; document and workspace symbols;
  • completion of members, names, array keys and docblock tags, with commit characters; signature
    help; hover with rendered docblocks; inlay hints;
  • rename, including moving a file together with the namespace it declares; code actions for imports,
    docblock updates and quick fixes, and source.fixAll;
  • semantic tokens, folding and selection ranges, and formatting in PER-CS, PSR-12, Laravel Pint,
    Tempest, hackfmt and Drupal styles;
  • diagnostics as you type, and for the whole project in the background.

What it checks: undefined classes, functions and members; argument, return and property type
mismatches; strict null and false safety, where ?T given for a T is reported on purpose;
unhandled match cases; missing @throws; unused variables, imports and declarations; and mago's
linter for style, safety and correctness.

Types: @template with bounds and defaults, @extends, @implements and @use, conditional
@return types, class-string<T>, array shapes and lists, @phpstan-type aliases, @mixin,
@phpstan-assert*, @param-closure-this, and narrowing through guards and assertions. On the
php-typing-conformance suite it passes more cases than PHPStan, phpantom, Mago, Psalm and
intelephense.

Frameworks, each behind its own contributor, none named by the generic code:

  • Drupal: the service container, entity types and their fields, routes, hooks, form element keys,
    plugin annotations and attributes, *.info.yml namespaces, Twig templates, and a core installed
    outside vendor/;
  • Laravel: Blade templates, Eloquent relations, accessors, casts and scopes, dynamic wheres, the
    container's aliases, facades, translations, factories, console signatures and Livewire;
  • Symfony and Laravel through their own generics; PHPUnit, Mockery and Pest as they behave at
    runtime.

Fast and lean. On a production Drupal checkout of about 30 000 files, a cold server is ready in
about 2 s at about 195 MB, and goto, hover and completion answer in well under 1 ms at the 95th
percentile. Memory follows the project's own code, not vendor/.

The command line: phrost check runs every diagnostic over a project as CI would, and
--ratchet fails only when a count rises above a phrost-baseline.toml beside it. index,
coverage, query and perf show what is indexed, how much resolves, what an editor would see at
a position, and what each request costs.