This repository was archived by the owner on Sep 26, 2024. It is now read-only.
Update dependency phan/phan to v5#5
Open
text-html-renovate[bot] wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^3.1->^5.0Release Notes
phan/phan (phan/phan)
v5.4.5: supporting PHP 7.0-8.2 syntaxCompare Source
New features(Analysis):
PhanDeprecatedImplicitNullableParamfor uses of implicitly nullable parameters (int $x = nullinstead of?int $x = null). These can be fixed automatically via the accompanying IssueFixer. #4875New features(CLI, Configs):
Add
override_return_typesto add types to all return types. Normally, Phan only adds inferred returned types when there is no@returntypeor real return type signature. This setting can be disabled on individual methods by adding
@phan-hardcode-return-typeto the doc comment.Disabled by default. This is more useful with
--analyze-twiceand in conjunction withPhoundPlugintodetect more callsite possibilities. See the PR description where
this setting was added for more details.
(Default:
false)Along with this change, we are analyzing the return types of traits a bit more aggressively now. #4874
Bug fixes:
Maintenance:
v5.4.4: supporting PHP 7.0-8.2 syntaxCompare Source
New features:
Miscellaneous:
v5.4.3: supporting PHP 7.0-8.2 syntaxCompare Source
New Features(Analysis):
@throwstypes from parent methods ifenable_phpdoc_typesis true (which it is by default). (#4757)Miscellaneous:
Bug fixes:
PhanTypeMismatchUnpackKeyArraySpreadwhenminimum_target_php_versionis'8.1'or newer. (#4788)ini_set()instead ofassert_options()when Phan's assertion options match PHP's assert ini setting defaults to keep those values and avoid deprecation warnings in php 8.3+.\x00(APCu,immutable_cache)This release fixes errors and deprecations seen running Phan with PHP 8.3, but it does not support analyzing most new syntax/features/changes deprecations of PHP 8.3 itself.
v5.4.2: supporting PHP 7.0-8.2 syntaxCompare Source
Miscellaneous:
EmptyStatementListPluginissue messages.exif_read_data()(#4759)allow_missing_propertiessetting aware ofAllowDynamicPropertiesattribute for PHP 8.2Maintenance:
This release of php-ast makes the parsing of
AST_ARROW_FUNCin php 8.2 match older php versions.readonlyclasses in the polyfill/fallback parser.__halt_compiler()in the polyfill/fallback parser.v5.4.1: supporting PHP 7.0-8.1 syntaxCompare Source
New Features(Analysis):
A|(B&C)(https://wiki.php.net/rfc/dnf_types). (#4699)Emit
PhanCompatibleTraitConstantwhen using constants on traits with aminimum_target_php_versionbelow'8.2'Emit
PhanAccessClassConstantOfTraitDirectlywhen directly referencing the class constant on the trait declaration.PhanTypeModifyImmutableObjectPropertyfor PHP 8.1readonlyproperties when modified anywhere outside of thedeclaring class's scope. (#4710)
Miscellaneous:
array_filter$callbackto be null (#4715)v5.4.0: supporting PHP 7.0-8.1 syntaxCompare Source
New Features(CLI, Configs):
tool/analyze_phptto analyze phpt files. See https://www.phpinternalsbook.com/tests/phpt_file_structure.htmlNew Features(Analysis):
truetype (https://wiki.php.net/rfc/true-type).Emit
PhanCompatTrueTypewhentrueis used whenminimum_target_php_versionis less than 8.2.PhanCompatStandaloneTypeinstead ofPhanInvalidNodefor uses of null/false as real standalone types to support php 8.2 https://wiki.php.net/rfc/null-false-standalone-types(Not emitted when
minimum_target_php_versionis 8.2 or higher)Bug fixes:
ast\Nodewhen running Phan in php 5.2.0 with the polyfill instead of the native php-ast version.(This fix is only enabled in php 7.3+ when using pcntl, the pcntl fallback already re-enabled garbage collection. php 7.3 improved the garbage collection efficiency for large collections of objects.)
PhanGenericConstructorTypeswarning to the class inheriting a constructor if needed (#4675)"${}"string interpolation (#4692)v5.3.2: supporting PHP 7.0-8.1 syntaxCompare Source
New Features(Analysis):
$varinin_array($var, $array)instead of just the type of the array elements (#4630)
phan --init, allow inferring php 8.1 as the target php version in the generated config file. (#4655)Maintenance:
Bug fixes:
Fix AST download link for PHP 8.0+ for Windows (#4645)
Fix dead code detection for PHP 8.0 non-capturing catch statements. (#4633)
This should still analyze the catch body even if there is no caught exception variable.
Ignore phpdoc comment tags that don't start at the start of a line of the doc comment (
* @​sometag) or aren't an inline tag (* something {@​sometag}). (#4640)See https://docs.phpdoc.org/3.0/guide/references/phpdoc/tags/internal.html and https://docs.phpdoc.org/2.9/guides/docblocks.html
E.g.
* This is not @​abstract.is no longer treated as an abstract method.v5.3.1: supporting PHP 7.0-8.1 syntaxCompare Source
New Features(Analysis):
PhanDeprecatedPartiallySupportedCallablefor functions that work withcall_user_func($expr)but not$expr().The literal strings
'self','parent', and'static'in'self::methodName'or['self', 'methodName']in callables were deprecated in PHP 8.2.PhanDeprecatedPartiallySupportedCallableAlternateScopefor uses of callables such as[new SubClass(), 'Base::method']specifying an alternate scope.Plugins:
PhanPluginUnknownClosureParamTypeandPhanPluginUnknownFunctionParamType.Bug fixes:
#[AllowDynamicProperties].v5.3.0: supporting PHP 7.0-8.1 syntaxCompare Source
New Features(Analysis):
Fix false positive PhanPossiblyUndeclaredVariable warning when a
tryblock unconditionally returns/throws/exits (#4419)Fix false positive warnings when analyzing enums, infer that automatically generated methods of enums exist. (#4313)
Properly resolve template type when
getIteratorreturns anIteratorthat includes a template. (#4556)Fix false positives such as
PhanTypeMismatchArgumentNullableanalyzing recursive call with parameter set to literal, without real type information. (#4550)(e.g.
function ($retry = true) { if ($retry) {/*...*/} some_call_using_retry($retry); })Properly detect
PhanUnusedVariablein try-catch where catch always rethrows. (#4567)Make read-only/write-only property detection more accurate for assignment operations (e.g.
+=,??=) and increment/decrement operations. (#4570)Improve estimates of array sizes when analyzing calls that unpack values, based on the inferred real type set. (#4577)
Infer that variadic parameters can have string keys (as of php 8.0) (#4579)
Emit
PhanParamTooFewUnpackandPhanParamTooFewInternalUnpackto indicate when argument unpacking may provide too few arguments to the called function. (#4577)Support the non-standard
@no-named-argumentsPHPDoc comment on function-likes. (#4580, #4152)Treat variadic parameters as list types when this annotation is used,
warn about unpacking string arguments or explicitly passing named arguments to functions using this declaration.
Warn about argument unpacking that may pass strings to internal functions (e.g.
var_dump(...['a' => 'unsupported'])) (#4579)New issue types:
PhanSuspiciousNamedArgumentVariadicInternalUnpackSupport
@phan-type AliasName=UnionTypeannotation in inline strings or element comments (#4562)These aliases will apply to remaining statements in the current
top-level namespace blocks, similar to use statements, but can also be defined
in methods and apply to subsequent methods.
This can be of use in avoiding repetition of phpdoc for long type definitions.
When analyzing calls that modify variables as pass by reference, merge old types with existing types
to account for possibility of branches or early returns (#4602)
Plugins:
EmptyStatementListPlugin(#4555)AlwaysReturnPluginabout functions/methods with no return type that have at least one return statement with an expression, but may fall through to the end of the function body without an explicit return (#4587)Bug fixes:
count($arr) > 0andcount($arr) >= 1that the array is non-empty. (#4551)/) on windows (#4149)$arr[true]) (#4573)--processes NCLI flag before checking if phan should restart withoutgrpc(#4608)Maintenance:
v5.2.1: supporting PHP 7.0-8.1 syntaxCompare Source
New Features:
E.g. support
if ($x === []) {...} else {...},if (count($x) > 0) {...} else {...}, etc.PhanTypeNonVarPassByRefto critical. It throws an Error in php 8.0+. (#3830)in_array($var, $array, true)that $array is a non-empty array and that $var is of a type found in the elements of $array. (#2511)Plugins:
InvokePHPNativeSyntaxCheckPluginis passed a path to a php binary that is missing or invalid (or if the syntax check crashed). (#4116)Previously, Phan would crash with an error such as
fwrite(): write of 8196 bytes failed with errno=32 Broken pipePhanPluginMoreSpecificActualReturnTypefor phpdoc array shape return type and returned generic array. (#4531)Bug fixes:
Fix type inference logic that was looking for array specializations rather than array or any array subtype (#4512)
Fix false positive
PhanUnreferencedClosure/PhanUnreferencedFunctionseen when a closure/function name was passed to a function such asuasortthat already had a plugin analyzing calls of the closure. (#4090, #4519)Fix false positive/negative
PhanTypeMissingReturn*instances. (#4537)The check was wrong and should have been checking for a statement list that throws/exits.
Return statements can be omitted if a function unconditionally exits.
Also, check for the real
neverreturn type when emitting issuesFix false positive
PhanPossiblyUndefinedGlobalVariable*instance whenglobal $varis used within a conditional. (#4539)Fix false positive
PhanPluginRedundantAssignmentInLoopinstance when a variable is modified in a catch statement with a break/continue. (#4542)Fix some incorrect line numbers in some plugin issues.
Fix crash seen when parsing intersection types containing union types such as
non-empty-array&array<'a'|'b'>(#4544)Maintenance:
get_headers(#3273)v5.2.0: supporting PHP 7.0-8.1 syntaxCompare Source
Plugins
AddNeverReturnTypePlugin`` which will suggest adding a phpdoc return type of@return never`. (#4468)Bug fixes:
numeric-stringin all phpdocPhanTypeMismatchPropertyDefaultRealwarning for literal integer andfloattyped property. (#4507)PhanImpossibleTypeComparisonabout string subtypes not casting to other string subtypes (#4514)Maintenance:
BlockExitStatusCheckerto indicate that a function will exit or infinitely loop (STATUS_NORETURN) (#4468)v5.1.0: supporting PHP 7.0-8.1 syntaxCompare Source
New Features (Analysis):
Documentation:
--target-php-versionand--minimum-target-php-versionv5.0.0: supporting PHP 7.0-8.1 syntaxCompare Source
If you are migrating from Phan 4, it may be useful to set up or update a Phan baseline file to catch issues such as nullable type mismatches.
https://github.com/phan/phan/wiki/Tutorial-for-Analyzing-a-Large-Sloppy-Code-Base has other advice on setting up suppressions.
For example, Phan is now more consistently warning about nullable arguments (i.e. both
\X|nulland?\X) in a few cases where it may have not warned about passing\X|nullto a function that expects a non-null type.If you are using plugins for Phan 4 that are not part of Phan itself, they may have issues in Phan 5 due
to additional required parameters being added to many of Phan's methods.
See the changelog for other changes in the previous alpha releases: https://github.com/phan/phan/blob/5.0.0/NEWS.md
New Features (Analysis):
Warn about implicitly nullable parameter intersection types (
function(A&B $paramName = null)) being a compile error.New issue type:
PhanTypeMismatchDefaultIntersectionEmit
PhanTypeMismatchArgumentSuperTypeinstead ofPhanTypeMismatchArgumentwhen passing in an object supertype (e.g. ancestor class) of an object instead of a subtype.Emit
PhanTypeMismatchReturnSuperTypeinstead ofPhanTypeMismatchReturnwhen returning an object supertype (e.g. ancestor class) of an object instead of a subtype.Phan 5 starts warning about ancestor classes being incompatible argument or return types in cases where it previously allowed it. (#4413)
v4.1.0: supporting PHP 7.0-8.0 syntaxCompare Source
Maintenance:
--help,--version, and crash reports (#4487)The environment variable
PHAN_SUPPRESS_PHP_UPGRADE_NOTICE=1can be set to disable this notice.(...)and avoid crashing when parsing intersection types.Note that Phan 5 must be used instead to actually support intersection types; intersection types are not part of Phan 4's type system.
v4.0.7: supporting PHP 7.0-8.0 syntaxCompare Source
The Phan 5 release line (currently in alpha) will support PHP 8.1 syntax and new features such as intersection types
Language Server/Daemon mode:
Maintenance:
Bug fixes:
Don't emit
PhanCompatibleNonCapturingCatchwhenminimum_target_php_versionis'8.0'or newer. (#4433)Stop ignoring
@return nulland@param null $paramNamein phpdoc. (#4453)Stop special casing
@param nullnow that Phan allows many other literal types in param types.v4.0.6: supporting PHP 7.0-8.0 syntaxCompare Source
New Features (Analysis):
Partially support php 8.1 enums (#4313)
(infer the real type is the class type, that they cannot be instantiated, that enum values cannot be reused, and that class constants will exist for enum cases)
New issue types:
PhanReusedEnumCaseValue,PhanTypeInstantiateEnum,PhanTypeInvalidEnumCaseType,PhanSyntaxInconsistentEnum,PhanInstanceMethodWithNoEnumCases,PhanInstanceMethodWithNoEnumCases,PhanEnumCannotHaveProperties,PhanUnreferencedEnumCase,PhanEnumForbiddenMagicMethod.Support php 7.4 covariant return types and contravariant parameter types when the configured or inferred
minimum_target_php_versionis'7.4'or newer (#3795)Add initial support for the php 8.1
nevertype (in real return types and phpdoc). (#4380)Also add support for the phpdoc aliases
no-return,never-return, andnever-returnsSupport casting
iterable<K, V>toTraversable<K, V>withis_objector!is_arraychecksDetect more types of expressions that never return when inferring types (e.g. when analyzing
?:,??operators)Use php 8.1's tentative return types from reflection (
hasTentativeReturnType,getTentativeReturnType) to assume real return types of internal functions/methods (#4400)This can be disabled by setting
use_tentative_return_typetofalse(e.g. when using subclasses of internal classes that return incompatible types).Warn about modifying properties of classes that are immutable at runtime (enums, internal classes such as
\Closureand\WeakRef, etc.) (#4313)New issue type:
PhanTypeModifyImmutableObjectPropertyDead code detection:
Infer that functions with a return type of
never(or phpdoc aliases such asno-return) are unreachable when performing control flow analysis.This can be disabled by setting
dead_code_detection_treat_never_type_as_unreachableto falseNote that control flow is only affected when
UseReturnValuePluginis enabled.Plugins:
UseReturnValuePlugin, also start warning about when using the result of an expression that evaluates toneverNew issue types:
PhanUseReturnValueOfNeverBug fixes:
As part of the work on php 7.4 contravariant parameter types,
don't automatically inherit inferred parameter types from ancestor classlikes when (1) there is no
@paramtag with a type for the parameter on the overriding method and (2) the ancestor parameter types are a subtype of the real parameter types unless@inheritDocis used.array<string,mixed>that is a specialization of an array type.If you want to indicate that the overriding method can be any array type, add
@param array $paramName.Change composer.json dependency on
composer/xdebug-handlerfrom^2.0to^1.1|2.0to avoid conflicting with other libraries or applications that depend on xdebug-handler 1.x (#4382)Support parsing multiple declare directives in the polyfill/fallback parser (#4160)
v4.0.5: supporting PHP 7.0-8.0 syntaxCompare Source
New Features (Analysis):
non-null-mixedandnull(#4388, #4391)PhanCompatibleSerializeInterfaceDeprecatedwhen a class implements Serializable without also implementing the__serializeand__unserializemethods as well. (#4387)PHP 8.1 deprecates the
Serializableinterface when__serializeand__unserializearen't also implemented to be used instead ofserialize/unserialize.Maintenance:
__serialize/__unserializein Phan itself in places that useSerializable.Phan\Language\Typeto account for changes in static variable inheritance in php 8.1. (#4379)Bug fixes:
?Tto be used in parameter/property types with@template T(#4388)v4.0.4: supporting PHP 7.0-8.0 syntaxCompare Source
New Features (CLI, Config):
--doc-commentflag ontool/make_stubsto emit the doc comments Phanis using for internal elements along with the stubs.
(these are the doc comments Phan would use for hover text in the language server)
target_php_versionandminimum_target_php_versionto be 8.1 or newer.New Features (Analysis):
Don't emit warnings about array unpacking with string keys when
minimum_target_php_versionis '8.1' or newer.array_is_list(array $array): boolconditional and its negation. (#4348)Bug fixes:
Maintenance:
Plugins:
ConfigPluginSet. This is useful for unit testing stateless plugins which declare the plugin class in the same file returning the plugin instance. (#4352)v4.0.3: supporting PHP 7.0-8.0 syntaxCompare Source
New Features:
getIteratorreturning an ordinaryIterator<X>(previously only inferred types for subclasses of Iterator)Bug fixes:
[...$x]in an issue message (#4351)if ($x)converts non-null-mixedtonon-empty-mixedself::CONST_NAMEfrom inside of a subclass of the constant's declaring class (#4360)allow_method_param_type_wideningfromminimum_target_php_versionto avoid false positivePhanParamSignatureRealMismatchHasNoParamType.v4.0.2: supporting PHP 7.0-8.0 syntaxCompare Source
New Features:
PhanUndeclaredThisinside of static methods/closures (#4336)Language Server/Daemon mode:
::and->at the end of a line on files using Windows line endings(\r\n) instead of Unix newlines(\n) on any OS (#4345)Previously, those were not completed.
Bug fixes:
PhanParamSignatureMismatchfor variadic overriding a function usingfunc_get_args()(#4340)to
function(paramtypes):returntype(#4343)v4.0.1: supporting PHP 7.0-8.0 syntaxCompare Source
New Features:
PhanCompatibleAssertDeclarationwhen declaring a function calledassert. (#4333)Bug fixes:
PhanInvalidConstantExpressionfor named arguments in attributes (#4334)Merge changes from Phan 3.2.10
v4.0.0: supporting PHP 7.0-8.0 syntaxCompare Source
The Phan v4 release line has the following changes from Phan 3:
A few third party plugins may be affected by the increase of the AST version.
#[...]attributes are used properly when run with PHP 8.0+Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.