Phan Versions Save

Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.

4.0.3

3 years ago

New Features:

  • Support inferring iterable value types/keys from getIterator returning an ordinary Iterator<X> (previously only inferred types for subclasses of Iterator)

Bug fixes:

  • Fix crash when rendering [...$x] in an issue message (#4351)
  • Infer that if ($x) converts non-null-mixed to non-empty-mixed
  • Fix false positive warning case for PhanParamSignaturePHPDocMismatchParamType when a phpdoc parameter has a default value (#4357)
  • Properly warn about accessing a private class constant as self::CONST_NAME from inside of a subclass of the constant's declaring class (#4360)
  • Properly infer allow_method_param_type_widening from minimum_target_php_version to avoid false positive PhanParamSignatureRealMismatchHasNoParamType.

4.0.2

3 years ago

New Features:

  • Improve suggestions for PhanUndeclaredThis inside of static methods/closures (#4336)

Language Server/Daemon mode:

  • Properly generate code completions for :: 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:

  • Fix false positive PhanParamSignatureMismatch for variadic overriding a function using func_get_args() (#4340)
  • Don't emit PhanTypeNoPropertiesForeach for the Countable interface on its own. (#4342)
  • Fix false positive type mismatch warning for casts from callable-object/callable-array/callable-string to function(paramtypes):returntype (#4343)

4.0.1

3 years ago

New Features:

  • Emit PhanCompatibleAssertDeclaration when declaring a function called assert. (#4333)

Bug fixes:

  • Fix false positive PhanInvalidConstantExpression for named arguments in attributes (#4334)

Merge changes from Phan 3.2.10

3.2.10

3 years ago

Phan 4 is out (requires php-ast 1.0.7+ or the polyfill to run, and uses AST version 80). That release line will contain all of Phan's new features, bug fixes, and crash fixes.

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).

Maintenance:

  • Recommend using Phan 4 when analyzing code as a line printed to STDERR. (#4189)
  • Mention that Phan 4 has been released in --help, --version, and crash reports. (#4189) The environment variable PHAN_SUPPRESS_PHP_UPGRADE_NOTICE=1 can be set to disable this notice.
  • Warn if attempting to execute Phan 3.x with PHP 8.1-dev or newer (A future release of Phan 4+ will fully support 8.1) PHP 8.1 may contain changes to syntax that are unsupported by Phan 3 or the native/polyfill parsers.

Bug fixes

  • Fix false positive PhanPossiblyFalseTypeReturn with strict type checking for substr when target php version is 8.0+ (#4335)

4.0.0

3 years ago
  • Merge changes from Phan 3.2.9.
  • Relax minimum php-ast restrictions when polyfill is used for Phan 4.
  • Fix conflicting class constant seen in polyfill when php-ast 1.0.6 was installed.

The Phan v4 release line has the following changes from Phan 3:

  • Bump the minimum required AST version from 70 to 80 (Required to analyze php 8.0 attributes - the rest of the php 8.0 syntax changes are supported in both Phan 3 and Phan 4). A few third party plugins may be affected by the increase of the AST version.
  • Supports analyzing whether #[...] attributes are used properly when run with PHP 8.0+

3.2.9

3 years ago

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

Bug fixes:

  • Fix a few parameter names for issue messages (#4316)
  • Fix bug that could cause Phan not to warn about SomeClassWithoutConstruct::__construct in some edge cases. (#4323)
  • Properly infer self is referring to the current object context even when the object context is unknown in namespaces. (#4070)

Deprecations:

  • Emit a deprecation notice when running this in PHP 7 and php-ast < 1.0.7. (#4189) This can be suppressed by setting the environment variable PHAN_SUPPRESS_AST_DEPRECATION=1.

4.0.0-RC2

3 years ago

The Phan v4 release line has the following changes from Phan 3:

  • Bump the minimum required AST version from 70 to 80 (Required to analyze php 8.0 attributes - the rest of the php 8.0 syntax changes are supported in both Phan 3 and Phan 4). A few third party plugins may be affected by the increase of the AST version.
  • Supports analyzing whether #[...] attributes are used properly when run with PHP 8.0+

Changes

Merge changes from Phan 3.2.8

3.2.8

3 years ago

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

Bug fixes:

  • Fix false positive PhanUnusedVariable for variable redefined in loop (#4301)
  • Fix handling of -z/--signature-compatibility - that option now enables analyze_signature_compatibility instead of disabling it. (#4303)
  • Fix possible PhanCoalescingNeverUndefined for variable defined in catch block (#4305)
  • Don't emit PhanCompatibleConstructorPropertyPromotion when minimum_target_php_version is 8.0 or newer. (#4307)
  • Infer that PHP 8.0 constructor property promotion's properties have write references. (#4308) They are written to by the constructor.
  • Inherit phpdoc parameter types for the property declaration in php 8.0 constructor property promotion (#4311)

4.0.0-RC1

3 years ago

The Phan v4 release line has the following changes from Phan 3:

  • Bump the minimum required AST version from 70 to 80 (Required to analyze php 8.0 attributes - the rest of the php 8.0 syntax changes are supported in both Phan 3 and Phan 4). A few third party plugins may be affected by the increase of the AST version.
  • Supports analyzing whether #[...] attributes are used properly when run with PHP 8.0+

Changes

Merge changes from Phan 3.2.7

3.2.7

3 years ago

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 (Analysis):

  • Update real parameter names to match php 8.0's parameter names for php's own internal methods (including variadics and those with multiple signatures). (#4263) Update real parameter names, types, and return types for some PECL extensions.
  • Raise the severity of some php 8.0 incompatibility issues to critical.
  • Fix handling of references after renaming variadic reference parameters of fscanf/scanf/mb_convert_variables
  • Mention if PhanUndeclaredFunction is potentially caused by the target php version being too old. (#4230)
  • Improve real type inference for conditionals on literal types (#4288)
  • Change the way the real type set of array access is inferred for mixes of array shapes and arrays (#4296)
  • Emit PhanSuspiciousNamedArgumentVariadicInternal when using named arguments with variadic parameters of internal functions that are not among the few reflection functions known to support named arguments. (#4284)
  • Don't suggest instance properties as alternatives to undefined variables inside of static methods.

Bug fixes:

  • Support a non-null-mixed type and change the way analysis involving nullability is checked for mixed (phpdoc and real). (#4278, #4276)