Installation via Composer, Playground and anonymous classes
👋 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.
Checkers changes
-
#1091:
phpdoc
renamed tomissingPhpdoc
-
#1092:
undefined
is split into the following checkers:maybeUndefined
undefinedConstant
undefinedFunction
undefinedMethod
undefinedProperty
undefinedType
undefinedVariable
-
#1096:
nestedTernary
is enabled by default -
#1105:
switchDefault
,arrayAccess
andcomplexity
are disabled by default -
#1120:
undefinedType
split into two new checks:undefinedClass
andundefinedTrait
.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
andmaybeUndefined
are now not given warning to variables if they are inside the expression??
on the left or inside theisset
function call:echo $undefinedVar ?? 100; // ok if (isset($undefinedVar)) { ... } // ok
-
#1130:
phpdocLint
renamed toinvalidDocblock
-
#1130:
phpdocType
renamed toinvalidDocblockType
-
#1130:
phpdocRef
renamed toinvalidDocblockRef
-
#1131: New
parentNotFound
checkerclass 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
andstdClass
- #1109: Added
@disabled
attribute for dynamic rules to disable checking by default - #1119: All variants of
unused
check set toWarning
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
inif-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
andfuture
are now normalized tomixed