All Versions
Latest Version
Avg Release Cycle
17 days
Latest Release
854 days ago

Changelog History
Page 4

  • v2.4.8 Changes

    January 25, 2020

    ๐Ÿ› Bug fixes:

    • ๐Ÿ›  Fix bug introduced in 2.4.7 where there were more false positives when --no-progress-bar was used. (#3677)
  • v2.4.7 Changes

    January 23, 2020

    ๐Ÿ†• New features(CLI, Configs):

    • Add an environment variable PHAN_NO_UTF8=1 to always avoid UTF-8 in progress bars.
      ๐Ÿ”Š This may help with terminals or logs that have issues with UTF-8 output.
      Error messages will continue to include UTF-8 when part of the error.
    • ๐Ÿ‘ Allow phan --init to complete even if composer.json has no configured autoload directories,
      ๐Ÿ”ง as long as at least one directory or file was configured.
    • Add a setting error_prone_truthy_condition_detection that can be enabled to warn about error-prone truthiness/falsiness checks. New issue types:
      • PhanSuspiciousTruthyCondition (e.g. for if ($x) where $x is object|int)
      • PhanSuspiciousTruthyString (e.g. for ?string - '0' is also falsey in PHP)
    • โš™ Limit calculation of max memory usage to the running worker processes with --processes N (#3606)
    • Omit options that should almost always be on (e.g. analyze_signature_compatibility) from the output of phan --init (#3660)
    • Allow phan --init to create config file with target_php_version of '7.4' or '8.0' based on composer.json (#3671)

    ๐Ÿ†• New Features(Analysis):

    • ๐Ÿ”€ Infer that merging defined variables with possibly undefined variables is also possibly undefined. (#1942)
    • โž• Add a fallback when some types of conditional check results in a empty union type in a loop:
      If all types assigned to the variable in a loop in a function are known,
      then try applying the condition to the union of those types. (#3614)
      (This approach was chosen because it needs to run only once per function)
    • Infer that assignment operations (e.g. +=) create variables if they were undefined.
    • Properly infer that class constants that weren't literal int/float/strings have real type sets in their union types.
    • Normalize union types of generic array elements after fetching $x[$offset].
      (e.g. change bool|false|null to ?bool)
    • Normalize union types of result of ?? operator.
    • ๐Ÿ›  Fix false positives in redundant condition detection for the real types of array accesses. (#3638, #3645, #3650)
    • ๐Ÿ‘Œ Support the non-empty-string type in phpdoc comments (neither '' nor '0').
      Warn about redundant/impossible checks of non-empty-string.
    • ๐Ÿ‘Œ Support the non-zero-int type in phpdoc comments. Infer it in real types and warn about redundant checks for zero/truthiness.
    • ๐Ÿ‘Œ Support the the non-empty-mixed in phpdoc comments and in inferences.
    • ๐Ÿ›  Fix false positives possibly undefined variable warnings after conditions
      such as if (X || count($x = [])), if (X && preg_match(..., $matches)), etc.

    ๐Ÿ› Bug fixes:

    • ๐Ÿ›  Fix a crash analyzing assignment operations on $GLOBALS such as $GLOBALS['var'] += expr; (#3615)
    • ๐Ÿ›  Fix false positive Phan[Possibly]UndeclaredGlobalVariable after conditions such as assert($var instanceof MyClass when the variable was not assigned to within the file or previously analyzed files. (#3616)
    • ๐Ÿ›  Fix line number of 0 for some nodes when simplify_ast is enabled. (#3649)

    ๐Ÿ”Œ Plugins:

    • ๐Ÿ”Œ Make Phan use the real type set of the return value of the function being analyzed when plugins return a union type without a real type set.

    ๐Ÿšง Maintenance:

    • Infer that explode() is possibly the empty list when $limit is possibly negative. (#3617)
    • ๐Ÿ’… Make Phan's code follow more PSR-12 style guidelines
      (<?php on its own line, function(): T instead of function() : T, declare visibility for class constants)
    • Internal: Check if strings are non-zero length in Phan's implementation instead of checking for variable truthiness.
      ('0' is falsey)
    • ๐Ÿ‘‰ Show null as lowercase instead of uppercase (the way var_export renders it) in more places.
  • v2.4.6 Changes

    December 29, 2019

    ๐Ÿ†• New features(CLI, Configs):

    • โž• Add more detailed instructions for installing dependencies new php installations on Windows without a php.ini
    • ๐Ÿ– Handle being installed in a non-standard composer directory name (i.e. not vendor) (mentioned in #1612)

    ๐Ÿ†• New Features(Analysis):

    • ๐Ÿ‘Œ Improve inferred array shapes for multi-dimensional assignments or conditions on arrays
      (e.g. $x['first']['second'] = expr or if (cond($x['first']['second']))) (#1510, #3569)
    • Infer that array offsets are no longer possibly undefined after conditions such as if (!is_null($x['offset']))
    • ๐Ÿ‘Œ Improve worst-case runtime when merging union types with many types (#3587)
    • ๐Ÿ‘Œ Improve analysis of assignment operators. (#3597)
    • Infer $x op= expr and ++/-- operators have a literal value when possible, outside of loops. (#3250, #3248)
    • ๐Ÿšš Move PhanUndeclaredInterface and PhanUndeclaredTrait warnings to the line number of the use/implements. (#2159)
    • Don't emit PhanUndeclaredGlobalVariable for the left side of ??/??= in the global scope (#3601)
    • More consistently infer that variables are possibly undefined if they are not defined in all branches. (#1345, #1942)
    • โž• Add new issue types for possibly undeclared variables: PhanPossiblyUndeclaredVariable and PhanPossiblyUndeclaredGlobalVariable.

    ๐Ÿ”Œ Plugins:

    • โž• Add StrictLiteralComparisonPlugin to warn about loose equality comparisons of constant string/int to other values. (#2310)

    ๐Ÿ› Bug fixes:

    • ๐Ÿ›  Fix false positive PhanTypePossiblyInvalidDimOffset seen after
      other array fields get added to an array shape by assignment or condition (#3579, #3569)
    • ๐Ÿ“œ Properly extract the value of binary integer literals and binary/hex/octal float literals in the polyfill/fallback parser. (#3586)
  • v2.4.5 Changes

    December 11, 2019

    ๐Ÿ”Œ Plugins:

    • ๐Ÿ”Œ When adding a plugin overriding the return type of a method,
      ๐Ÿ‘‰ make it affect all methods of descendant classlikes that inherited that method definition.

    ๐Ÿ†• New Features(Analysis)

    • Infer that !empty($x['field']...) also implies $x['field'] is non-falsey. (#3570)

    ๐Ÿ› Bug fixes:

    Fix bug in native parsing of AST_TYPE_UNION (union type) nodes for PHP 8.0.0-dev.

    ๐Ÿ–จ Don't print duplicate entries for functions with alternate signatures in tool/make_stubs

    ๐Ÿ›  Fix Error parsing internal template types such as non-empty-list<string> when using Type::fromFullyQualifiedString().

    ๐Ÿ›  Fix warnings about password_hash() algorithm constants with php 7.4 (#3560)
    0๏ธโƒฃ PASSWORD_DEFAULT became null in php 7.4, and other constants became strings.

    Note that you will need to run Phan with both php 7.4 and a target_php_version of 7.4 to fix the errors.

    ๐Ÿ›  Fix uncaught AssertionError when parsing @return \\... (#3573)

  • v2.4.4 Changes

    November 24, 2019

    ๐Ÿ†• New features(CLI, Configs):

    0๏ธโƒฃ When stderr is redirected a file or to another program, show an append-only progress bar by default. (#3514)
    0๏ธโƒฃ Phan would previously disable the progress bar entirely by default.

    The new --long-progress-bar CLI flag can be used to choose this progress bar.

    (The --no-progress-bar CLI flag or the environment variable PHAN_DISABLE_PROGRESS_BAR=1 can be used to disable this)

    Treat $var = $x['possibly undefined offset'] as creating a definitely defined variable,
    not a possibly undefined variable. (#3534)

    The config setting convert_possibly_undefined_offset_to_nullable controls
    whether the field type gets cast to the nullable equivalent after removing undefined.

    ๐Ÿ†• New features(Analysis):

    • Emit PhanPossiblyUndefinedArrayOffset for accesses to array fields that are possibly undefined. (#3534)
    • Warn about returning/not returning in void/non-void functions.
      ๐Ÿ†• New issue types: PhanSyntaxReturnValueInVoid, PhanSyntaxReturnExpectedValue
    • Infer that $var[$offset] = expr;/$this->prop[$offset] = expr; causes that element to be non-null (#3546)
    • Emit PhanEmptyForeachBody when iterating over a type that isn't Traversable with an empty statement list.
    • Warn about computing array_values for an array that is already a list. (#3540)
    • Infer the real type is still an array after assigning to a field of an array.

    ๐Ÿ”Œ Plugins:

    • ๐Ÿ”Œ In DuplicateExpressionPlugin, emit PhanPluginDuplicateIfStatements
      if the body for else is identical to the above body for the if/elseif.

    ๐Ÿšง Maintenance:

    • Support native parsing of AST_TYPE_UNION (union type) nodes for PHP 8.0.0-dev.
    • โฌ‡๏ธ Reduce memory usage after the polyfill/fallback parser parses ASTs
      (when the final AST isn't cached on disk from a previous run)
    • ๐Ÿ‘‰ Make the error message for missing php-ast contain more detailed instructions on how to install php-ast.
  • v2.4.3 Changes

    November 21, 2019

    ๐Ÿ†• New features(CLI, Configs):

    • ๐Ÿ‘Œ Support NO_COLOR environment variable. (
      When this variable is set, Phan's error message and issue text will not be colorized unless the CLI arg --color or -c is used.
      This overrides the PHAN_ENABLE_COLOR_OUTPUT setting.
    • Add PHAN_DISABLE_PROGRESS_BAR environment variable to disable progress bar by default unless the CLI arg --progress-bar is used.
    • ๐Ÿ‘‰ Show an extra decimal digit of precision in the progress bar when the terminal is wide enough. (#3514)

    ๐Ÿ†• New features(Analysis):

    ๐Ÿ‘‰ Make inferred real types more accurate for equality/identity/instanceof checks.

    ๐Ÿ”€ Combine array shape types into a single union type when merging variable types from multiple branches. (#3506)
    ๐Ÿ‘ท Do a better job of invalidating the real union type of fields of array shape types when the field is only checked/set on some code branches.

    ๐Ÿ›  Make issue suggestions (and CLI suggestions) for completions of prefixes case-insensitive.

    ๐Ÿ‘Œ Support @seal-properties and @seal-methods as aliases of @phan-forbid-undeclared-magic-properties and @phan-forbid-undeclared-magic-methods

    More aggressively infer real types of array destructuring(e.g. [$x] = expr) and accesses of array dimensions (e.g. $x = expr[dim]) (#3481)

    This will result in a few more false positives about potentially real redundant/impossible conditions and real type mismatches.

    ๐Ÿ›  Fix false positives caused by assuming that the default values of properties are the real types of properties.

    โš  Infer that globals used in functions (global $myGlobal;) have unknown real types - don't emit warnings about redundant/impossible conditions. (#3521)

    ๐Ÿ”Œ Plugins:

    • ๐Ÿ”Œ Also start checking if closures (and arrow functions) can be static in PossiblyStaticMethodPlugin
    • โž• Add AvoidableGetterPlugin to suggest when $this->prop can be used instead of $this->getProp().
      (This will suggest using the property instead of the getter method if there are no known method overrides of the getter. This is only checked for instance properties of $this)
    • ๐Ÿš‘ Increase severity of PhanPluginPrintfNonexistentArgument to critical. It will become an ArgumentCountError in PHP 8.

    ๐Ÿšง Maintenance:

    • โฌ†๏ธ Bump minimum version of netresearch/jsonmapper to avoid php notices in the language server in php 7.4
    • ๐Ÿ‘Œ Improve worst-case performance when analyzing code that has many possible combinations of array shapes.

    ๐Ÿ› Bug fixes:

    • โš  Properly emit redundant and impossible condition warnings about uses of class constants defined as literal strings/floats/integers.
      (i.e. infer their real union types)
    • ๐Ÿ›  Fix false positive inference that $x[0] was string for $x of types such as list<\MyClass>|string (reported in #3483)
    • Consistently inherit analysis settings from parent classes recursively, instead of only inheriting them from the direct parent class. (#3472)
      (settings include presence of dynamic properties, whether undeclared magic methods are forbidden, etc.)
    • Don't treat methods that were overridden in one class but inherited by a different class as if they had overrides.
    • ๐Ÿ›  Fix a crash when running in php 8.0.0-dev due to Union Types being found in Reflection. (#3503)
    • ๐Ÿ›  Fix edge case looking up the extends class/interface name when the namespace is a use alias (#3494)