05 Jan 2019, Phan 1.2.0
New features(Analysis):
$matches for a wider range of regexes (e.g. non-capturing groups, named subgroups) (#2294)__invoke.callable types. (#2264)Support @phan-assert, @phan-assert-true-condition, and @phan-assert-false-condition.
Examples of side effects when this annotation is used on a function/method declaration:
@phan-assert int $x will assert that the argument to the parameter $x is of type int.
@phan-assert !false $x will assert that the argument to the parameter $x is not false.@phan-assert !\Traversable $x will assert that the argument to the parameter $x is not Traversable (or a subclass)@phan-assert-true-condition $x will make Phan infer that the argument to parameter $x is truthy if the function returned successfully.@phan-assert-false-condition $x will make Phan infer that the argument to parameter $x is falsey if the function returned successfully.See tests/plugin_test/src/072_custom_assertions.php for example uses of these annotations.
+ Suggest typo fixes when emitting PhanUnusedVariable, if only one definition was seen. (#2281)
+ Infer that new $x is of the template type T if $x is class-string<T> (#2257)
Plugins:
Add PHPUnitAssertionPlugin.
This plugin will make Phan infer side effects from some of the uses of the helper methods PHPUnit provides within test cases.
Infer that a condition is truthy from assertTrue() and assertNotFalse() (e.g. assertTrue($x instanceof MyClass))
assertNull() and assertNotNull()$actual from assertInstanceOf(MyClass::class, $actual)$actual has the exact type of $expected after calling assertSame($expected, $actual)Bug fixes:
\Exception->message) are protected (#2283)30 Dec 2018, Phan 1.1.10
New features(Analysis):
PhanUndeclaredConstant issue messages about undeclared global constants, if possible. (#2240)
Suggestions include other global constants, variables, class constants, properties, and function names.continue and break with no matching loop/switch scope. (#1869)
New issue types: PhanContinueOrBreakTooManyLevels, PhanContinueOrBreakNotInLoopcontinue statements targeting switch control structures (doing the same thing as a break) (#1869)
New issue types: PhanContinueTargetingSwitcharray<TKey,\someType> when @template TKey is in the class/function-like scope.Phan can now infer template types from even more categories of parameter types in constructors and regular functions/methods. (#522)
infer T from Closure(T):\OtherClass and callable(T):\OtherClass
T from array{keyName:T}TKey from array<TKey,\OtherClass> (as int, string, or mixed)Bug fixes:
@template annotations are parsed on classes and function-likes to avoid various edge cases (#2253)Updates may require up to 24 hours to propagate to mirrors. If the following command doesn't work, please retry later:
sudo dnf upgrade --refresh --advisory=FEDORA-2019-d6ff22e1c7
Please log in to add feedback.
This update has been submitted for testing by remi.
This update has obsoleted phan-1.1.10-1.fc28, and has inherited its bugs and notes.
This update has been pushed to testing.
This update has reached 7 days in testing and can be pushed to stable now if the maintainer wishes
This update has been submitted for batched by remi.
This update has been submitted for stable by bodhi.
This update has been pushed to stable.