The Phan 3.x release line uses php-ast
's AST version 70 and supports the analysis of all PHP 8.0 syntax except attributes (when run with PHP 8).
The planned 4.x release line will use AST version 80 and require php-ast
1.0.10+ in order to parse/analyze PHP 8.0's #[]
attributes
New features (CLI, Config):
- Add
light_high_contrast
support for--color-scheme
. (#4203)
This may be useful in terminals or CI web pages that use white backgrounds.
New features (Analysis):
-
Infer that
parent::someMethodReturningStaticType()
is a subtype of the current class, not just the parent class. (#4202) -
Support phpdoc
@abstract
or@phan-abstract
on non-abstract class constants, properties, and methods
to indicate that the intent is for non-abstract subclasses to override the definition. (#2278, #2285)
New issue types:PhanCommentAbstractOnInheritedConstant
,PhanCommentAbstractOnInheritedProperty
,PhanCommentOverrideOnNonOverrideProperty
For example, code using
static::SOME_CONST
orstatic::$SOME_PROPERTY
or$this->someMethod()
may declare a placeholder@abstract
constant/property/method,
and use this annotation to ensure that all non-abstract subclasses override the constant/property/method
(if using real abstract methods is not practical for a use case) -
Warn about
@override
on properties that do not override an ancestor's property definition.
New issue type:PhanCommentOverrideOnNonOverrideProperty
.
(Phan already warns for constants and methods)
Plugins:
- Emit
PhanPluginUseReturnValueGenerator
for calling a function returning a generator without using the returned Generator. (#4013)
Bug fixes:
- Properly analyze the right hand side for
$cond || throw ...;
(e.g. emitPhanCompatibleThrowException
) (#4199) - Don't infer implications of
left || right
on the right hand expression when the right hand side has no side effects. (#4199) - Emit
PhanTypeInvalidThrowStatementNonThrowable
for thrown expressions that definitely aren't\Throwable
even whenwarn_about_undocumented_throw_statements
is disabled or the throw expression is in the top level scope. (#4200) - Increase the minimum requirements in composer.json to what Phan actually requires. (#4217)