All Versions
36
Latest Version
Avg Release Cycle
17 days
Latest Release
1639 days ago

Changelog History
Page 3

  • v3.0.0-RC2 Changes

    May 02, 2020

    ๐Ÿš€ The Phan 3.x releases support analysis of php 7.0-7.4, and can be executed with php 7.2+.

    ๐Ÿš€ Use the older Phan 2.x releases if you need to continue to execute Phan with php 7.1.
    ๐Ÿš€ Use the older Phan 1.x releases if you need to execute Phan with php 7.0.

    ๐Ÿ”„ Changes

    • ๐Ÿ›  Fix the published commit for the GitHub release (use the v3 branch instead of the master branch)

    Backwards incompatible changes:

    • ๐Ÿ”’ Drop PHP 7.1 support. PHP 7.1 reached its end of life for security support in December 2019.
      ๐Ÿš€ Many of Phan's dependencies no longer publish releases supporting php 7.1,
      which will likely become a problem running Phan with future php 8.x versions
      ๐Ÿš€ (e.g. in the published phar releases).
    • โฌ‡๏ธ Drop PluginV2 support (which was deprecated in Phan 2) in favor of PluginV3.
    • โœ‚ Remove deprecated classes and helper methods.
  • v3.0.0-RC1 Changes

    May 02, 2020

    ๐Ÿ‘‰ USE 3.0.0-RC2 INSTEAD (the git tag incorrectly uses the 2.x branch instead of 3.x)

    ๐Ÿš€ The Phan 3.x releases support analysis of php 7.0-7.4, and can be executed with php 7.2+.

    ๐Ÿš€ Use the older Phan 2.x releases if you need to continue to execute Phan with php 7.1.
    ๐Ÿš€ Use the older Phan 1.x releases if you need to execute Phan with php 7.0.

    Backwards incompatible changes:

    • ๐Ÿ”’ Drop PHP 7.1 support. PHP 7.1 reached its end of life for security support in December 2019.
      ๐Ÿš€ Many of Phan's dependencies no longer publish releases supporting php 7.1,
      which will likely become a problem running Phan with future php 8.x versions
      ๐Ÿš€ (e.g. in the published phar releases).
    • โฌ‡๏ธ Drop PluginV2 support (which was deprecated in Phan 2) in favor of PluginV3.
    • โœ‚ Remove deprecated classes and helper methods.
  • v2.7.3 Changes

    July 02, 2020

    Phan 3 is out (requires PHP 7.2+ to run),
    ๐Ÿš€ and that release line will contain all of Phan's new features, bug fixes, and crash fixes.

    ๐Ÿšง Maintenance:

    • ๐Ÿš€ Mention that Phan 3 has been released in --help, --version, and crash reports. (#3903)
      The environment variable PHAN_SUPPRESS_PHP_UPGRADE_NOTICE=1 can be set to disable this notice.
    • ๐Ÿš€ Warn if attempting to execute Phan 2.x with PHP 8.0-dev or newer (A future release of Phan 3 will fully support 8.0)
    • Recommend using Phan 3 when --target-php-version or target_php_version is 7.2 or newer.
    • ๐Ÿš€ Upgrade package versions in composer.lock (affects Phar releases)

    ๐Ÿ› Bug fixes:

    • ๐Ÿ›  Fix handling of windows path separators in phan_client
    • ๐Ÿ›  Fix a crash when emitting PhanCompatibleAnyReturnTypePHP56 or PhanCompatibleScalarTypePHP56 for methods with no parameters.
  • v2.7.2 Changes

    May 02, 2020

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

    โž• Add a --native-syntax-check=/path/to/php option to enable InvokePHPNativeSyntaxCheckPlugin
    and add that php binary to the php_native_syntax_check_binaries array of plugin_config
    ๐Ÿ”ง (treated here as initially being the empty array if not configured).

    This CLI flag can be repeated to run PHP's native syntax checks with multiple php binaries.

    ๐Ÿ†• New features(Analysis):

    Emit PhanTypeInvalidThrowStatementNonThrowable when throwing expressions that can't cast to \Throwable. (#3853)

    Include the relevant expression in more issue messages for type errors. (#3844)

    0๏ธโƒฃ Emit PhanNoopSwitchCases when a switch statement contains only the default case.

    Warn about unreferenced private methods of the same name as methods in ancestor classes, in dead code detection.

    Warn about useless loops. Phan considers loops useless when the following conditions hold:

    Variables defined within the loop aren't used outside of the loop
    (requires unused_variable_detection to be enabled whether or not there are actually variables)

    It's likely that the statements within the loop have no side effects
    (this is only inferred for a subset of expressions in code)

    (Enabling the plugin UseReturnValuePlugin (and optionally 'plugin_config' => ['infer_pure_methods' = true]) helps detect if function calls are useless)

    The code is in a functionlike scope.

    ๐Ÿ†• New issue types: PhanSideEffectFreeForeachBody, PhanSideEffectFreeForBody, PhanSideEffectFreeWhileBody, PhanSideEffectFreeDoWhileBody

    Infer that previous conditions are negated when analyzing the cases of a switch statement (#3866)

    ๐Ÿ‘Œ Support using throw as an expression, for PHP 8.0 (#3849)
    (e.g. is_string($arg) || throw new InvalidArgumentException())
    Emit PhanCompatibleThrowException when throw is used as an expression instead of a statement.

    ๐Ÿ”Œ Plugins

    • ๐Ÿ”Œ Emit PhanPluginDuplicateCatchStatementBody in DuplicateExpressionPlugin when a catch statement has the same body and variable name as an adjacent catch statement.
      ๐Ÿ‘ (This should be suppressed in projects that support php 7.0 or older)
    • โž• Add PHP53CompatibilityPlugin as a demo plugin to catch common incompatibilities with PHP 5.3. (#915)
      ๐Ÿ†• New issue types: PhanPluginCompatibilityArgumentUnpacking, PhanPluginCompatibilityArgumentUnpacking, PhanPluginCompatibilityArgumentUnpacking
    • โž• Add DuplicateConstantPlugin to warn about duplicate constant names (define('X', value) or const X = value) in the same statement list.
      This is only recommended in projects with files with too many global constants to track manually.

    ๐Ÿ› Bug Fixes:

    • ๐Ÿ›  Fix a bug causing FQSEN names or namespaces to be converted to lowercase even if they were never lowercase in the codebase being analyzed (#3583)

    Miscellaneous:

    • 0๏ธโƒฃ Replace PhanTypeInvalidPropertyDefaultReal with TypeMismatchPropertyDefault (emitted instead of TypeMismatchProperty)
      0๏ธโƒฃ and TypeMismatchPropertyDefaultReal (#3068)
    • ๐Ÿ”Œ Speed up ASTHasher for floats and integers (affects code such as DuplicateExpressionPlugin)
    • ๐Ÿ‘ Call uopz_allow_exit(true) if uopz is enabled when initializing Phan. (#3880)
      โš™ Running Phan with uopz is recommended against (unless debugging Phan itself), because uopz causes unpredictable behavior.
      ๐Ÿ‘‰ Use stubs or internal stubs instead.
  • v2.7.1 Changes

    April 12, 2020

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

    • ๐Ÿ‘Œ Improve the output of tool/make_stubs. Use better defaults than null.
      0๏ธโƒฃ Render unknown for unknown defaults in tool/make_stubs and Phan's issue messages.
      0๏ธโƒฃ (default is a reserved keyword used in switch statements)

    ๐Ÿ› Bug Fixes:

    • Work around unintentionally using symfony/polyfill-72 for spl_object_id instead of Phan's polyfill.
      The version used caused issues on 32-bit php 7.1 installations, and a slight slowdown in php 7.1.

    ๐Ÿ”Œ Plugins:

    • ๐Ÿ PHP 8.0-dev compatibility fixes for InvokePHPNativeSyntaxCheckPlugin on Windows.
    • ๐Ÿ”Œ Infer that some new functions in PHP 8.0-dev should be used in UseReturnValuePlugin
    • Emit the line and expression of the duplicated array key or switch case (#3837)
  • v2.7.0 Changes

    April 01, 2020

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

    • Sort output of --dump-ctags=basic by element type before sorting by file name (#3811)
      (e.g. make class and global function declarations the first tag type for a tag name)
    • 0๏ธโƒฃ Colorize the output of phan_client by default for the default and text output modes. (#3808)
      โž• Add phan --no-color option to disable colors.
    • Warn about invalid CLI flags in phan_client (#3776)
    • ๐Ÿ‘Œ Support representing more AST node types in issue messages. (#3783)
    • ๐Ÿ‘‰ Make some issue messages easier to read (#3745, #3636)
    • ๐Ÿ‘ Allow using --minimum-severity=critical instead of --minimum-severity=10 (#3715)
    • 0๏ธโƒฃ Use better placeholders for parameter default types than null in issue messages and hover text (#3736)
    • ๐Ÿš€ Release phantasm, a prototype tool for assembling information about a codebase and aggressively optimizing it.
      Currently, the only feature is replacing class constants with their values, when safe to do so.
      โšก๏ธ More features (e.g. inlining methods, aggressively optimizing out getters/setters, etc.) are planned for the future.
      ๐Ÿ‘€ See tool/phantasm --help for usage.

    ๐Ÿ†• New features(Analysis):

    • ๐Ÿ‘Œ Improve analysis of php 7.4 typed properties.
      ๐Ÿ‘Œ Support extracting their real union types from Reflection information.
      0๏ธโƒฃ Infer the existence of properties that are not in ReflectionClass->getPropertyDefaults()
      0๏ธโƒฃ due to being uninitialized by default.
    • Emit PhanAbstractStaticMethodCall* when calling an abstract static method statically. (#3799)
    • Emit PhanUndeclaredClassReference instead of PhanUndeclaredClassConstant for MissingClass::class.

    Language Server/Daemon mode:

    • ๐Ÿ‘€ Catch exception seen when printing debug info about not being able to parse a file.
    • Warn when Phan's language server dependencies were installed for php 7.2+
      but the language server gets run in php 7.1. (phpdocumentor/reflection-docblock 5.0 requires php 7.2)
    • Immediately return cached hover text when the client repeats an identical hover request. (#3252)

    Miscellaneous:

    • ๐Ÿ›  PHP 8.0-dev compatibility fixes, analysis for some new functions of PHP 8.0-dev.
    • โž• Add symfony/polyfill-php72 dependency so that symfony 5 will work better in php 7.1.
      ๐Ÿš€ The next Phan major release will drop support for php 7.1.
  • v2.6.1 Changes

    March 13, 2020

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

    • โž• Add a --dump-ctags=basic flag to dump a tags file in the project root directory. (https://linux.die.net/man/1/ctags)
      This is different from tool/make_ctags_for_phan_project - --dump-ctags=basic has no external dependencies.

    ๐Ÿ†• New features(Analysis):

    • Infer that the real type set of the key in foreach ($arrayVar as $key => ...) is definitely an int|string
      in places where Phan previously inferred the empty union type, improving redundant condition detection. (#3789)

    ๐Ÿ› Bug fixes:

    • ๐Ÿ›  Fix a crash in phan --dead-code-detection when a trait defines a real method and phpdoc @method of the same name (#3796)

    Miscellaneous:

    • Also allow netresearch/jsonmapper@^2.0 as a dependency when enforcing the minimum allowed version (#3801)
  • v2.6.0 Changes

    March 07, 2020

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

    ๐Ÿ‘‰ 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.
    0๏ธโƒฃ 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:

    • ๐Ÿ›  Fix bug causing Phan to fail to properly recursively analyze parameters of inherited methods (#3740)
      (i.e. when the methods are called on the subclass)
    • ๐Ÿ›  Fix ambiguity in the way Closure():T[] and callable():T[] are rendered in error messages. (#3731)
      Either render it as (Closure():T)[] or Closure():(T[])
    • Don't include both . and vendor/x/y/ when initializing Phan configs with settings such as --init --init-analyze-dir=. (#3699)
    • Be more consistent about resolving static in generators and template types.
    • Infer the iterable value type for Generator<V>. It was previously only inferred when there were 2 or more template args in phpdoc.
    • Don't let less specific type signatures such as @param object $x override the real type signature of MyClass $x (#3749)
    • ๐Ÿ‘Œ Support PHP 7.4's ??= null coalescing assignment operator in the polyfill.
    • ๐Ÿ›  Fix crash analyzing invalid nodes such as 2 = $x in RedundantAssignmentPlugin.
    • ๐Ÿ›  Fix crash inferring type of isset ? 2 : 3 with --use-fallback-parser (#3767)
    • ๐Ÿ›  Fix false positive unreferenced method warnings for methods from traits
      when the methods were referenced in base classes or interfaces of classes using those traits.

    Language Server/Daemon mode:

    • ๐ŸŽ Various performance improvements for the language server/daemon with or without pcntl (#3758, #3769, #3771)
  • v2.5.0 Changes

    February 20, 2020

    ๐Ÿ†• 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 of PhanUndeclaredConstant (severity normal)
    This should not be confused with PhanUndeclaredClassConstant, 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 and PhanCompatibleAnyReturnTypePHP56 for function signatures when target_php_version is '5.6' (#915)
    (This also requires that backward_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 infers list<string> and Reflection says array).
    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. convert bool|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 named PhanCompatibleObjectTypePHP71
    • ๐Ÿ›  Fix false positive PhanPartialTypeMismatchProperty when a php 7.4 typed property has a default expression value (#3725)
  • v2.4.9 Changes

    February 13, 2020

    ๐Ÿ†• New Features(Analysis):

    Infer that class_exists implies the first argument is a class-string,
    and that method_exists implies the first argument is a class-string or an object. (#2804, #3058)

    Note that Phan still does not infer that the class or method actually exists.

    Emit PhanRedefineClass on all occurrences of a duplicate class, not just the ones after the first occurrence of the class. (#511)

    Emit PhanRedefineFunction on all occurrences of a duplicate function/method, not just the ones after the first.

    ๐Ÿ“œ Emit PhanRedefinedClassReference for many types of uses of user-defined classes that Phan has parsed multiple definitions of.
    Phan will not warn about internal classes, because the duplicate definition is probably a polyfill.
    (e.g. new DuplicateClass(), DuplicateClass::someMethod())

    ๐Ÿ› Bug fixes:

    • Fix false positive PhanParamSuspiciousOrder for preg_replace_callback (#3680)
    • ๐Ÿ›  Fix false positive PhanUnanalyzableInheritance for renamed methods from traits. (#3695)
    • ๐Ÿ›  Fix false positive PhanUndeclaredConstant previously seen for inherited class constants in some parse orders. (#3706)
    • ๐Ÿ›  Fix uncaught TypeError converting iterable<T> to nullable (#3709)