phan v3.2.0 Release Notes
Release Date: 2020-08-25 // over 3 years ago-
๐ New features (CLI, Config):
โ Add the
minimum_target_php_version
config setting and--minimum-target-php-version
CLI flag. (#3939)
Phan will use this instead oftarget_php_version
for some backwards compatibility checks
๐ (i.e. to check that the feature in question is supported by the oldest php version the project supports).๐ง If this is not configured, Phan will attempt to use the composer.json version ranges if they are available.
Otherwise,target_php_version
will be used.Phan will use
target_php_version
instead ifminimum_target_php_version
is greater thantarget_php_version
.Update various checks to use
minimum_target_php_version
instead oftarget_php_version
.โ Add
--always-exit-successfully-after-analysis
flag.
0๏ธโฃ By default, phan exits with a non-zero exit code if 1 or more unsuppressed issues were reported.
When this CLI flag is set, phan will instead exit with exit code 0 as long as the analysis completed.Include the installed php-ast version and the php version used to run Phan in the output of
phan --version
. (#4147)๐ New features (Analysis):
Emit
PhanCompatibleArrowFunction
if using arrow functions with a minimum target php version older than php 7.4.Emit
PhanCompatibleMatchExpression
if using match expressions with a minimum target php version older than php 8.0.Emit
PhanNoopRepeatedSilenceOperator
for@@expr
or@(@expr)
.
This is less efficient and only makes a difference in extremely rare edge cases.Avoid false positives for bitwise operations on floats such as unsigned 64-bit numbers (#4106)
๐ Incomplete support for analyzing calls with php 8.0's named arguments. (#4037)
New issue types:PhanUndeclaredNamedArgument*
,PhanDuplicateNamedArgument*
,
PhanMissingNamedArgument*
,
PhanDefinitelyDuplicateNamedArgument
,PhanPositionalArgumentAfterNamedArgument
, and
PhanArgumentUnpackingUsedWithNamedArgument
,PhanSuspiciousNamedArgumentForVariadic
๐ Incomplete support for analyzing uses of PHP 8.0's nullsafe operator(
?->
) for property reads and method calls. (#4067)Warn about using
@var
where@param
should be used (#1366)Treat undefined variables as definitely null/undefined in various places
when they are used outside of loops and the global scope. (#4148)Don't warn about undeclared global constants after
defined()
conditions. (#3337)
Phan will infer a broad range of types for these constants that can't be narrowed.๐ Parse
lowercase-string
andnon-empty-lowercase-string
in phpdoc for compatibility, but treat them like ordinary strings.Emit
PhanCompatibleTrailingCommaParameterList
andPhanCompatibleTrailingCommaArgumentList
when the polyfill is used. (#2269)
Trailing commas in argument lists require a minimum target version of php 7.3+,
and trailing commas in parameters or closure use lists require php 8.0+.๐ This is only available in the polyfill because the native
php-ast
parser
๐ฆ exposes the information that php itself tracks internally,
and php deliberately does not track whether any of these node types have trailing commas.There are already other ways to detect these backwards compatibility issues,
such as--native-syntax-check path/to/php7.x
.Warn about variable definitions that are unused due to fallthroughs in switch statements. (#4162)
๐ Plugins:
- โ Add more aliases to
DeprecateAliasPlugin
Miscellaneous:
- ๐ Raise the severity of
PhanUndeclaredConstant
andPhanStaticCallToNonStatic
from normal to critical.
Undeclared constants will become a thrownError
at runtime in PHP 8.0+.
๐ Bug fixes:
- Suppress
PhanParamNameIndicatingUnused
in files loaded fromautoload_internal_extension_signatures
- ๐ Improve compatibility of polyfill/fallback parser with php 8.0
- Also try to check against the realpath() of the current working directory when converting absolute paths
to relative paths. - ๐ Generate baseline files with
/
instead of\
on Windows in--save-baseline
(#4149)
- โ Add more aliases to