Skip to content

Installation via Composer, Playground and anonymous classes

Compare
Choose a tag to compare
@i582 i582 released this 31 Aug 09:24
· 50 commits to master since this release
a7db861

👋 This update aims to correct known bugs as well as complete new documentation. Some of the checks have been modified or divided into several to better match what they are checking.

Finally, NoVerify can be installed via Composer, which will allow a much more convenient for new user to try it in action. Interactive Playground (not support Safari yet) has also been added to this update, in it users can immediately see how NoVerify works and what issues it finds.

We will always be happy to see new people in our telegram chat, come in if you have any questions.

Telegram chat

Checkers changes

  • #1091: phpdoc renamed to missingPhpdoc

  • #1092: undefined is split into the following checkers:

    • maybeUndefined
    • undefinedConstant
    • undefinedFunction
    • undefinedMethod
    • undefinedProperty
    • undefinedType
    • undefinedVariable
  • #1096: nestedTernary is enabled by default

  • #1105: switchDefault, arrayAccess and complexity are disabled by default

  • #1120: undefinedType split into two new checks: undefinedClass and undefinedTrait.

    This checkers checks the following places:

    • Type hints
    • PHPDoc @param, @return, and @var
    • Types inside array, shape (array{}), tuple, union, nullable
  • #1121: The checks for undefinedVariable and maybeUndefined are now not given warning to variables if they are inside the expression ?? on the left or inside the isset function call:

    echo $undefinedVar ?? 100;   // ok
    if (isset($undefinedVar)) { ... } // ok
  • #1130: phpdocLint renamed to invalidDocblock

  • #1130: phpdocType renamed to invalidDocblockType

  • #1130: phpdocRef renamed to invalidDocblockRef

  • #1131: New parentNotFound checker

    class Foo {
      public function f() {
        parent::b(); // Class Foo has no parent.
      }
    }

Fixed

  • #1090: Now if there is an invalid char in the top-level modifier group, then it is not parsed
  • #1093: Output now only shows time, date and milliseconds removed
  • #1094: Now if the file from the vendor folder cannot be parsed, then an error about this is not displayed
  • #1102: Fixed quick fixes that not working properly
  • #1094: Now if the vendor folder gets analyzed, then errors in it are not taken into account
  • #1108: Now in non-strict mode, undefined method and property error will not be given also on null and stdClass
  • #1109: Added @disabled attribute for dynamic rules to disable checking by default
  • #1119: All variants of unused check set to Warning level
  • #1120: Fixed a bug where self could not be used inside a trait
  • #1125: Fixed panic on enum

Added

  • #1114: Added installation via Composer

  • #1099: Added support for anonymous classes

  • #1089: Added Playground, web page where you can try NoVerify

  • #1058: Improved type inference for complex expressions with instanceof in if-else

    /**
      * @param mixed $a
      */
    function f1($a) {
      if ($a instanceof Foo || $a instanceof Boo) {
         exprtype($a, "\Boo|\Foo");
      }
    }
    
    /**
      * @param Boo|Foo|Zoo $a
      */
    function f1($a) {
       if ($a instanceof Foo && $a instanceof Boo) {
         exprtype($a, "\Boo|\Foo");
       } else {
         exprtype($a, "\Zoo");
       }
    }

    And also added a narrowing of the type, as in the following example:

    /**
      * @param mixed $a
      */
    function f($a) {
       if (!$a instanceof Foo) {
          return;
       }
    
       exprtype($a, "\Foo");
    }
  • #1097: NoVerify now understands union types in typehints

  • #1103: Added documentation for diff mode

  • #1106: Added CONTRIBUTING.md

  • #1118: Updated README, added link to chat in telegram

  • #1112: Added quick fix for old array syntax in function arguments

  • #1120: Special scalar types from Psalm are now handled and turn into the closest common types

  • #1120: Added type never

KPHP

  • #1120: Types kmixed and future are now normalized to mixed