Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to PHPParser 5 and PHPStan 2 (#6431)
* Upgrade to PHPParser 5 and PHPStan 2 * patch finally stmt * patch function stmt * patch do stmt * patch catch stmt * patch trycatch stmt * patch for stmt * patch classmethod stmt * patch else stmt * patch while stmt * patch foreach stmt * patch case stmt * patch case stmt * patch elseif stmt * patch namespace stmt * patch node traverser stmt * regenerate preload * fix build preload generator * trigger patch * fix override param method pExpr_ArrowFunction * fix override param method pExpr_Ternary * fix override param method pExpr_Yield * fix override param method p * update parameters of RichParser * Fix IsSuperTypeOfResult usage on ShortenedObjectType * disable temporary phpstan extension config * use ParserFactory::createForVersion() * upgrade to phpstan/phpdoc-parser 2.0 * register ParserConfig as service * set lines and indexes config * remove ltrim on FileProcessor, PhpParser printformat preserving no longer ltrim * remove ltrim on FileProcessor, PhpParser printformat preserving no longer ltrim * Fix PhpDocTypeMapperTest * make PrettyPrinter.php higher priority than PrettyPrinterAbstract.php * add ConstantArrayTypeMapper * Fix native return type on non native call detection * use parent default indent parameter on pFileWithoutNamespace * override pExpr_ArrowFunction method * remove override pModifiers * fix CallableTypeNode parameter construct * fix ParamTagValueNode construct parameter * fix use Token as array on CommonNotEqualRector * ConstantArrayType is sub of root PHPStan type * fix cannot set null of node on PhpDocNodeTraverser * fix use Token as array on VariableInStringInterpolationFixerRector * fix use Token as array on CompleteMissingIfElseBracketRector * fix IsSuperTypeOfResult usage on ShortenedGenericObjectType * fix pArray() override parameters * Fix InstalledPackageResolverTest * temporary remove --error-format symplify as phpstan symplify rules temporary disabled * fix SmartPhpParserFactory setup * fix compatible phpstan 2.0.1 on build * Fix Throw_ from Expr on ThrowWithPreviousExceptionRector * fix ConstantArrayType usage on ArraySpreadInsteadOfArrayMergeRector * fix use Throw_ on Expr on TerminatedNodeAnalyzer * clean up prop * fix pass ArrayItem on Foreach_ * fix ArrayItem instance * Fix ClosureUse from Node on CallUserFuncWithArrowFunctionToInlineRector * Fix union normalize of float, string, integer * Fix union normalize of float, string, integer * remove return by ref param, no longer supported on phpstan 2 * Fix use of DeclareDeclare to DeclareItem on DeclareStrictTypesRector and IncreaseDeclareStrictTypesRector * fix replace PropertyProperty to PropertyItem * fix deprecated traverse constant * fix removed FunctionVariantWithPhpDocs over ExtendedFunctionVariant * fix use ExtendedNativeParameterReflection over NativeParameterWithPhpDocsReflection * replace PropertyProperty with PropertyItem * fix namespacedName init on ClassDependencyManipulatorTest * Fix Throw_ on expr on RemoveAlwaysElseRector * fix PropertyItem over PropertyProperty on MissingPropertiesFactory * fix replace traverser on docs * Fix Throw_ stmt to Expr Throw on ChangeSwitchToMatchRector * fix Throw_ from expr on SwitchExprsResolver * fix next throw to use Expression with Throw_ as expr on MatchSwitchAnalyzer * fix sort MatchArm conds * fix magic __CLASS__ get value * fix use token as array on ParenthesizedNestedTernaryAnalyzer * [ci-review] Rector Rectify * replace deprecated class node to new node * [ci-review] Rector Rectify * fix test on FixtureJsonThrowCaseSensitiveConstFetch * Fix Throw_ from Expr on ConsecutiveNullCompareReturnsToNullCoalesceQueueRector * Fix Throw_ on SilentVoidResolver * fix node visitor stop * [ci-review] Rector Rectify * fix Throw_ on Expr * fix undefined ContantType * fix undefined ContantType * fix addVisitor() after call parent::construct() * fix check has Throw on AddNeverReturnType * [ci-review] Rector Rectify * fix check has Throw on AddNeverReturnType * fix test on JsonThrowCaseSensitiveConstFetchTest * fix arrow function text spacing * Fix ArrayItem resolve on normalize item value * prepare for doctrine value migration * setup doctrine * [ci-review] Rector Rectify * use PhpDocTagNode * clean up debug * fix ConstantArrayType * import * use createForNewestSupportedVersion * fix ConstantArrayType cast on RecastingRemovalRector * skip magic call on RecastingRemovalRector * fix use List_ node over Array_ on Foreach_ valueVar on UnusedForeachValueToArrayKeysRector * [ci-review] Rector Rectify * fix List_ on Foreach_ valueVar on PHPStanNodeScopeResolver * fix Array items always ArrayItem * skip instanceof check * skip instanceof check * fix mirror comment on StmtsManipulator * fix wrap heredoc print * fix return null next print on ExplicitReturnNullRector * fix print float/int override pScalar_int and pScalar_float * re-run rector * fix test with remove unused use on RenameClassRector test * fix ArrowFunction unnecessary parentheses * fix print in test for logical bool * fix binary op parentheses * fix on operator string + or - * fix on /, *, ** as well * add note for next todo binary op handling * fix pow opration with binary op parentheses handling * [ci-review] Rector Rectify * pull constant from NodeVisitor * only support php 7.4+ since phpstan 2 and php-parser 5 require php 7.4+ * downgrade to php 7.4 * remove php 7.2 e2e * use simple parser for defaultAnalysisParser, with native parser php 7.0 * Revert "use simple parser for defaultAnalysisParser, with native parser php 7.0" This reverts commit b3d6c45. * Fix parsing php 7 * fix Throw_ from Expr on AddOverrideAttributeToOverriddenMethodsRector * using inner try catch to ensure everything catched from root try * use constant from NodeVisitor * temporary handle later for doctrine, now focus on php-parser print * fix reprint cond on ParenthesizeNestedTernaryRector * PhpDocParser parent __construct() only have require 3 params now * disable native phpdoc-parser doctrine detection * Fix doctrine detection on ReadonlyPropertyRector * differentiate doctrine * later patch * fix InterpolatedStringPart detection for CreateFunctionToAnonymousFunctionRector on ValueResolver * print arrow function * print ArrowFunction on Carbon * fix set orig node on nested ternary on SwitchNegatedTernaryRector * Fix BinaryOp right origNode on CombineIfRector (part 1) * fix print on CombineIfRector (part 2) * Fix orig node set on ChangeNestedForeachIfsToEarlyContinueRector * [ci-review] Rector Rectify * fix set orig node on SimplifyIfReturnBoolRector * Add ReprintNodeVisitor, avoid add complexity to AbstractRector * fix reprint boolean not on SimplifyEmptyTest * fix right binary op * require --dev phpstan-phpunit 2 and phpstan-webmozart-assert 2 * ignore instanceof phpstanAPi.class notice * ignore instanceof phpstanApi.classConstant notice * ignore assert notice in test on purpose * php runtime check notice * set treatPhpDocTypesAsCertain: false * fix usage of ExtendedParametersAcceptor * ignore notice on provideMinPhpVersion() * ignore notice instanceof.alwaysTrue * fix List_ node usage on UnusedForeachValueToArrayKeysRector * ignore phpstanApi.constructor * ignore return.unusedType as follow parent signature * ignore varTag.nativeType as enforce native type * ignore phpstan notice: deadCode.unreachable as unreliable on runtime * fix always falsy on RemoveAlwaysElseRector * ignore argumet.type and return.type identifier * fix use Token as array on File value object * fix invalid ConstantScalar type usage on ValueResolver * ignore runtime comparison * fix empty array on TernaryToNullCoalescingRector * fix empty array on JsonThrowOnErrorRector * fix never null on RemoveDeadIfForeachForRector * fix useless array_values() on OverridenExistingNamesResolver * fix variable assign * fix ArrayType on TypeNormalizer * ignore phpstanApi.varTagAssumption * fix phpdoc parse error * fix isClassString() usage * fix phpstan notice * fix * fix intersection * reprint fix * fallback scope * fallback scope * [ci-review] Rector Rectify * fix phpstan * fix phpstan ArrayItem * [ci-review] Rector Rectify * First step of Doctrine works: detect doctrine class from use statement via ObjectTypeSpecifier service * fix phpstan * [ci-review] Rector Rectify * Fix alias object detection * Fix alias object detection * fix skip nette presenter * no need class exists check on fqcn * fix * fix doctrine rename on RenameClassRectorTest * add JoinColumns stubs * add InverseJoinColumn stubs * Fix named arg on NamedArgsFactory on ArrayItem * [ci-review] Rector Rectify * fix shortened object from use * Fix ClassConstFetch as key on AttributeArrayNameInliner * [ci-review] Rector Rectify * fix numeric value in attribute * fix auto import doctrine * handle numeric int as key * [ci-review] Rector Rectify * fix CurlylistNode usage on AnnotationToAttributeRector * [ci-review] Rector Rectify * fix nested attribute group apply * Fix inline array * Fix inline array * Fix printing generic * fix printing generic * add UniqueEntity stub * fix from use statement * remove unused stub * Fix multiline values * Fix multiline values * fix phpstan * fix requirement as php 7.4 * fix process single quoted * [ci-review] Rector Rectify * fix multi line * fix with description * use php 7.4 for linter * temporary update fixture to avoid crash single quote, due to phpstan-phpdoc-parser internal error * finally, unit test green * Coalesce print * fix interpolat print * [ci-review] Rector Rectify * patch ArrayItem usge on NodeFactory::createArgs() * doc indent check * handle doc indentation * [ci-review] Rector Rectify * require-dev phpstan/phpstan-deprecation-rules and fix deprecated method call * fix variable on full_build.sh * fix phsptan message return * Conditionally to not require rector/rector-src on PR 6431 for packages tests CI * final touch: enable return.type identifier phpstan * really final touch: comment * final touch: clean up always true check * final touch: clean up ignore config * really really final touch: clean up staticMethod.alreadyNarrowedType notice --------- Co-authored-by: GitHub Action <[email protected]>
- Loading branch information