0.6
PHPStan is on Patreon! You can show your support by backing PHPStan on Patreon. Choose your reward from different tiers and be a part of PHPStan's sustainable future development. I will deeply appreciate it. Thanks!
Major new features:
- Support for
{@inheritDoc}
above methods and properties - Check correct
$this
usage (level 0) - using$this
outside a class and in static context
Enhancements:
- Union iterable type (like
Foo[]|Collection
) is created on all rule levels. This helps for specifying iterated value in foreach. - Support for
isset()
andempty()
on static properties access throughstatic::
- Support for properties
isset()
andempty()
in ternary operator - Checking if there's a
parent
typehint without parent class Foo::class
is of type string, not mixed- Support for standalone
null
in phpDocs - Specifying types returned from
array_fill
andarray_fill_keys
- Support for
$foo instanceof static
- Types of variables defined before for/foreach/while loop scope are now combined with types assigned to those variables inside the loop. This prevents the need for annotating such variables with
/** @var */
when defining them. - Support negated instanceof in boolean condition (#81)
BC breaks for extension developers:
- Added
MethodReflection::getPrototype()
(because of #66)
Bugfixes:
- Fixed calling sibling method with prototype in common parent class (#66)
- Fixed checking protected and private class members from an anonymous class
- Fixed referencing
parent
in typehints - Fixes related to format parsing in
printf
and similar functions (#75, #85) - Fixed excluding for relative paths (#73)
- Instance method can be called statically from an instance method when in the same class or a child (a9649ed)
- Fixed is_null causing the expression to be null in other part of a binary operation in if and while loop condition (#81)
- Create
$http_response_header
in local scope afterfopen()
orfile_get_contents()
call - Universal object crates extension - do not crash on nonexistent class, skip it
- Properties missing in native PHP Reflection (like those on DateInterval or DOMDocument) are now recognized in child classes (#80)