Show empty union types as (empty union type) in issue messages instead of as an empty string.
Add a new CLI option --analyze-twice to run the analysis phase twice (#3743)
Phan infers additional type information for properties, return types, etc. while analyzing,
and this will help it detect more potential errors.
(on the first run, it would analyze files before some of those types were inferred)
Add a CLI option --analyze-all-files to analyze all files, ignoring exclude_analysis_file_list.
This is potentially useful if third party dependencies are missing type information (also see --analyze-twice).
Add --dump-analyzed-file-list to dump all files Phan would analyze to stdout.
Add allow_overriding_vague_return_types to allow Phan to add inferred return types to functions/closures/methods declared with @return mixed or @return object.
This is disabled by default.
When this is enabled, it can be disabled for individual methods by adding @phan-hardcode-return-type to the comment of the method.
(if the method has any type declarations such as @return mixed)
Previously, Phan would only add inferred return types if there was no return type declaration.
(also see --analyze-twice)
Also emit the code fragment for the argument in question in the PhanTypeMismatchArgument family of issue messages (#3779)
Render a few more AST node kinds in code fragments in issue messages.
New features(Analysis):
Support parsing php 8.0 union types (and the static return type) in the polyfill. (#3419, #3634)
Emit PhanCompatibleUnionType and PhanCompatibleStaticType when the target php version is less than 8.0 and union types or static return types are seen. (#3419, #3634)
Be more consistent about warning about issues in values of class constants, global constants, and property defaults.
Infer key and element types from iterator_to_array()
Infer that modification of or reading from static properties all use the same property declaration. (#3760)
Previously, Phan would track the static property's type separately for each subclass.
(static properties from traits become different instances, in each class using the trait)
Make assignments to properties of the declaring class affect type inference for those properties when accessed on subclasses (#3760)
Note that Phan is only guaranteed to analyze files once, so if type information is missing,
the only way to ensure it's available is to add it to phpdoc (UnknownElementTypePlugin can help) or use --analyze-twice.
Make internal checks if generic array types are strict subtypes of other types more accurate.
(e.g. object[] is not a strict subtype of stdClass[], but stdClass[] is a strict subtype of object[])
Plugins:
Add UnknownClassElementAccessPlugin to warn about cases where Phan can't infer which class an instance method is being called on.
(To work correctly, this plugin requires that Phan use a single analysis process)
Add MoreSpecificElementTypePlugin to warn about functions/methods where the phpdoc/actual return type is vaguer than the types that are actually returned by a method. (#3751)
This is a work in progress, and has a lot of false positives.
(To work correctly, this plugin requires that Phan use a single analysis process)
Fix crash in PrintfCheckerPlugin when analyzing code where fprintf() was passed an array instead of a format string.
Emit PhanTypeMissingReturnReal instead of PhanTypeMissingReturn when there is a real return type signature. (#3716)
Fix bug running InvokePHPNativeSyntaxCheckPlugin on Windows when PHP binary is in a path containing spaces. (#3766)
Bug fixes:
... (truncated)
Commits
d082d19 Merge pull request #3785 from TysonAndre/release-2.6.0
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme
Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Bumps phan/phan from 2.3.1 to 2.6.0.
Changelog
Sourced from phan/phan's changelog.
Commits
d082d19
Merge pull request #3785 from TysonAndre/release-2.6.052e8fd7
Release Phan 2.6.0555bcd3
Fix worst-case running time of UnionType->hasCommonTypes462b6ec
Fix InvokePHPNativeSyntaxCheckPlugin for php.exe with spaces in path002b215
Merge pull request #3784 from TysonAndre/fix-3779-arg-code-fragment84fedaf
Update language server integration testba7a916
Fix 32-bit test failurec85e7e4
Include code fragment in TypeMismatchArgument family of warnings1afe789
Fix rare crash with --use-fallback-parser813f9b5
[skip CI] Add issue number to NEWSDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired)