Skip to content

0.6.9

Choose a tag to compare

@dereuromark dereuromark released this 11 Oct 15:10
· 5 commits to master since this release
0b84fec

Fixes

Three autofixes turned valid code into something broken or wrong (#84).

  • PhpCollective.PHP.PreferCastOverFunction no longer rewrites first-class callables. strval(...) is not a call and has no cast equivalent, but the fixer produced a parse error:

    array_map(strval(...), $names);
    // became
    array_map((string)(...), $names);

    The callable form is now left alone.

  • PhpCollective.Commenting.DocBlockParamAllowDefaultValue accepts narrowed array types. non-empty-array<...>, non-empty-list<...> and a bare list were not recognized as covering an array typehint, so the fixer appended |array to the param type.

  • PhpCollective.Commenting.DocBlockThrows resolves names against the current namespace. A class from the same namespace was annotated as a global one:

    namespace App;
    
    throw new LocalException();
    // added: @throws \LocalException
    // now:   @throws \App\LocalException

    Names without an import are resolved against the namespace the method sits in, which also covers files with several namespace blocks.

    Behavior change: a qualified relative name such as throw new Sub\NestedException() was skipped before. It is now detected and reported like any other missing throws tag, so a run may show new findings for those.

Full Changelog: 0.6.8...0.6.9