New Features(CLI):
- Support using
directory_suppressions
in Phan baseline files in--load-baseline
. (#3698) - Improve error message for warnings about Phan being unable to read files in the analyzed directory.
New Features(Analysis):
-
Instead of failing to parse intersection types in phpdoc entirely, parse them as if they were union types. (#1629)
The annotations@phan-param
,@phan-return
,@phan-var
, etc. can be used to override the regular phpdoc in the various cases where this behavior causes problems.Future Phan releases will likely about unsupported phpdoc (e.g.
int&string
) and have actual support for intersection types. -
Emit
PhanUndeclaredConstantOfClass
(severity critical) for undeclared class constants instead ofPhanUndeclaredConstant
(severity normal)
This should not be confused withPhanUndeclaredClassConstant
, which already exists and refers to accessing class constants of classes that don't exist. -
Emit the expression that's an invalid object with issue types such as
PhanTypeExpectedObject*
,PhanTypeInvalidInstanceof
(#3717) -
Emit
PhanCompatibleScalarTypePHP56
andPhanCompatibleAnyReturnTypePHP56
for function signatures whentarget_php_version
is'5.6'
(#915)
(This also requires thatbackward_compatibility_checks
be enabled.) -
Use more accurate line numbers for warnings about function parameters.
-
When
assume_real_types_for_internal_functions
is on and a function has a non-empty return type in Reflection,
make Phan's known real type signatures override the real reflection return type information (useful when Phan inferslist<string>
and Reflection saysarray
).
Phan previously used the type from Reflection. -
Normalize phpdoc parameter and return types when there is a corresponding real type in the signature. (#3725)
(e.g. convertbool|false|null
to?bool
)
Plugins:
- Add
SubscribeEmitIssueCapability
to detect or suppress issues immediately before they are emitted. (#3719)
Bug fixes:
- Don't include issues that weren't emitted in the file generated by
--save-baseline
(#3719) - Fix incorrect file location for other definition in
PhanRedefinedClassReference
under some circumstances. - Fix incorrect issue name:
PhanCompatibleNullableTypePHP71
should be namedPhanCompatibleObjectTypePHP71
- Fix false positive
PhanPartialTypeMismatchProperty
when a php 7.4 typed property has a default expression value (#3725)