From 07b013d306b49ec3fc67f189291eeee2c08057f9 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 24 Jul 2023 10:48:32 +0200 Subject: [PATCH 01/38] Enable strict_types --- phpcs.xml | 4 +- src/Psalm/Aliases.php | 4 +- src/Psalm/CodeLocation.php | 4 +- .../CodeLocation/DocblockTypeLocation.php | 4 +- src/Psalm/CodeLocation/ParseErrorLocation.php | 4 +- src/Psalm/CodeLocation/Raw.php | 4 +- src/Psalm/Codebase.php | 85 +++++------- src/Psalm/Config.php | 17 ++- src/Psalm/Config/Creator.php | 6 +- src/Psalm/Config/ErrorLevelFileFilter.php | 16 +-- src/Psalm/Config/FileFilter.php | 13 +- src/Psalm/Config/IssueHandler.php | 4 +- src/Psalm/Config/ProjectFileFilter.php | 9 +- src/Psalm/Config/TaintAnalysisFileFilter.php | 2 + src/Psalm/Context.php | 14 +- src/Psalm/DocComment.php | 2 + src/Psalm/ErrorBaseline.php | 8 +- .../Exception/CircularReferenceException.php | 2 + src/Psalm/Exception/CodeException.php | 2 + .../ComplicatedExpressionException.php | 2 + .../Exception/ConfigCreationException.php | 2 + src/Psalm/Exception/ConfigException.php | 2 + .../Exception/ConfigNotFoundException.php | 2 + .../Exception/DocblockParseException.php | 2 + src/Psalm/Exception/FileIncludeException.php | 2 + .../Exception/IncorrectDocblockException.php | 2 + .../InvalidClasslikeOverrideException.php | 2 + .../InvalidMethodOverrideException.php | 2 + src/Psalm/Exception/RefactorException.php | 2 + .../Exception/ScopeAnalysisException.php | 2 + .../Exception/TypeParseTreeException.php | 2 + .../Exception/UnanalyzedFileException.php | 2 + .../UnpopulatedClasslikeException.php | 2 + .../Exception/UnpreparedAnalysisException.php | 2 + .../UnresolvableConstantException.php | 2 + .../UnsupportedIssueToFixException.php | 2 + src/Psalm/FileBasedPluginAdapter.php | 2 + src/Psalm/FileManipulation.php | 4 +- src/Psalm/FileSource.php | 2 + src/Psalm/Internal/Algebra.php | 6 +- .../Internal/Algebra/FormulaGenerator.php | 4 +- .../Internal/Analyzer/AlgebraAnalyzer.php | 4 +- .../Internal/Analyzer/AttributesAnalyzer.php | 10 +- src/Psalm/Internal/Analyzer/CanAlias.php | 2 + src/Psalm/Internal/Analyzer/ClassAnalyzer.php | 24 ++-- .../Internal/Analyzer/ClassLikeAnalyzer.php | 16 +-- .../Analyzer/ClassLikeNameOptions.php | 4 +- .../Internal/Analyzer/ClosureAnalyzer.php | 6 +- .../Internal/Analyzer/CommentAnalyzer.php | 12 +- .../Internal/Analyzer/DataFlowNodeData.php | 4 +- src/Psalm/Internal/Analyzer/FileAnalyzer.php | 6 +- .../Internal/Analyzer/FunctionAnalyzer.php | 4 +- .../FunctionLike/ReturnTypeAnalyzer.php | 8 +- .../FunctionLike/ReturnTypeCollector.php | 8 +- .../Analyzer/FunctionLikeAnalyzer.php | 20 +-- .../Internal/Analyzer/InterfaceAnalyzer.php | 4 +- src/Psalm/Internal/Analyzer/IssueData.php | 4 +- .../Internal/Analyzer/MethodAnalyzer.php | 12 +- .../Internal/Analyzer/MethodComparator.php | 18 +-- .../Internal/Analyzer/NamespaceAnalyzer.php | 3 +- .../Internal/Analyzer/ProjectAnalyzer.php | 10 +- src/Psalm/Internal/Analyzer/ScopeAnalyzer.php | 4 +- .../Internal/Analyzer/SourceAnalyzer.php | 2 + .../Analyzer/Statements/Block/DoAnalyzer.php | 6 +- .../Analyzer/Statements/Block/ForAnalyzer.php | 4 +- .../Statements/Block/ForeachAnalyzer.php | 14 +- .../Block/IfConditionalAnalyzer.php | 6 +- .../Statements/Block/IfElse/ElseAnalyzer.php | 4 +- .../Block/IfElse/ElseIfAnalyzer.php | 4 +- .../Statements/Block/IfElse/IfAnalyzer.php | 8 +- .../Statements/Block/IfElseAnalyzer.php | 4 +- .../Statements/Block/LoopAnalyzer.php | 8 +- .../Statements/Block/SwitchAnalyzer.php | 4 +- .../Statements/Block/SwitchCaseAnalyzer.php | 10 +- .../Analyzer/Statements/Block/TryAnalyzer.php | 4 +- .../Statements/Block/WhileAnalyzer.php | 6 +- .../Analyzer/Statements/BreakAnalyzer.php | 4 +- .../Analyzer/Statements/ContinueAnalyzer.php | 4 +- .../Analyzer/Statements/EchoAnalyzer.php | 4 +- .../Statements/Expression/ArrayAnalyzer.php | 8 +- .../Expression/ArrayCreationInfo.php | 2 + .../Statements/Expression/AssertionFinder.php | 126 ++++++++---------- .../Assignment/ArrayAssignmentAnalyzer.php | 18 +-- .../Assignment/AssignedProperty.php | 4 +- .../InstancePropertyAssignmentAnalyzer.php | 22 +-- .../StaticPropertyAssignmentAnalyzer.php | 4 +- .../Expression/AssignmentAnalyzer.php | 25 ++-- .../Expression/BinaryOp/AndAnalyzer.php | 4 +- .../BinaryOp/ArithmeticOpAnalyzer.php | 31 ++--- .../Expression/BinaryOp/CoalesceAnalyzer.php | 4 +- .../Expression/BinaryOp/ConcatAnalyzer.php | 6 +- .../BinaryOp/NonComparisonOpAnalyzer.php | 4 +- .../Expression/BinaryOp/OrAnalyzer.php | 4 +- .../Expression/BinaryOpAnalyzer.php | 8 +- .../Expression/BitwiseNotAnalyzer.php | 6 +- .../Expression/BooleanNotAnalyzer.php | 4 +- .../Expression/Call/ArgumentAnalyzer.php | 14 +- .../Expression/Call/ArgumentMapPopulator.php | 4 +- .../Expression/Call/ArgumentsAnalyzer.php | 26 ++-- .../Call/ArrayFunctionArgumentsAnalyzer.php | 14 +- .../Call/ClassTemplateParamCollector.php | 8 +- .../Expression/Call/FunctionCallAnalyzer.php | 16 ++- .../Expression/Call/FunctionCallInfo.php | 2 + .../Call/FunctionCallReturnTypeFetcher.php | 10 +- .../Call/HighOrderFunctionArgHandler.php | 8 +- .../Call/HighOrderFunctionArgInfo.php | 2 +- .../Call/Method/AtomicCallContext.php | 2 + .../Method/AtomicMethodCallAnalysisResult.php | 2 + .../Call/Method/AtomicMethodCallAnalyzer.php | 16 ++- .../ExistingAtomicMethodCallAnalyzer.php | 6 +- .../Method/MethodCallProhibitionAnalyzer.php | 4 +- .../Call/Method/MethodCallPurityAnalyzer.php | 4 +- .../Method/MethodCallReturnTypeFetcher.php | 8 +- .../Call/Method/MethodVisibilityAnalyzer.php | 4 +- .../Call/Method/MissingMethodCallHandler.php | 8 +- .../Expression/Call/MethodCallAnalyzer.php | 4 +- .../Call/NamedFunctionCallHandler.php | 6 +- .../Expression/Call/NewAnalyzer.php | 10 +- .../Expression/Call/StaticCallAnalyzer.php | 6 +- .../StaticMethod/AtomicStaticCallAnalyzer.php | 14 +- .../ExistingAtomicStaticCallAnalyzer.php | 8 +- .../Statements/Expression/CallAnalyzer.php | 18 +-- .../Statements/Expression/CastAnalyzer.php | 14 +- .../Expression/ClassConstAnalyzer.php | 10 +- .../Statements/Expression/CloneAnalyzer.php | 4 +- .../Statements/Expression/EmptyAnalyzer.php | 4 +- .../Expression/EncapsulatedStringAnalyzer.php | 4 +- .../Statements/Expression/EvalAnalyzer.php | 4 +- .../Statements/Expression/ExitAnalyzer.php | 4 +- .../Expression/ExpressionIdentifier.php | 8 +- .../Expression/Fetch/ArrayFetchAnalyzer.php | 28 ++-- .../Fetch/AtomicPropertyFetchAnalyzer.php | 26 ++-- .../Expression/Fetch/ConstFetchAnalyzer.php | 14 +- .../Fetch/InstancePropertyFetchAnalyzer.php | 6 +- .../Fetch/StaticPropertyFetchAnalyzer.php | 6 +- .../Fetch/VariableFetchAnalyzer.php | 8 +- .../Expression/IncDecExpressionAnalyzer.php | 4 +- .../Statements/Expression/IncludeAnalyzer.php | 6 +- .../Expression/InstanceofAnalyzer.php | 4 +- .../Statements/Expression/IssetAnalyzer.php | 6 +- .../Expression/MagicConstAnalyzer.php | 4 +- .../Statements/Expression/MatchAnalyzer.php | 6 +- .../Expression/NullsafeAnalyzer.php | 4 +- .../Statements/Expression/PrintAnalyzer.php | 4 +- .../Expression/SimpleTypeInferer.php | 10 +- .../Statements/Expression/TernaryAnalyzer.php | 4 +- .../Expression/UnaryPlusMinusAnalyzer.php | 6 +- .../Statements/Expression/YieldAnalyzer.php | 4 +- .../Expression/YieldFromAnalyzer.php | 4 +- .../Statements/ExpressionAnalyzer.php | 12 +- .../Analyzer/Statements/GlobalAnalyzer.php | 4 +- .../Analyzer/Statements/ReturnAnalyzer.php | 10 +- .../Analyzer/Statements/StaticAnalyzer.php | 4 +- .../Analyzer/Statements/ThrowAnalyzer.php | 4 +- .../Analyzer/Statements/UnsetAnalyzer.php | 4 +- .../Statements/UnusedAssignmentRemover.php | 8 +- .../Internal/Analyzer/StatementsAnalyzer.php | 16 ++- src/Psalm/Internal/Analyzer/TraitAnalyzer.php | 4 +- src/Psalm/Internal/Analyzer/TypeAnalyzer.php | 2 + src/Psalm/Internal/Cache.php | 12 +- src/Psalm/Internal/Clause.php | 4 +- src/Psalm/Internal/Cli/LanguageServer.php | 2 + src/Psalm/Internal/Cli/Plugin.php | 2 + src/Psalm/Internal/Cli/Psalm.php | 31 +++-- src/Psalm/Internal/Cli/Psalter.php | 2 + src/Psalm/Internal/Cli/Refactor.php | 2 + src/Psalm/Internal/CliUtils.php | 9 +- src/Psalm/Internal/Codebase/Analyzer.php | 12 +- src/Psalm/Internal/Codebase/ClassLikes.php | 38 +++--- .../Codebase/ConstantTypeResolver.php | 8 +- src/Psalm/Internal/Codebase/DataFlowGraph.php | 6 +- src/Psalm/Internal/Codebase/Functions.php | 10 +- .../Codebase/InternalCallMapHandler.php | 6 +- src/Psalm/Internal/Codebase/Methods.php | 24 ++-- src/Psalm/Internal/Codebase/Populator.php | 26 ++-- src/Psalm/Internal/Codebase/Properties.php | 12 +- src/Psalm/Internal/Codebase/PropertyMap.php | 2 + .../Codebase/ReferenceMapGenerator.php | 4 +- src/Psalm/Internal/Codebase/Reflection.php | 6 +- src/Psalm/Internal/Codebase/Scanner.php | 10 +- .../Codebase/StorageByPatternResolver.php | 4 +- .../Internal/Codebase/TaintFlowGraph.php | 4 +- .../Internal/Codebase/VariableUseGraph.php | 8 +- src/Psalm/Internal/Composer.php | 2 + src/Psalm/Internal/DataFlow/DataFlowNode.php | 10 +- src/Psalm/Internal/DataFlow/Path.php | 4 +- src/Psalm/Internal/DataFlow/TaintSink.php | 2 + src/Psalm/Internal/DataFlow/TaintSource.php | 2 + src/Psalm/Internal/Diff/AstDiffer.php | 2 +- .../Internal/Diff/ClassStatementsDiffer.php | 4 +- src/Psalm/Internal/Diff/DiffElem.php | 10 +- src/Psalm/Internal/Diff/FileDiffer.php | 2 +- .../Internal/Diff/FileStatementsDiffer.php | 4 +- .../Diff/NamespaceStatementsDiffer.php | 4 +- src/Psalm/Internal/ErrorHandler.php | 4 +- src/Psalm/Internal/EventDispatcher.php | 2 + .../BuildInfoCollector.php | 2 + .../ExecutionEnvironment/GitInfoCollector.php | 2 + .../SystemCommandExecutor.php | 2 + .../ClassDocblockManipulator.php | 6 +- .../FileManipulation/CodeMigration.php | 4 +- .../FileManipulationBuffer.php | 6 +- .../FunctionDocblockManipulator.php | 11 +- .../PropertyDocblockManipulator.php | 8 +- src/Psalm/Internal/Fork/ForkMessage.php | 2 + .../Internal/Fork/ForkProcessDoneMessage.php | 10 +- .../Internal/Fork/ForkProcessErrorMessage.php | 2 + .../Internal/Fork/ForkTaskDoneMessage.php | 10 +- src/Psalm/Internal/Fork/Pool.php | 4 +- src/Psalm/Internal/Fork/PsalmRestarter.php | 2 + src/Psalm/Internal/IncludeCollector.php | 2 + src/Psalm/Internal/Json/Json.php | 5 +- .../LanguageServer/ClientConfiguration.php | 2 +- .../Internal/LanguageServer/ClientHandler.php | 4 +- .../LanguageServer/EmitterInterface.php | 2 +- .../Internal/LanguageServer/EmitterTrait.php | 2 +- .../LanguageServer/LanguageClient.php | 7 +- .../LanguageServer/LanguageServer.php | 9 +- .../LanguageServer/PHPMarkdownContent.php | 6 +- .../Internal/LanguageServer/Progress.php | 2 + .../ClassLikeStorageCacheProvider.php | 4 +- .../Provider/FileReferenceCacheProvider.php | 2 + .../Provider/FileStorageCacheProvider.php | 2 + .../Provider/ParserCacheProvider.php | 6 +- .../Provider/ProjectCacheProvider.php | 2 + .../Internal/LanguageServer/Reference.php | 2 + .../LanguageServer/Server/TextDocument.php | 2 +- .../LanguageServer/Server/Workspace.php | 8 +- src/Psalm/Internal/MethodIdentifier.php | 5 +- .../PhpVisitor/AssignmentMapVisitor.php | 2 + .../PhpVisitor/CheckTrivialExprVisitor.php | 2 + .../PhpVisitor/NodeCleanerVisitor.php | 2 + .../PhpVisitor/NodeCounterVisitor.php | 2 + .../PhpVisitor/OffsetShifterVisitor.php | 2 + .../PhpVisitor/ParamReplacementVisitor.php | 2 + .../PhpVisitor/PartialParserVisitor.php | 9 +- .../Reflector/AttributeResolver.php | 4 +- .../Reflector/ClassLikeDocblockParser.php | 6 +- .../Reflector/ClassLikeNodeScanner.php | 22 +-- .../Reflector/ExpressionResolver.php | 8 +- .../Reflector/ExpressionScanner.php | 8 +- .../Reflector/FunctionLikeDocblockParser.php | 8 +- .../Reflector/FunctionLikeDocblockScanner.php | 24 ++-- .../Reflector/FunctionLikeNodeScanner.php | 11 +- .../PhpVisitor/Reflector/TypeHintResolver.php | 4 +- .../Internal/PhpVisitor/ReflectorVisitor.php | 4 +- .../PhpVisitor/ShortClosureVisitor.php | 2 + .../PhpVisitor/SimpleNameResolver.php | 2 + src/Psalm/Internal/PhpVisitor/TraitFinder.php | 2 + .../PhpVisitor/TypeMappingVisitor.php | 2 +- .../PhpVisitor/YieldTypeCollector.php | 2 + .../PluginManager/Command/DisableCommand.php | 2 + .../PluginManager/Command/EnableCommand.php | 2 + .../PluginManager/Command/ShowCommand.php | 2 + .../Internal/PluginManager/ComposerLock.php | 5 +- .../Internal/PluginManager/ConfigFile.php | 2 + .../Internal/PluginManager/PluginList.php | 2 + .../PluginManager/PluginListFactory.php | 2 + .../AddRemoveTaints/HtmlFunctionTainter.php | 2 + .../ClassLikeStorageCacheProvider.php | 6 +- .../Provider/ClassLikeStorageProvider.php | 2 + .../DynamicFunctionStorageProvider.php | 2 +- .../Internal/Provider/FakeFileProvider.php | 2 + src/Psalm/Internal/Provider/FileProvider.php | 2 + .../Provider/FileReferenceCacheProvider.php | 11 +- .../Provider/FileReferenceProvider.php | 12 +- .../Provider/FileStorageCacheProvider.php | 2 + .../Internal/Provider/FileStorageProvider.php | 2 + .../Provider/FunctionExistenceProvider.php | 4 +- .../Provider/FunctionParamsProvider.php | 4 +- .../Provider/FunctionReturnTypeProvider.php | 4 +- .../Provider/MethodExistenceProvider.php | 4 +- .../Provider/MethodParamsProvider.php | 4 +- .../Provider/MethodReturnTypeProvider.php | 7 +- .../Provider/MethodVisibilityProvider.php | 4 +- .../Internal/Provider/NodeDataProvider.php | 2 + .../Internal/Provider/ParserCacheProvider.php | 8 +- .../Provider/ProjectCacheProvider.php | 2 + .../Provider/PropertyExistenceProvider.php | 4 +- .../Provider/PropertyTypeProvider.php | 4 +- .../Provider/PropertyVisibilityProvider.php | 4 +- src/Psalm/Internal/Provider/Providers.php | 4 +- .../ArrayColumnReturnTypeProvider.php | 4 +- .../ArrayCombineReturnTypeProvider.php | 3 +- .../ArrayFillKeysReturnTypeProvider.php | 2 + .../ArrayFillReturnTypeProvider.php | 2 + .../ArrayFilterReturnTypeProvider.php | 2 + .../ArrayMapReturnTypeProvider.php | 6 +- .../ArrayMergeReturnTypeProvider.php | 2 + ...rayPointerAdjustmentReturnTypeProvider.php | 2 + .../ArrayPopReturnTypeProvider.php | 2 + .../ArrayRandReturnTypeProvider.php | 2 + .../ArrayReduceReturnTypeProvider.php | 2 + .../ArrayReverseReturnTypeProvider.php | 2 + .../ArraySliceReturnTypeProvider.php | 2 + .../ArraySpliceReturnTypeProvider.php | 2 + .../ClosureFromCallableReturnTypeProvider.php | 2 + .../DateTimeModifyReturnTypeProvider.php | 2 + .../ReturnTypeProvider/DomNodeAppendChild.php | 2 + .../FilterVarReturnTypeProvider.php | 2 + .../FirstArgStringReturnTypeProvider.php | 2 + .../GetClassMethodsReturnTypeProvider.php | 2 + .../GetObjectVarsReturnTypeProvider.php | 2 +- .../HexdecReturnTypeProvider.php | 2 + .../ImagickPixelColorReturnTypeProvider.php | 2 + .../InArrayReturnTypeProvider.php | 2 + .../IteratorToArrayReturnTypeProvider.php | 2 + .../MktimeReturnTypeProvider.php | 2 + .../ParseUrlReturnTypeProvider.php | 2 + .../PdoStatementReturnTypeProvider.php | 2 + .../PdoStatementSetFetchMode.php | 2 + .../PowReturnTypeProvider.php | 2 + .../SimpleXmlElementAsXml.php | 2 + .../SprintfReturnTypeProvider.php | 2 + .../StrReplaceReturnTypeProvider.php | 2 + .../StrTrReturnTypeProvider.php | 2 + .../VersionCompareReturnTypeProvider.php | 2 + .../Internal/Provider/StatementsProvider.php | 13 +- src/Psalm/Internal/ReferenceConstraint.php | 2 + src/Psalm/Internal/RuntimeCaches.php | 2 + .../Scanner/ClassLikeDocblockComment.php | 2 + src/Psalm/Internal/Scanner/DocblockParser.php | 2 + src/Psalm/Internal/Scanner/FileScanner.php | 4 +- .../Scanner/FunctionDocblockComment.php | 2 + src/Psalm/Internal/Scanner/ParsedDocblock.php | 2 + .../Internal/Scanner/PhpStormMetaScanner.php | 26 ++-- .../UnresolvedConstant/ArrayOffsetFetch.php | 2 + .../UnresolvedConstant/ArraySpread.php | 2 + .../Scanner/UnresolvedConstant/ArrayValue.php | 2 + .../UnresolvedConstant/ClassConstant.php | 2 + .../Scanner/UnresolvedConstant/Constant.php | 2 + .../UnresolvedConstant/EnumNameFetch.php | 2 + .../UnresolvedConstant/EnumPropertyFetch.php | 2 + .../UnresolvedConstant/EnumValueFetch.php | 2 + .../UnresolvedConstant/KeyValuePair.php | 2 + .../UnresolvedConstant/ScalarValue.php | 8 +- .../UnresolvedAdditionOp.php | 2 + .../UnresolvedConstant/UnresolvedBinaryOp.php | 2 + .../UnresolvedBitwiseAnd.php | 2 + .../UnresolvedBitwiseOr.php | 2 + .../UnresolvedBitwiseXor.php | 2 + .../UnresolvedConstant/UnresolvedConcatOp.php | 2 + .../UnresolvedDivisionOp.php | 2 + .../UnresolvedMultiplicationOp.php | 2 + .../UnresolvedSubtractionOp.php | 2 + .../UnresolvedConstant/UnresolvedTernary.php | 4 +- .../Scanner/UnresolvedConstantComponent.php | 2 + .../Internal/Scanner/VarDocblockComment.php | 2 + src/Psalm/Internal/Scope/CaseScope.php | 2 + src/Psalm/Internal/Scope/FinallyScope.php | 2 + .../Internal/Scope/IfConditionalScope.php | 4 +- src/Psalm/Internal/Scope/IfScope.php | 2 + src/Psalm/Internal/Scope/LoopScope.php | 2 + src/Psalm/Internal/Scope/SwitchScope.php | 2 + .../Generator/ClassLikeStubGenerator.php | 2 +- .../Stubs/Generator/StubsGenerator.php | 2 +- .../Internal/Type/AssertionReconciler.php | 30 +++-- .../Type/Comparator/ArrayTypeComparator.php | 4 +- .../Type/Comparator/AtomicTypeComparator.php | 6 +- .../Comparator/CallableTypeComparator.php | 12 +- .../Comparator/ClassLikeStringComparator.php | 4 +- .../Type/Comparator/GenericTypeComparator.php | 4 +- .../Comparator/IntegerRangeComparator.php | 6 +- .../Type/Comparator/KeyedArrayComparator.php | 8 +- .../Type/Comparator/ObjectComparator.php | 6 +- .../Type/Comparator/ScalarTypeComparator.php | 4 +- .../Type/Comparator/TypeComparisonResult.php | 2 + .../Type/Comparator/UnionTypeComparator.php | 12 +- .../Type/NegatedAssertionReconciler.php | 6 +- src/Psalm/Internal/Type/ParseTree.php | 2 + .../Type/ParseTree/CallableParamTree.php | 2 + .../Internal/Type/ParseTree/CallableTree.php | 2 + .../ParseTree/CallableWithReturnTypeTree.php | 2 + .../Type/ParseTree/ConditionalTree.php | 2 + .../Type/ParseTree/EncapsulationTree.php | 2 + .../Internal/Type/ParseTree/FieldEllipsis.php | 2 + .../Internal/Type/ParseTree/GenericTree.php | 2 + .../Type/ParseTree/IndexedAccessTree.php | 2 + .../Type/ParseTree/IntersectionTree.php | 2 + .../Type/ParseTree/KeyedArrayPropertyTree.php | 2 + .../Type/ParseTree/KeyedArrayTree.php | 2 + .../Type/ParseTree/MethodParamTree.php | 4 +- .../Internal/Type/ParseTree/MethodTree.php | 2 + .../ParseTree/MethodWithReturnTypeTree.php | 2 + .../Internal/Type/ParseTree/NullableTree.php | 2 + src/Psalm/Internal/Type/ParseTree/Root.php | 2 + .../Type/ParseTree/TemplateAsTree.php | 2 + .../Type/ParseTree/TemplateIsTree.php | 2 + .../Internal/Type/ParseTree/UnionTree.php | 2 + src/Psalm/Internal/Type/ParseTree/Value.php | 4 +- src/Psalm/Internal/Type/ParseTreeCreator.php | 2 + .../Type/SimpleAssertionReconciler.php | 58 ++++---- .../Type/SimpleNegatedAssertionReconciler.php | 38 +++--- src/Psalm/Internal/Type/TemplateBound.php | 4 +- .../Type/TemplateInferredTypeReplacer.php | 12 +- src/Psalm/Internal/Type/TemplateResult.php | 2 + .../Type/TemplateStandinTypeReplacer.php | 18 +-- src/Psalm/Internal/Type/TypeAlias.php | 2 + .../Type/TypeAlias/ClassTypeAlias.php | 2 + .../Type/TypeAlias/InlineTypeAlias.php | 2 + .../Type/TypeAlias/LinkableTypeAlias.php | 4 +- src/Psalm/Internal/Type/TypeCombination.php | 2 + src/Psalm/Internal/Type/TypeCombiner.php | 14 +- src/Psalm/Internal/Type/TypeExpander.php | 33 ++--- src/Psalm/Internal/Type/TypeParser.php | 33 +++-- src/Psalm/Internal/Type/TypeTokenizer.php | 6 +- .../CanContainObjectTypeVisitor.php | 2 + .../TypeVisitor/ClasslikeReplacer.php | 4 +- .../TypeVisitor/ContainsClassLikeVisitor.php | 2 + .../TypeVisitor/ContainsLiteralVisitor.php | 2 + .../TypeVisitor/ContainsStaticVisitor.php | 2 + .../TypeVisitor/FromDocblockSetter.php | 2 + .../TypeVisitor/TemplateTypeCollector.php | 2 + .../Internal/TypeVisitor/TypeChecker.php | 4 +- .../Internal/TypeVisitor/TypeLocalizer.php | 4 +- .../Internal/TypeVisitor/TypeScanner.php | 4 +- src/Psalm/Internal/VersionUtils.php | 2 + src/Psalm/Issue/AbstractInstantiation.php | 2 + src/Psalm/Issue/AbstractMethodCall.php | 2 + .../Issue/AmbiguousConstantInheritance.php | 2 + src/Psalm/Issue/ArgumentIssue.php | 4 +- src/Psalm/Issue/ArgumentTypeCoercion.php | 2 + src/Psalm/Issue/AssignmentToVoid.php | 2 + src/Psalm/Issue/CheckType.php | 2 + src/Psalm/Issue/CircularReference.php | 2 + src/Psalm/Issue/ClassConstantIssue.php | 4 +- src/Psalm/Issue/ClassIssue.php | 4 +- src/Psalm/Issue/CodeIssue.php | 4 +- src/Psalm/Issue/ComplexFunction.php | 2 + src/Psalm/Issue/ComplexMethod.php | 2 + src/Psalm/Issue/ConfigIssue.php | 2 + .../Issue/ConflictingReferenceConstraint.php | 2 + .../Issue/ConstructorSignatureMismatch.php | 2 + src/Psalm/Issue/ContinueOutsideLoop.php | 2 + src/Psalm/Issue/DeprecatedClass.php | 2 + src/Psalm/Issue/DeprecatedConstant.php | 2 + src/Psalm/Issue/DeprecatedFunction.php | 2 + src/Psalm/Issue/DeprecatedInterface.php | 2 + src/Psalm/Issue/DeprecatedMethod.php | 2 + src/Psalm/Issue/DeprecatedProperty.php | 2 + src/Psalm/Issue/DeprecatedTrait.php | 2 + src/Psalm/Issue/DirectConstructorCall.php | 2 + src/Psalm/Issue/DocblockTypeContradiction.php | 2 + src/Psalm/Issue/DuplicateArrayKey.php | 2 + src/Psalm/Issue/DuplicateClass.php | 2 + src/Psalm/Issue/DuplicateConstant.php | 2 + src/Psalm/Issue/DuplicateEnumCase.php | 2 + src/Psalm/Issue/DuplicateEnumCaseValue.php | 2 + src/Psalm/Issue/DuplicateFunction.php | 2 + src/Psalm/Issue/DuplicateMethod.php | 2 + src/Psalm/Issue/DuplicateParam.php | 2 + src/Psalm/Issue/EmptyArrayAccess.php | 2 + .../Issue/ExtensionRequirementViolation.php | 2 + src/Psalm/Issue/FalsableReturnStatement.php | 2 + src/Psalm/Issue/FalseOperand.php | 2 + src/Psalm/Issue/ForbiddenCode.php | 2 + src/Psalm/Issue/FunctionIssue.php | 4 +- src/Psalm/Issue/IfThisIsMismatch.php | 2 + .../ImplementationRequirementViolation.php | 2 + .../Issue/ImplementedParamTypeMismatch.php | 2 + .../Issue/ImplementedReturnTypeMismatch.php | 2 + src/Psalm/Issue/ImplicitToStringCast.php | 2 + .../Issue/ImpureByReferenceAssignment.php | 2 + src/Psalm/Issue/ImpureFunctionCall.php | 2 + src/Psalm/Issue/ImpureMethodCall.php | 2 + src/Psalm/Issue/ImpurePropertyAssignment.php | 2 + src/Psalm/Issue/ImpurePropertyFetch.php | 2 + src/Psalm/Issue/ImpureStaticProperty.php | 2 + src/Psalm/Issue/ImpureStaticVariable.php | 2 + src/Psalm/Issue/ImpureVariable.php | 2 + src/Psalm/Issue/InaccessibleClassConstant.php | 2 + src/Psalm/Issue/InaccessibleMethod.php | 2 + src/Psalm/Issue/InaccessibleProperty.php | 2 + src/Psalm/Issue/InheritorViolation.php | 2 + src/Psalm/Issue/InterfaceInstantiation.php | 2 + src/Psalm/Issue/InternalClass.php | 2 + src/Psalm/Issue/InternalMethod.php | 2 + src/Psalm/Issue/InternalProperty.php | 2 + src/Psalm/Issue/InvalidArgument.php | 2 + src/Psalm/Issue/InvalidArrayAccess.php | 2 + src/Psalm/Issue/InvalidArrayAssignment.php | 2 + src/Psalm/Issue/InvalidArrayOffset.php | 2 + src/Psalm/Issue/InvalidAttribute.php | 2 + src/Psalm/Issue/InvalidCast.php | 2 + src/Psalm/Issue/InvalidCatch.php | 2 + src/Psalm/Issue/InvalidClass.php | 2 + src/Psalm/Issue/InvalidClassConstantType.php | 2 + src/Psalm/Issue/InvalidClone.php | 2 + .../Issue/InvalidConstantAssignmentValue.php | 2 + src/Psalm/Issue/InvalidDocblock.php | 2 + src/Psalm/Issue/InvalidDocblockParamName.php | 2 + src/Psalm/Issue/InvalidEnumBackingType.php | 2 + src/Psalm/Issue/InvalidEnumCaseValue.php | 2 + src/Psalm/Issue/InvalidEnumMethod.php | 2 + src/Psalm/Issue/InvalidExtendClass.php | 2 + src/Psalm/Issue/InvalidFalsableReturnType.php | 2 + src/Psalm/Issue/InvalidFunctionCall.php | 2 + src/Psalm/Issue/InvalidGlobal.php | 2 + .../Issue/InvalidInterfaceImplementation.php | 2 + src/Psalm/Issue/InvalidIterator.php | 2 + src/Psalm/Issue/InvalidLiteralArgument.php | 2 + src/Psalm/Issue/InvalidMethodCall.php | 2 + src/Psalm/Issue/InvalidNamedArgument.php | 2 + src/Psalm/Issue/InvalidNullableReturnType.php | 2 + src/Psalm/Issue/InvalidOperand.php | 2 + src/Psalm/Issue/InvalidParamDefault.php | 2 + src/Psalm/Issue/InvalidParent.php | 2 + src/Psalm/Issue/InvalidPassByReference.php | 2 + src/Psalm/Issue/InvalidPropertyAssignment.php | 2 + .../Issue/InvalidPropertyAssignmentValue.php | 2 + src/Psalm/Issue/InvalidPropertyFetch.php | 2 + src/Psalm/Issue/InvalidReturnStatement.php | 2 + src/Psalm/Issue/InvalidReturnType.php | 2 + src/Psalm/Issue/InvalidScalarArgument.php | 2 + src/Psalm/Issue/InvalidScope.php | 2 + src/Psalm/Issue/InvalidStaticInvocation.php | 2 + src/Psalm/Issue/InvalidStringClass.php | 2 + src/Psalm/Issue/InvalidTemplateParam.php | 2 + src/Psalm/Issue/InvalidThrow.php | 2 + src/Psalm/Issue/InvalidToString.php | 2 + .../InvalidTraversableImplementation.php | 2 + src/Psalm/Issue/InvalidTypeImport.php | 2 + .../Issue/LessSpecificClassConstantType.php | 2 + .../LessSpecificImplementedReturnType.php | 2 + .../Issue/LessSpecificReturnStatement.php | 2 + src/Psalm/Issue/LessSpecificReturnType.php | 2 + src/Psalm/Issue/LoopInvalidation.php | 2 + src/Psalm/Issue/MethodIssue.php | 4 +- src/Psalm/Issue/MethodSignatureMismatch.php | 2 + .../MethodSignatureMustOmitReturnType.php | 2 + .../MethodSignatureMustProvideReturnType.php | 2 + .../Issue/MismatchingDocblockParamType.php | 2 + .../Issue/MismatchingDocblockPropertyType.php | 2 + .../Issue/MismatchingDocblockReturnType.php | 2 + src/Psalm/Issue/MissingClosureParamType.php | 2 + src/Psalm/Issue/MissingClosureReturnType.php | 2 + src/Psalm/Issue/MissingConstructor.php | 2 + src/Psalm/Issue/MissingDependency.php | 2 + src/Psalm/Issue/MissingDocblockType.php | 2 + src/Psalm/Issue/MissingFile.php | 2 + .../Issue/MissingImmutableAnnotation.php | 2 + src/Psalm/Issue/MissingParamType.php | 2 + src/Psalm/Issue/MissingPropertyType.php | 2 + src/Psalm/Issue/MissingReturnType.php | 2 + src/Psalm/Issue/MissingTemplateParam.php | 2 + src/Psalm/Issue/MissingThrowsDocblock.php | 2 + src/Psalm/Issue/MixedArgument.php | 4 +- src/Psalm/Issue/MixedArgumentTypeCoercion.php | 4 +- src/Psalm/Issue/MixedArrayAccess.php | 2 + src/Psalm/Issue/MixedArrayAssignment.php | 2 + src/Psalm/Issue/MixedArrayOffset.php | 2 + src/Psalm/Issue/MixedArrayTypeCoercion.php | 2 + src/Psalm/Issue/MixedAssignment.php | 2 + src/Psalm/Issue/MixedClone.php | 2 + src/Psalm/Issue/MixedFunctionCall.php | 2 + src/Psalm/Issue/MixedInferredReturnType.php | 2 + src/Psalm/Issue/MixedIssue.php | 2 + src/Psalm/Issue/MixedIssueTrait.php | 4 +- src/Psalm/Issue/MixedMethodCall.php | 2 + src/Psalm/Issue/MixedOperand.php | 2 + src/Psalm/Issue/MixedPropertyAssignment.php | 2 + src/Psalm/Issue/MixedPropertyFetch.php | 2 + src/Psalm/Issue/MixedPropertyTypeCoercion.php | 4 +- src/Psalm/Issue/MixedReturnStatement.php | 2 + src/Psalm/Issue/MixedReturnTypeCoercion.php | 2 + .../Issue/MixedStringOffsetAssignment.php | 2 + .../MoreSpecificImplementedParamType.php | 2 + src/Psalm/Issue/MoreSpecificReturnType.php | 2 + src/Psalm/Issue/MutableDependency.php | 2 + src/Psalm/Issue/NamedArgumentNotAllowed.php | 2 + src/Psalm/Issue/NoEnumProperties.php | 2 + src/Psalm/Issue/NoInterfaceProperties.php | 2 + src/Psalm/Issue/NoValue.php | 2 + src/Psalm/Issue/NonStaticSelfCall.php | 2 + src/Psalm/Issue/NullArgument.php | 2 + src/Psalm/Issue/NullArrayAccess.php | 2 + src/Psalm/Issue/NullArrayOffset.php | 2 + src/Psalm/Issue/NullFunctionCall.php | 2 + src/Psalm/Issue/NullIterator.php | 2 + src/Psalm/Issue/NullOperand.php | 2 + src/Psalm/Issue/NullPropertyAssignment.php | 2 + src/Psalm/Issue/NullPropertyFetch.php | 2 + src/Psalm/Issue/NullReference.php | 2 + src/Psalm/Issue/NullableReturnStatement.php | 2 + src/Psalm/Issue/OverriddenFinalConstant.php | 2 + .../Issue/OverriddenInterfaceConstant.php | 2 + src/Psalm/Issue/OverriddenMethodAccess.php | 2 + src/Psalm/Issue/OverriddenPropertyAccess.php | 2 + src/Psalm/Issue/ParadoxicalCondition.php | 2 + src/Psalm/Issue/ParamNameMismatch.php | 2 + src/Psalm/Issue/ParentNotFound.php | 2 + src/Psalm/Issue/ParseError.php | 2 + src/Psalm/Issue/PluginIssue.php | 2 + .../Issue/PossibleRawObjectIteration.php | 2 + src/Psalm/Issue/PossiblyFalseArgument.php | 2 + src/Psalm/Issue/PossiblyFalseIterator.php | 2 + src/Psalm/Issue/PossiblyFalseOperand.php | 2 + .../PossiblyFalsePropertyAssignmentValue.php | 2 + src/Psalm/Issue/PossiblyFalseReference.php | 2 + src/Psalm/Issue/PossiblyInvalidArgument.php | 2 + .../Issue/PossiblyInvalidArrayAccess.php | 2 + .../Issue/PossiblyInvalidArrayAssignment.php | 2 + .../Issue/PossiblyInvalidArrayOffset.php | 2 + src/Psalm/Issue/PossiblyInvalidCast.php | 2 + src/Psalm/Issue/PossiblyInvalidClone.php | 2 + .../Issue/PossiblyInvalidDocblockTag.php | 2 + .../Issue/PossiblyInvalidFunctionCall.php | 2 + src/Psalm/Issue/PossiblyInvalidIterator.php | 2 + src/Psalm/Issue/PossiblyInvalidMethodCall.php | 2 + src/Psalm/Issue/PossiblyInvalidOperand.php | 2 + .../PossiblyInvalidPropertyAssignment.php | 2 + ...PossiblyInvalidPropertyAssignmentValue.php | 2 + .../Issue/PossiblyInvalidPropertyFetch.php | 2 + src/Psalm/Issue/PossiblyNullArgument.php | 2 + src/Psalm/Issue/PossiblyNullArrayAccess.php | 2 + .../Issue/PossiblyNullArrayAssignment.php | 2 + src/Psalm/Issue/PossiblyNullArrayOffset.php | 2 + src/Psalm/Issue/PossiblyNullFunctionCall.php | 2 + src/Psalm/Issue/PossiblyNullIterator.php | 2 + src/Psalm/Issue/PossiblyNullOperand.php | 2 + .../Issue/PossiblyNullPropertyAssignment.php | 2 + .../PossiblyNullPropertyAssignmentValue.php | 2 + src/Psalm/Issue/PossiblyNullPropertyFetch.php | 2 + src/Psalm/Issue/PossiblyNullReference.php | 2 + .../Issue/PossiblyUndefinedArrayOffset.php | 2 + .../Issue/PossiblyUndefinedGlobalVariable.php | 2 + .../Issue/PossiblyUndefinedIntArrayOffset.php | 2 + src/Psalm/Issue/PossiblyUndefinedMethod.php | 2 + .../PossiblyUndefinedStringArrayOffset.php | 2 + src/Psalm/Issue/PossiblyUndefinedVariable.php | 2 + src/Psalm/Issue/PossiblyUnusedMethod.php | 4 +- src/Psalm/Issue/PossiblyUnusedParam.php | 2 + src/Psalm/Issue/PossiblyUnusedProperty.php | 4 +- src/Psalm/Issue/PossiblyUnusedReturnValue.php | 2 + src/Psalm/Issue/PrivateFinalMethod.php | 2 + src/Psalm/Issue/PropertyIssue.php | 4 +- .../Issue/PropertyNotSetInConstructor.php | 4 +- src/Psalm/Issue/PropertyTypeCoercion.php | 2 + src/Psalm/Issue/PsalmInternalError.php | 2 + src/Psalm/Issue/RawObjectIteration.php | 2 + src/Psalm/Issue/RedundantCast.php | 2 + .../Issue/RedundantCastGivenDocblockType.php | 2 + src/Psalm/Issue/RedundantCondition.php | 2 + .../RedundantConditionGivenDocblockType.php | 2 + src/Psalm/Issue/RedundantFunctionCall.php | 2 + ...RedundantFunctionCallGivenDocblockType.php | 2 + src/Psalm/Issue/RedundantIdentityWithTrue.php | 2 + .../RedundantPropertyInitializationCheck.php | 2 + .../Issue/ReferenceConstraintViolation.php | 2 + .../ReferenceReusedFromConfusingScope.php | 2 + src/Psalm/Issue/ReservedWord.php | 2 + src/Psalm/Issue/RiskyCast.php | 2 + src/Psalm/Issue/StringIncrement.php | 2 + src/Psalm/Issue/TaintedCallable.php | 2 + src/Psalm/Issue/TaintedCookie.php | 2 + src/Psalm/Issue/TaintedCustom.php | 2 + src/Psalm/Issue/TaintedEval.php | 2 + src/Psalm/Issue/TaintedFile.php | 2 + src/Psalm/Issue/TaintedHeader.php | 2 + src/Psalm/Issue/TaintedHtml.php | 2 + src/Psalm/Issue/TaintedInclude.php | 2 + src/Psalm/Issue/TaintedInput.php | 6 +- src/Psalm/Issue/TaintedLdap.php | 2 + src/Psalm/Issue/TaintedSSRF.php | 2 + src/Psalm/Issue/TaintedShell.php | 2 + src/Psalm/Issue/TaintedSql.php | 2 + src/Psalm/Issue/TaintedSystemSecret.php | 2 + src/Psalm/Issue/TaintedTextWithQuotes.php | 2 + src/Psalm/Issue/TaintedUnserialize.php | 2 + src/Psalm/Issue/TaintedUserSecret.php | 2 + src/Psalm/Issue/TooFewArguments.php | 2 + src/Psalm/Issue/TooManyArguments.php | 2 + src/Psalm/Issue/TooManyTemplateParams.php | 2 + src/Psalm/Issue/Trace.php | 2 + .../Issue/TraitMethodSignatureMismatch.php | 2 + src/Psalm/Issue/TypeDoesNotContainNull.php | 2 + src/Psalm/Issue/TypeDoesNotContainType.php | 2 + .../Issue/UncaughtThrowInGlobalScope.php | 2 + src/Psalm/Issue/UndefinedAttributeClass.php | 2 + src/Psalm/Issue/UndefinedClass.php | 2 + src/Psalm/Issue/UndefinedConstant.php | 2 + src/Psalm/Issue/UndefinedDocblockClass.php | 2 + src/Psalm/Issue/UndefinedFunction.php | 2 + src/Psalm/Issue/UndefinedGlobalVariable.php | 2 + src/Psalm/Issue/UndefinedInterface.php | 2 + src/Psalm/Issue/UndefinedInterfaceMethod.php | 2 + src/Psalm/Issue/UndefinedMagicMethod.php | 2 + .../UndefinedMagicPropertyAssignment.php | 2 + .../Issue/UndefinedMagicPropertyFetch.php | 2 + src/Psalm/Issue/UndefinedMethod.php | 2 + .../Issue/UndefinedPropertyAssignment.php | 2 + src/Psalm/Issue/UndefinedPropertyFetch.php | 2 + .../Issue/UndefinedThisPropertyAssignment.php | 2 + .../Issue/UndefinedThisPropertyFetch.php | 2 + src/Psalm/Issue/UndefinedTrace.php | 2 + src/Psalm/Issue/UndefinedTrait.php | 2 + src/Psalm/Issue/UndefinedVariable.php | 2 + src/Psalm/Issue/UnevaluatedCode.php | 2 + src/Psalm/Issue/UnhandledMatchCondition.php | 2 + .../Issue/UnimplementedAbstractMethod.php | 2 + .../Issue/UnimplementedInterfaceMethod.php | 2 + src/Psalm/Issue/UninitializedProperty.php | 2 + src/Psalm/Issue/UnnecessaryVarAnnotation.php | 2 + src/Psalm/Issue/UnrecognizedExpression.php | 2 + src/Psalm/Issue/UnrecognizedStatement.php | 2 + src/Psalm/Issue/UnresolvableConstant.php | 2 + src/Psalm/Issue/UnresolvableInclude.php | 2 + .../Issue/UnsafeGenericInstantiation.php | 2 + src/Psalm/Issue/UnsafeInstantiation.php | 2 + src/Psalm/Issue/UnsupportedReferenceUsage.php | 2 + src/Psalm/Issue/UnusedClass.php | 2 + src/Psalm/Issue/UnusedClosureParam.php | 2 + src/Psalm/Issue/UnusedConstructor.php | 2 + src/Psalm/Issue/UnusedDocblockParam.php | 2 + src/Psalm/Issue/UnusedForeachValue.php | 2 + src/Psalm/Issue/UnusedFunctionCall.php | 2 + src/Psalm/Issue/UnusedMethod.php | 4 +- src/Psalm/Issue/UnusedMethodCall.php | 2 + src/Psalm/Issue/UnusedParam.php | 2 + src/Psalm/Issue/UnusedProperty.php | 4 +- src/Psalm/Issue/UnusedPsalmSuppress.php | 2 + src/Psalm/Issue/UnusedReturnValue.php | 2 + src/Psalm/Issue/UnusedVariable.php | 2 + src/Psalm/Issue/VariableIssue.php | 4 +- src/Psalm/IssueBuffer.php | 6 +- src/Psalm/Node/VirtualNode.php | 2 + src/Psalm/NodeTypeProvider.php | 2 + src/Psalm/Plugin/ArgTypeInferer.php | 5 +- .../EventHandler/AddTaintsInterface.php | 2 + .../EventHandler/AfterAnalysisInterface.php | 2 + .../AfterClassLikeAnalysisInterface.php | 2 + .../AfterClassLikeExistenceCheckInterface.php | 2 + .../AfterClassLikeVisitInterface.php | 2 + .../AfterCodebasePopulatedInterface.php | 2 + ...fterEveryFunctionCallAnalysisInterface.php | 2 + .../AfterExpressionAnalysisInterface.php | 2 + .../AfterFileAnalysisInterface.php | 2 + .../AfterFunctionCallAnalysisInterface.php | 2 + .../AfterFunctionLikeAnalysisInterface.php | 2 + .../AfterMethodCallAnalysisInterface.php | 2 + .../AfterStatementAnalysisInterface.php | 2 + .../BeforeFileAnalysisInterface.php | 2 + .../Event/AddRemoveTaintsEvent.php | 4 +- .../EventHandler/Event/AfterAnalysisEvent.php | 4 +- .../Event/AfterClassLikeAnalysisEvent.php | 4 +- .../AfterClassLikeExistenceCheckEvent.php | 4 +- .../Event/AfterClassLikeVisitEvent.php | 4 +- .../Event/AfterCodebasePopulatedEvent.php | 2 + .../AfterEveryFunctionCallAnalysisEvent.php | 4 +- .../Event/AfterExpressionAnalysisEvent.php | 4 +- .../Event/AfterFileAnalysisEvent.php | 4 +- .../Event/AfterFunctionCallAnalysisEvent.php | 4 +- .../Event/AfterFunctionLikeAnalysisEvent.php | 4 +- .../Event/AfterMethodCallAnalysisEvent.php | 4 +- .../Event/AfterStatementAnalysisEvent.php | 4 +- .../Event/BeforeExpressionAnalysisEvent.php | 2 +- .../Event/BeforeFileAnalysisEvent.php | 4 +- .../Event/BeforeStatementAnalysisEvent.php | 2 +- .../DynamicFunctionStorageProviderEvent.php | 2 +- .../Event/FunctionExistenceProviderEvent.php | 4 +- .../Event/FunctionParamsProviderEvent.php | 4 +- .../Event/FunctionReturnTypeProviderEvent.php | 4 +- .../Event/MethodExistenceProviderEvent.php | 4 +- .../Event/MethodParamsProviderEvent.php | 4 +- .../Event/MethodReturnTypeProviderEvent.php | 12 +- .../Event/MethodVisibilityProviderEvent.php | 4 +- .../Event/PropertyExistenceProviderEvent.php | 4 +- .../Event/PropertyTypeProviderEvent.php | 4 +- .../Event/PropertyVisibilityProviderEvent.php | 4 +- .../Event/StringInterpreterEvent.php | 2 + .../FunctionExistenceProviderInterface.php | 2 + .../FunctionParamsProviderInterface.php | 2 + .../FunctionReturnTypeProviderInterface.php | 2 + .../MethodExistenceProviderInterface.php | 2 + .../MethodParamsProviderInterface.php | 2 + .../MethodReturnTypeProviderInterface.php | 2 + .../MethodVisibilityProviderInterface.php | 2 + .../PropertyExistenceProviderInterface.php | 2 + .../PropertyTypeProviderInterface.php | 2 + .../PropertyVisibilityProviderInterface.php | 2 + .../EventHandler/RemoveTaintsInterface.php | 2 + .../StringInterpreterInterface.php | 2 + src/Psalm/Plugin/FileExtensionsInterface.php | 2 + .../Plugin/PluginEntryPointInterface.php | 2 + .../Plugin/PluginFileExtensionsInterface.php | 4 +- src/Psalm/Plugin/PluginInterface.php | 2 + src/Psalm/Plugin/RegistrationInterface.php | 2 + src/Psalm/Plugin/Shepherd.php | 7 +- src/Psalm/PluginFileExtensionsSocket.php | 2 + src/Psalm/PluginRegistrationSocket.php | 2 + src/Psalm/Progress/DebugProgress.php | 2 + src/Psalm/Progress/DefaultProgress.php | 2 + src/Psalm/Progress/LongProgress.php | 2 + src/Psalm/Progress/Progress.php | 2 + src/Psalm/Progress/VoidProgress.php | 2 + src/Psalm/Report.php | 4 +- .../Report/ByIssueLevelAndTypeReport.php | 6 +- src/Psalm/Report/CheckstyleReport.php | 2 + src/Psalm/Report/CodeClimateReport.php | 2 + src/Psalm/Report/CompactReport.php | 2 + src/Psalm/Report/ConsoleReport.php | 7 +- src/Psalm/Report/EmacsReport.php | 2 + src/Psalm/Report/GithubActionsReport.php | 5 +- src/Psalm/Report/JsonReport.php | 2 + src/Psalm/Report/JsonSummaryReport.php | 2 + src/Psalm/Report/JunitReport.php | 2 + src/Psalm/Report/PhpStormReport.php | 2 + src/Psalm/Report/PylintReport.php | 2 + src/Psalm/Report/ReportOptions.php | 2 + src/Psalm/Report/SarifReport.php | 2 + src/Psalm/Report/SonarqubeReport.php | 2 + src/Psalm/Report/TextReport.php | 2 + src/Psalm/Report/XmlReport.php | 2 + src/Psalm/SourceControl/Git/CommitInfo.php | 2 + src/Psalm/SourceControl/Git/GitInfo.php | 2 + src/Psalm/SourceControl/Git/RemoteInfo.php | 2 + src/Psalm/SourceControl/SourceControlInfo.php | 2 + src/Psalm/StatementsSource.php | 2 + src/Psalm/Storage/Assertion.php | 2 + src/Psalm/Storage/Assertion/Any.php | 2 + .../Assertion/ArrayKeyDoesNotExist.php | 2 + .../Storage/Assertion/ArrayKeyExists.php | 2 + .../Assertion/DoesNotHaveAtLeastCount.php | 2 + .../Assertion/DoesNotHaveExactCount.php | 2 + .../Storage/Assertion/DoesNotHaveMethod.php | 2 + src/Psalm/Storage/Assertion/Empty_.php | 2 + src/Psalm/Storage/Assertion/Falsy.php | 2 + src/Psalm/Storage/Assertion/HasArrayKey.php | 2 + .../Storage/Assertion/HasAtLeastCount.php | 2 + src/Psalm/Storage/Assertion/HasExactCount.php | 2 + .../Assertion/HasIntOrStringArrayAccess.php | 2 + src/Psalm/Storage/Assertion/HasMethod.php | 2 + .../Assertion/HasStringArrayAccess.php | 2 + src/Psalm/Storage/Assertion/InArray.php | 2 + src/Psalm/Storage/Assertion/IsAClass.php | 2 + src/Psalm/Storage/Assertion/IsClassEqual.php | 2 + .../Storage/Assertion/IsClassNotEqual.php | 2 + src/Psalm/Storage/Assertion/IsCountable.php | 2 + src/Psalm/Storage/Assertion/IsEqualIsset.php | 2 + src/Psalm/Storage/Assertion/IsGreaterThan.php | 2 + .../Assertion/IsGreaterThanOrEqualTo.php | 2 + src/Psalm/Storage/Assertion/IsIdentical.php | 2 + src/Psalm/Storage/Assertion/IsIsset.php | 2 + src/Psalm/Storage/Assertion/IsLessThan.php | 2 + .../Storage/Assertion/IsLessThanOrEqualTo.php | 2 + .../Storage/Assertion/IsLooselyEqual.php | 2 + src/Psalm/Storage/Assertion/IsNotAClass.php | 2 + .../Storage/Assertion/IsNotCountable.php | 2 + .../Storage/Assertion/IsNotIdentical.php | 2 + src/Psalm/Storage/Assertion/IsNotIsset.php | 2 + .../Storage/Assertion/IsNotLooselyEqual.php | 2 + src/Psalm/Storage/Assertion/IsNotType.php | 2 + src/Psalm/Storage/Assertion/IsType.php | 2 + .../Storage/Assertion/NestedAssertions.php | 2 + src/Psalm/Storage/Assertion/NonEmpty.php | 2 + .../Storage/Assertion/NonEmptyCountable.php | 2 + src/Psalm/Storage/Assertion/NotInArray.php | 2 + .../Storage/Assertion/NotNestedAssertions.php | 2 + .../Assertion/NotNonEmptyCountable.php | 2 + src/Psalm/Storage/Assertion/Truthy.php | 2 + src/Psalm/Storage/AttributeArg.php | 9 +- src/Psalm/Storage/AttributeStorage.php | 4 +- src/Psalm/Storage/ClassConstantStorage.php | 4 +- src/Psalm/Storage/ClassLikeStorage.php | 4 +- src/Psalm/Storage/CustomMetadataTrait.php | 2 + src/Psalm/Storage/EnumCaseStorage.php | 9 +- src/Psalm/Storage/FileStorage.php | 2 + src/Psalm/Storage/FunctionLikeParameter.php | 7 +- src/Psalm/Storage/FunctionLikeStorage.php | 2 + src/Psalm/Storage/FunctionStorage.php | 2 + .../Storage/ImmutableNonCloneableTrait.php | 2 + src/Psalm/Storage/MethodStorage.php | 2 + src/Psalm/Storage/Possibilities.php | 7 +- src/Psalm/Storage/PropertyStorage.php | 2 + src/Psalm/Type.php | 14 +- src/Psalm/Type/Atomic.php | 14 +- src/Psalm/Type/Atomic/CallableTrait.php | 12 +- src/Psalm/Type/Atomic/DependentType.php | 2 + src/Psalm/Type/Atomic/GenericTrait.php | 8 +- .../Type/Atomic/HasIntersectionTrait.php | 8 +- src/Psalm/Type/Atomic/Scalar.php | 2 + .../Type/Atomic/TAnonymousClassInstance.php | 8 +- src/Psalm/Type/Atomic/TArray.php | 6 +- src/Psalm/Type/Atomic/TArrayKey.php | 6 +- src/Psalm/Type/Atomic/TBool.php | 4 +- src/Psalm/Type/Atomic/TCallable.php | 8 +- src/Psalm/Type/Atomic/TCallableArray.php | 2 + src/Psalm/Type/Atomic/TCallableKeyedArray.php | 2 + src/Psalm/Type/Atomic/TCallableList.php | 2 + src/Psalm/Type/Atomic/TCallableObject.php | 4 +- src/Psalm/Type/Atomic/TCallableString.php | 2 + src/Psalm/Type/Atomic/TClassConstant.php | 6 +- src/Psalm/Type/Atomic/TClassString.php | 10 +- src/Psalm/Type/Atomic/TClassStringMap.php | 12 +- src/Psalm/Type/Atomic/TClosedResource.php | 4 +- src/Psalm/Type/Atomic/TClosure.php | 8 +- src/Psalm/Type/Atomic/TConditional.php | 12 +- src/Psalm/Type/Atomic/TDependentGetClass.php | 2 + .../Type/Atomic/TDependentGetDebugType.php | 2 + src/Psalm/Type/Atomic/TDependentGetType.php | 2 + src/Psalm/Type/Atomic/TDependentListKey.php | 2 + src/Psalm/Type/Atomic/TEmptyMixed.php | 2 + src/Psalm/Type/Atomic/TEmptyNumeric.php | 2 + src/Psalm/Type/Atomic/TEmptyScalar.php | 2 + src/Psalm/Type/Atomic/TEnumCase.php | 6 +- src/Psalm/Type/Atomic/TFalse.php | 2 + src/Psalm/Type/Atomic/TFloat.php | 4 +- src/Psalm/Type/Atomic/TGenericObject.php | 8 +- src/Psalm/Type/Atomic/TInt.php | 4 +- src/Psalm/Type/Atomic/TIntMask.php | 4 +- src/Psalm/Type/Atomic/TIntMaskOf.php | 4 +- src/Psalm/Type/Atomic/TIntRange.php | 6 +- src/Psalm/Type/Atomic/TIterable.php | 6 +- src/Psalm/Type/Atomic/TKeyOf.php | 6 +- src/Psalm/Type/Atomic/TKeyedArray.php | 18 ++- src/Psalm/Type/Atomic/TList.php | 10 +- src/Psalm/Type/Atomic/TLiteralClassString.php | 6 +- src/Psalm/Type/Atomic/TLiteralFloat.php | 4 +- src/Psalm/Type/Atomic/TLiteralInt.php | 4 +- src/Psalm/Type/Atomic/TLiteralString.php | 4 +- src/Psalm/Type/Atomic/TLowercaseString.php | 2 + src/Psalm/Type/Atomic/TMixed.php | 4 +- src/Psalm/Type/Atomic/TNamedObject.php | 14 +- src/Psalm/Type/Atomic/TNever.php | 4 +- src/Psalm/Type/Atomic/TNonEmptyArray.php | 4 +- src/Psalm/Type/Atomic/TNonEmptyList.php | 4 +- .../Type/Atomic/TNonEmptyLowercaseString.php | 2 + src/Psalm/Type/Atomic/TNonEmptyMixed.php | 2 + .../TNonEmptyNonspecificLiteralString.php | 2 + src/Psalm/Type/Atomic/TNonEmptyScalar.php | 2 + src/Psalm/Type/Atomic/TNonEmptyString.php | 2 + src/Psalm/Type/Atomic/TNonFalsyString.php | 2 + .../Type/Atomic/TNonspecificLiteralInt.php | 2 + .../Type/Atomic/TNonspecificLiteralString.php | 2 + src/Psalm/Type/Atomic/TNull.php | 4 +- src/Psalm/Type/Atomic/TNumeric.php | 4 +- src/Psalm/Type/Atomic/TNumericString.php | 2 + src/Psalm/Type/Atomic/TObject.php | 4 +- .../Type/Atomic/TObjectWithProperties.php | 12 +- src/Psalm/Type/Atomic/TPropertiesOf.php | 6 +- src/Psalm/Type/Atomic/TResource.php | 4 +- src/Psalm/Type/Atomic/TScalar.php | 4 +- src/Psalm/Type/Atomic/TSingleLetter.php | 2 + src/Psalm/Type/Atomic/TString.php | 4 +- .../Type/Atomic/TTemplateIndexedAccess.php | 6 +- src/Psalm/Type/Atomic/TTemplateKeyOf.php | 10 +- src/Psalm/Type/Atomic/TTemplateParam.php | 10 +- src/Psalm/Type/Atomic/TTemplateParamClass.php | 6 +- .../Type/Atomic/TTemplatePropertiesOf.php | 8 +- src/Psalm/Type/Atomic/TTemplateValueOf.php | 10 +- src/Psalm/Type/Atomic/TTraitString.php | 6 +- src/Psalm/Type/Atomic/TTrue.php | 2 + src/Psalm/Type/Atomic/TTypeAlias.php | 4 +- src/Psalm/Type/Atomic/TUnknownClassString.php | 4 +- src/Psalm/Type/Atomic/TValueOf.php | 6 +- src/Psalm/Type/Atomic/TVoid.php | 4 +- src/Psalm/Type/MutableTypeVisitor.php | 2 + src/Psalm/Type/MutableUnion.php | 6 +- src/Psalm/Type/Reconciler.php | 15 ++- src/Psalm/Type/TaintKind.php | 2 + src/Psalm/Type/TaintKindGroup.php | 2 + src/Psalm/Type/TypeNode.php | 2 + src/Psalm/Type/TypeVisitor.php | 2 + src/Psalm/Type/Union.php | 4 +- src/Psalm/Type/UnionTrait.php | 15 ++- tests/Cache/CacheTest.php | 2 +- tests/ComposerLockTest.php | 3 +- .../CustomArrayMapFunctionStorageProvider.php | 6 +- tests/Config/PluginListTest.php | 9 +- tests/DocumentationTest.php | 10 +- tests/EndToEnd/PsalmRunnerTrait.php | 2 +- tests/ErrorBaselineTest.php | 3 +- tests/FileDiffTest.php | 4 +- .../ClassConstantMoveTest.php | 2 +- tests/FileManipulation/ClassMoveTest.php | 2 +- .../FileManipulationTestCase.php | 2 +- tests/FileManipulation/MethodMoveTest.php | 2 +- tests/FileManipulation/NamespaceMoveTest.php | 2 +- tests/FileManipulation/PropertyMoveTest.php | 2 +- tests/FileReferenceTest.php | 2 +- tests/FileUpdates/AnalyzedMethodTest.php | 2 +- tests/FileUpdates/ErrorAfterUpdateTest.php | 2 +- tests/FileUpdates/ErrorFixTest.php | 2 +- tests/FileUpdates/TemporaryUpdateTest.php | 2 +- tests/IncludeTest.php | 4 +- tests/Internal/Scanner/FileScannerTest.php | 2 +- tests/JsonOutputTest.php | 2 +- tests/LanguageServer/SymbolLookupTest.php | 2 +- tests/PsalmPluginTest.php | 6 +- tests/Traits/InvalidCodeAnalysisTestTrait.php | 2 +- tests/Traits/ValidCodeAnalysisTestTrait.php | 2 +- .../src/FileWithErrors.php | 2 +- 992 files changed, 2986 insertions(+), 1264 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index aa41f8fa2e3..9275a3186ef 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -10,7 +10,7 @@ * Configuration * ************************************************************************************************************** --> - + @@ -260,4 +260,6 @@ + + diff --git a/src/Psalm/Aliases.php b/src/Psalm/Aliases.php index 526021c8a57..5ec3f3fb3e7 100644 --- a/src/Psalm/Aliases.php +++ b/src/Psalm/Aliases.php @@ -1,5 +1,7 @@ namespace = $namespace; $this->uses = $uses; diff --git a/src/Psalm/CodeLocation.php b/src/Psalm/CodeLocation.php index 0bdfd64a683..05ca3c388a5 100644 --- a/src/Psalm/CodeLocation.php +++ b/src/Psalm/CodeLocation.php @@ -1,5 +1,7 @@ file_start = (int)$stmt->getAttribute('startFilePos'); diff --git a/src/Psalm/CodeLocation/DocblockTypeLocation.php b/src/Psalm/CodeLocation/DocblockTypeLocation.php index f38c79f01ce..31c1522742a 100644 --- a/src/Psalm/CodeLocation/DocblockTypeLocation.php +++ b/src/Psalm/CodeLocation/DocblockTypeLocation.php @@ -1,5 +1,7 @@ file_start = $file_start; // matches how CodeLocation works diff --git a/src/Psalm/CodeLocation/ParseErrorLocation.php b/src/Psalm/CodeLocation/ParseErrorLocation.php index 1714ff7fead..9b85124d979 100644 --- a/src/Psalm/CodeLocation/ParseErrorLocation.php +++ b/src/Psalm/CodeLocation/ParseErrorLocation.php @@ -1,5 +1,7 @@ file_start = (int)$error->getAttributes()['startFilePos']; diff --git a/src/Psalm/CodeLocation/Raw.php b/src/Psalm/CodeLocation/Raw.php index 30d68d2f900..c3496c9d3b3 100644 --- a/src/Psalm/CodeLocation/Raw.php +++ b/src/Psalm/CodeLocation/Raw.php @@ -1,5 +1,7 @@ file_start = $file_start; $this->file_end = $file_end; diff --git a/src/Psalm/Codebase.php b/src/Psalm/Codebase.php index 56a9aab5d34..37a5f1894c7 100644 --- a/src/Psalm/Codebase.php +++ b/src/Psalm/Codebase.php @@ -1,5 +1,7 @@ classlikes->classOrInterfaceExists( $fq_class_name, @@ -689,7 +691,7 @@ public function classOrInterfaceOrEnumExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { return $this->classlikes->classOrInterfaceOrEnumExists( $fq_class_name, @@ -712,7 +714,7 @@ public function classExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { return $this->classlikes->classExists( $fq_class_name, @@ -745,7 +747,7 @@ public function interfaceExists( string $fq_interface_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { return $this->classlikes->interfaceExists( $fq_interface_name, @@ -797,7 +799,7 @@ public function traitHasCorrectCasing(string $fq_trait_name): bool */ public function getFunctionLikeStorage( StatementsAnalyzer $statements_analyzer, - string $function_id + string $function_id, ): FunctionLikeStorage { $doesMethodExist = MethodIdentifier::isValidMethodIdReference($function_id) @@ -820,16 +822,13 @@ public function getFunctionLikeStorage( /** * Whether or not a given method exists - * - * @param string|MethodIdentifier $method_id - * @param string|MethodIdentifier|null $calling_method_id */ public function methodExists( - $method_id, + string|MethodIdentifier $method_id, ?CodeLocation $code_location = null, - $calling_method_id = null, + string|MethodIdentifier|null $calling_method_id = null, ?string $file_path = null, - bool $is_used = true + bool $is_used = true, ): bool { return $this->methods->methodExists( MethodIdentifier::wrap($method_id), @@ -843,27 +842,22 @@ public function methodExists( } /** - * @param string|MethodIdentifier $method_id * @return array */ - public function getMethodParams($method_id): array + public function getMethodParams(string|MethodIdentifier $method_id): array { return $this->methods->getMethodParams(MethodIdentifier::wrap($method_id)); } - /** - * @param string|MethodIdentifier $method_id - */ - public function isVariadic($method_id): bool + public function isVariadic(string|MethodIdentifier $method_id): bool { return $this->methods->isVariadic(MethodIdentifier::wrap($method_id)); } /** - * @param string|MethodIdentifier $method_id * @param list $call_args */ - public function getMethodReturnType($method_id, ?string &$self_class, array $call_args = []): ?Union + public function getMethodReturnType(string|MethodIdentifier $method_id, ?string &$self_class, array $call_args = []): ?Union { return $this->methods->getMethodReturnType( MethodIdentifier::wrap($method_id), @@ -873,20 +867,14 @@ public function getMethodReturnType($method_id, ?string &$self_class, array $cal ); } - /** - * @param string|MethodIdentifier $method_id - */ - public function getMethodReturnsByRef($method_id): bool + public function getMethodReturnsByRef(string|MethodIdentifier $method_id): bool { return $this->methods->getMethodReturnsByRef(MethodIdentifier::wrap($method_id)); } - /** - * @param string|MethodIdentifier $method_id - */ public function getMethodReturnTypeLocation( - $method_id, - CodeLocation &$defined_location = null + string|MethodIdentifier $method_id, + CodeLocation &$defined_location = null, ): ?CodeLocation { return $this->methods->getMethodReturnTypeLocation( MethodIdentifier::wrap($method_id), @@ -894,10 +882,7 @@ public function getMethodReturnTypeLocation( ); } - /** - * @param string|MethodIdentifier $method_id - */ - public function getDeclaringMethodId($method_id): ?string + public function getDeclaringMethodId(string|MethodIdentifier $method_id): ?string { $new_method_id = $this->methods->getDeclaringMethodId(MethodIdentifier::wrap($method_id)); @@ -906,10 +891,8 @@ public function getDeclaringMethodId($method_id): ?string /** * Get the class this method appears in (vs is declared in, which could give a trait) - * - * @param string|MethodIdentifier $method_id */ - public function getAppearingMethodId($method_id): ?string + public function getAppearingMethodId(string|MethodIdentifier $method_id): ?string { $new_method_id = $this->methods->getAppearingMethodId(MethodIdentifier::wrap($method_id)); @@ -917,18 +900,14 @@ public function getAppearingMethodId($method_id): ?string } /** - * @param string|MethodIdentifier $method_id * @return array */ - public function getOverriddenMethodIds($method_id): array + public function getOverriddenMethodIds(string|MethodIdentifier $method_id): array { return $this->methods->getOverriddenMethodIds(MethodIdentifier::wrap($method_id)); } - /** - * @param string|MethodIdentifier $method_id - */ - public function getCasedMethodId($method_id): string + public function getCasedMethodId(string|MethodIdentifier $method_id): string { return $this->methods->getCasedMethodId(MethodIdentifier::wrap($method_id)); } @@ -985,7 +964,7 @@ public function getFunctionStorageForSymbol(string $file_path, string $symbol): * Get Markup content from Reference */ public function getMarkupContentForSymbolByReference( - Reference $reference + Reference $reference, ): ?PHPMarkdownContent { //Direct Assignment if (is_numeric($reference->symbol[0])) { @@ -1535,7 +1514,7 @@ public function getReferenceAtPosition(string $file_path, Position $position): ? */ public function getReferenceAtPositionAsReference( string $file_path, - Position $position + Position $position, ): ?Reference { $is_open = $this->file_provider->isOpen($file_path); @@ -1648,7 +1627,7 @@ public function getFunctionArgumentAtPosition(string $file_path, Position $posit */ public function getSignatureInformation( string $function_symbol, - string $file_path = null + string $file_path = null, ): ?SignatureInformation { $signature_label = ''; $signature_documentation = null; @@ -1845,7 +1824,7 @@ public function getTypeContextAtPosition(string $file_path, Position $position): public function getCompletionItemsForClassishThing( string $type_string, string $gap, - bool $snippets_supported = false + bool $snippets_supported = false, ): array { $completion_items = []; @@ -1961,7 +1940,7 @@ public function getCompletionItemsForClassishThing( public function getCompletionItemsForPartialSymbol( string $type_string, int $offset, - string $file_path + string $file_path, ): array { $fq_suggestion = false; @@ -2184,7 +2163,7 @@ public function getCompletionItemsForType(Union $type): array * @return list */ public function getCompletionItemsForArrayKeys( - string $type_string + string $type_string, ): array { $completion_items = []; $type = Type::parseString($type_string); @@ -2249,7 +2228,7 @@ public function removeTemporaryFileChanges(string $file_path): void */ public function isTypeContainedByType( Union $input_type, - Union $container_type + Union $container_type, ): bool { return UnionTypeComparator::isContainedBy($this, $input_type, $container_type); } @@ -2269,7 +2248,7 @@ public function isTypeContainedByType( */ public function canTypeBeContainedByType( Union $input_type, - Union $container_type + Union $container_type, ): bool { return UnionTypeComparator::canBeContainedBy($this, $input_type, $container_type); } @@ -2309,7 +2288,7 @@ public function queueClassLikeForScanning( string $fq_classlike_name, bool $analyze_too = false, bool $store_failure = true, - array $phantom_classes = [] + array $phantom_classes = [], ): void { $this->scanner->queueClassLikeForScanning($fq_classlike_name, $analyze_too, $store_failure, $phantom_classes); } @@ -2322,7 +2301,7 @@ public function addTaintSource( Union $expr_type, string $taint_id, array $taints = TaintKindGroup::ALL_INPUT, - ?CodeLocation $code_location = null + ?CodeLocation $code_location = null, ): Union { if (!$this->taint_flow_graph) { return $expr_type; @@ -2348,7 +2327,7 @@ public function addTaintSource( public function addTaintSink( string $taint_id, array $taints = TaintKindGroup::ALL_INPUT, - ?CodeLocation $code_location = null + ?CodeLocation $code_location = null, ): void { if (!$this->taint_flow_graph) { return; diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index e84a134f37a..9f8fcc61858 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -1,5 +1,7 @@ getLineNo(); assert($line > 0); // getLineNo() always returns non-zero for nodes loaded from file @@ -970,7 +972,7 @@ private static function processDeprecatedElement( DOMElement $deprecated_element_xml, string $file_contents, self $config, - string $config_path + string $config_path, ): void { $line = $deprecated_element_xml->getLineNo(); assert($line > 0); @@ -996,7 +998,7 @@ private static function processConfigDeprecations( self $config, DOMDocument $dom_document, string $file_contents, - string $config_path + string $config_path, ): void { $config->config_issues = []; @@ -1040,7 +1042,7 @@ private static function fromXmlAndPaths( string $base_dir, string $file_contents, string $current_dir, - ?string $config_path + ?string $config_path, ): self { $config = new static(); @@ -2481,10 +2483,7 @@ public function visitComposerAutoloadFiles(ProjectAnalyzer $project_analyzer, ?P } } - /** - * @return string|false - */ - public function getComposerFilePathForClassLike(string $fq_classlike_name) + public function getComposerFilePathForClassLike(string $fq_classlike_name): string|false { if (!$this->composer_class_loader) { return false; diff --git a/src/Psalm/Config/Creator.php b/src/Psalm/Config/Creator.php index a2fe96463a5..d24a4cebc54 100644 --- a/src/Psalm/Config/Creator.php +++ b/src/Psalm/Config/Creator.php @@ -1,5 +1,7 @@ ignoreFiles)) { diff --git a/src/Psalm/Config/TaintAnalysisFileFilter.php b/src/Psalm/Config/TaintAnalysisFileFilter.php index 08b91a886d5..471b2122dc6 100644 --- a/src/Psalm/Config/TaintAnalysisFileFilter.php +++ b/src/Psalm/Config/TaintAnalysisFileFilter.php @@ -1,5 +1,7 @@ vars_in_scope as $var_id => $old_type) { // this is only true if there was some sort of type negation @@ -494,7 +496,7 @@ public function update( */ public function updateReferencesPossiblyFromConfusingScope( Context $confusing_scope_context, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): void { $references = $confusing_scope_context->references_in_scope + $confusing_scope_context->references_to_external_scope; @@ -669,7 +671,7 @@ public static function filterClauses( string $remove_var_id, array $clauses, ?Union $new_type = null, - ?StatementsAnalyzer $statements_analyzer = null + ?StatementsAnalyzer $statements_analyzer = null, ): array { $new_type_string = $new_type ? $new_type->getId() : ''; $clauses_to_keep = []; @@ -735,7 +737,7 @@ public static function filterClauses( public function removeVarFromConflictingClauses( string $remove_var_id, ?Union $new_type = null, - ?StatementsAnalyzer $statements_analyzer = null + ?StatementsAnalyzer $statements_analyzer = null, ): void { $this->clauses = self::filterClauses($remove_var_id, $this->clauses, $new_type, $statements_analyzer); $this->parent_remove_vars[$remove_var_id] = true; @@ -749,7 +751,7 @@ public function removeDescendents( string $remove_var_id, Union $existing_type, ?Union $new_type = null, - ?StatementsAnalyzer $statements_analyzer = null + ?StatementsAnalyzer $statements_analyzer = null, ): void { $this->removeVarFromConflictingClauses( $remove_var_id, @@ -919,7 +921,7 @@ public function isSuppressingExceptions(StatementsAnalyzer $statements_analyzer) public function mergeFunctionExceptions( FunctionLikeStorage $function_storage, - CodeLocation $codelocation + CodeLocation $codelocation, ): void { $hash = $codelocation->getHash(); foreach ($function_storage->throws as $possibly_thrown_exception => $_) { diff --git a/src/Psalm/DocComment.php b/src/Psalm/DocComment.php index 2a04279f4e6..791f287066c 100644 --- a/src/Psalm/DocComment.php +++ b/src/Psalm/DocComment.php @@ -1,5 +1,7 @@ createElement('files'); diff --git a/src/Psalm/Exception/CircularReferenceException.php b/src/Psalm/Exception/CircularReferenceException.php index 178991f6e9d..51bdf98b31e 100644 --- a/src/Psalm/Exception/CircularReferenceException.php +++ b/src/Psalm/Exception/CircularReferenceException.php @@ -1,5 +1,7 @@ start = $start; $this->end = $end; diff --git a/src/Psalm/FileSource.php b/src/Psalm/FileSource.php index fd672862365..0bbd90e89da 100644 --- a/src/Psalm/FileSource.php +++ b/src/Psalm/FileSource.php @@ -1,5 +1,7 @@ 60_000 || count($right_clauses) > 60_000) { return []; diff --git a/src/Psalm/Internal/Algebra/FormulaGenerator.php b/src/Psalm/Internal/Algebra/FormulaGenerator.php index 9c5482c4a57..c5bc9512c22 100644 --- a/src/Psalm/Internal/Algebra/FormulaGenerator.php +++ b/src/Psalm/Internal/Algebra/FormulaGenerator.php @@ -1,5 +1,7 @@ getCodebase(); $appearing_non_repeatable_attributes = []; @@ -138,7 +140,7 @@ private static function analyzeAttributeConstruction( string $fq_attribute_name, Attribute $attribute, array $suppressed_issues, - ?ClassLikeStorage $classlike_storage = null + ?ClassLikeStorage $classlike_storage = null, ): void { $attribute_name_location = new CodeLocation($source, $attribute->name); @@ -244,7 +246,7 @@ private static function getAttributeClassFlags( string $fq_attribute_name, CodeLocation $attribute_name_location, ?ClassLikeStorage $attribute_class_storage, - array $suppressed_issues + array $suppressed_issues, ): int { if (strtolower($fq_attribute_name) === "attribute") { // We override this here because we still want to analyze attributes @@ -316,7 +318,7 @@ private static function iterateAttributeNodes(iterable $attribute_groups): Gener public static function analyzeGetAttributes( StatementsAnalyzer $statements_analyzer, string $method_id, - array $args + array $args, ): void { if (count($args) !== 1) { // We skip this analysis if $flags is specified on getAttributes, since the only option diff --git a/src/Psalm/Internal/Analyzer/CanAlias.php b/src/Psalm/Internal/Analyzer/CanAlias.php index 3be3d60d7bd..32bddf3a17b 100644 --- a/src/Psalm/Internal/Analyzer/CanAlias.php +++ b/src/Psalm/Internal/Analyzer/CanAlias.php @@ -1,5 +1,7 @@ class; @@ -671,7 +673,7 @@ public static function addContextProperties( Context $class_context, string $fq_class_name, ?string $parent_fq_class_name, - array $stmts = [] + array $stmts = [], ): void { $codebase = $statements_source->getCodebase(); @@ -1000,7 +1002,7 @@ private function checkPropertyInitialization( ClassLikeStorage $storage, Context $class_context, ?Context $global_context = null, - ?MethodAnalyzer $constructor_analyzer = null + ?MethodAnalyzer $constructor_analyzer = null, ): void { if (!$config->reportIssueInFile('PropertyNotSetInConstructor', $this->getFilePath())) { return; @@ -1363,7 +1365,7 @@ private function analyzeTraitUse( Context $class_context, ?Context $global_context = null, ?MethodAnalyzer &$constructor_analyzer = null, - ?TraitAnalyzer $previous_trait_analyzer = null + ?TraitAnalyzer $previous_trait_analyzer = null, ): ?bool { $codebase = $this->getCodebase(); @@ -1515,7 +1517,7 @@ private function analyzeTraitUse( private function analyzeProperty( SourceAnalyzer $source, PhpParser\Node\Stmt\Property $stmt, - Context $context + Context $context, ): void { $fq_class_name = $source->getFQCLN(); $property_name = $stmt->props[0]->name->name; @@ -1617,7 +1619,7 @@ private static function addOrUpdatePropertyType( PhpParser\Node\Stmt\Property $property, Union $inferred_type, StatementsSource $source, - bool $docblock_only = false + bool $docblock_only = false, ): void { $manipulator = PropertyDocblockManipulator::getForProperty( $project_analyzer, @@ -1661,7 +1663,7 @@ private function analyzeClassMethod( SourceAnalyzer $source, Context $class_context, ?Context $global_context = null, - bool $is_fake = false + bool $is_fake = false, ): ?MethodAnalyzer { $config = Config::getInstance(); @@ -1836,7 +1838,7 @@ private function analyzeClassMethod( private static function getThisObjectType( ClassLikeStorage $class_storage, - string $original_fq_classlike_name + string $original_fq_classlike_name, ): TNamedObject { if ($class_storage->template_types) { $template_params = []; @@ -1872,7 +1874,7 @@ public static function analyzeClassMethodReturnType( string $fq_classlike_name, MethodIdentifier $analyzed_method_id, MethodIdentifier $actual_method_id, - bool $did_explicitly_return + bool $did_explicitly_return, ): void { $secondary_return_type_location = null; @@ -2000,7 +2002,7 @@ private function checkImplementedInterfaces( PhpParser\Node\Stmt $class, Codebase $codebase, string $fq_class_name, - ClassLikeStorage $storage + ClassLikeStorage $storage, ): bool { $classlike_storage_provider = $codebase->classlike_storage_provider; @@ -2303,7 +2305,7 @@ private function checkParentClass( string $parent_fq_class_name, ClassLikeStorage $storage, Codebase $codebase, - ?Context $class_context + ?Context $class_context, ): void { $classlike_storage_provider = $codebase->classlike_storage_provider; diff --git a/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php index a6c909191b8..786cd4fe24d 100644 --- a/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php @@ -1,5 +1,7 @@ getFileAnalyzer()->project_analyzer; $codebase = $project_analyzer->getCodebase(); @@ -205,7 +207,7 @@ public static function checkFullyQualifiedClassLikeName( ?string $calling_fq_class_name, ?string $calling_method_id, array $suppressed_issues, - ?ClassLikeNameOptions $options = null + ?ClassLikeNameOptions $options = null, ): ?bool { if ($options === null) { $options = new ClassLikeNameOptions(); @@ -410,7 +412,7 @@ public static function checkFullyQualifiedClassLikeName( */ public static function getFQCLNFromNameObject( PhpParser\Node\Name $class_name, - Aliases $aliases + Aliases $aliases, ): string { /** @var string|null */ $resolved_name = $class_name->getAttribute('resolvedName'); @@ -494,10 +496,8 @@ public function isStatic(): bool /** * Gets the Psalm type from a particular value - * - * @param mixed $value */ - public static function getTypeFromValue($value): Union + public static function getTypeFromValue(mixed $value): Union { switch (gettype($value)) { case 'boolean': @@ -536,7 +536,7 @@ public static function checkPropertyVisibility( SourceAnalyzer $source, CodeLocation $code_location, array $suppressed_issues, - bool $emit_issues = true + bool $emit_issues = true, ): ?bool { [$fq_class_name, $property_name] = explode('::$', $property_id); @@ -649,7 +649,7 @@ protected function checkTemplateParams( ClassLikeStorage $storage, ClassLikeStorage $parent_storage, CodeLocation $code_location, - int $given_param_count + int $given_param_count, ): void { $expected_param_count = $parent_storage->template_types === null ? 0 diff --git a/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php b/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php index 60f61a9e87d..3348d549ae2 100644 --- a/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php +++ b/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php @@ -1,5 +1,7 @@ inferred = $inferred; $this->allow_trait = $allow_trait; diff --git a/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php b/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php index c5daf4f5ea6..0648f7a9e23 100644 --- a/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php @@ -1,5 +1,7 @@ deprecated = isset($parsed_docblock->tags['deprecated']); $var_comment->internal = isset($parsed_docblock->tags['internal']); @@ -418,7 +420,7 @@ public static function splitDocLine(string $return_block): array public static function getVarComments( PhpParser\Comment\Doc $doc_comment, StatementsAnalyzer $statements_analyzer, - PhpParser\Node\Expr\Variable $var + PhpParser\Node\Expr\Variable $var, ): array { $codebase = $statements_analyzer->getCodebase(); $parsed_docblock = $statements_analyzer->getParsedDocblock(); @@ -465,7 +467,7 @@ public static function populateVarTypesFromDocblock( array $var_comments, PhpParser\Node\Expr\Variable $var, Context $context, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): ?Union { if (!is_string($var->name)) { return null; diff --git a/src/Psalm/Internal/Analyzer/DataFlowNodeData.php b/src/Psalm/Internal/Analyzer/DataFlowNodeData.php index bc4f2dbf533..59cb5fccb18 100644 --- a/src/Psalm/Internal/Analyzer/DataFlowNodeData.php +++ b/src/Psalm/Internal/Analyzer/DataFlowNodeData.php @@ -1,5 +1,7 @@ label = $label; $this->line_from = $line_from; diff --git a/src/Psalm/Internal/Analyzer/FileAnalyzer.php b/src/Psalm/Internal/Analyzer/FileAnalyzer.php index d9879558922..832bfecb59e 100644 --- a/src/Psalm/Internal/Analyzer/FileAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FileAnalyzer.php @@ -1,5 +1,7 @@ project_analyzer->getCodebase(); @@ -363,7 +365,7 @@ public function addNamespacedInterfaceAnalyzer(string $fq_class_name, InterfaceA public function getMethodMutations( MethodIdentifier $method_id, Context $this_context, - bool $from_project_analyzer = false + bool $from_project_analyzer = false, ): void { $fq_class_name = $method_id->fq_class_name; $method_name = $method_id->method_name; diff --git a/src/Psalm/Internal/Analyzer/FunctionAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionAnalyzer.php index f22e09cf29f..923bbbf2f63 100644 --- a/src/Psalm/Internal/Analyzer/FunctionAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionAnalyzer.php @@ -1,5 +1,7 @@ stmts as $function_stmt) { if ($function_stmt instanceof PhpParser\Node\Stmt\Global_) { diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php index 5cfd1b17664..d10fccb4158 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php @@ -1,5 +1,7 @@ getSuppressedIssues(); $codebase = $source->getCodebase(); @@ -830,7 +832,7 @@ public static function checkReturnType( ProjectAnalyzer $project_analyzer, FunctionLikeAnalyzer $function_like_analyzer, FunctionLikeStorage $storage, - Context $context + Context $context, ): ?bool { $codebase = $project_analyzer->getCodebase(); @@ -1026,7 +1028,7 @@ private static function addOrUpdateReturnType( Union $inferred_return_type, StatementsSource $source, bool $docblock_only = false, - ?FunctionLikeStorage $function_like_storage = null + ?FunctionLikeStorage $function_like_storage = null, ): void { $manipulator = FunctionDocblockManipulator::getForFunction( $project_analyzer, diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php index 13280aa1746..b4652cd49b3 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php +++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php @@ -1,5 +1,7 @@ storage; @@ -872,7 +874,7 @@ private function checkParamReferences( StatementsAnalyzer $statements_analyzer, FunctionLikeStorage $storage, ?ClassLikeStorage $class_storage, - Context $context + Context $context, ): void { $codebase = $statements_analyzer->getCodebase(); @@ -973,7 +975,7 @@ private function processParams( array $params, array $param_stmts, Context $context, - bool $has_template_types + bool $has_template_types, ): bool { $check_stmts = true; $codebase = $statements_analyzer->getCodebase(); @@ -1318,7 +1320,7 @@ private function alterParams( Codebase $codebase, FunctionLikeStorage $storage, array $params, - Context $context + Context $context, ): void { foreach ($this->function->params as $param) { $param_name_node = null; @@ -1446,7 +1448,7 @@ public function verifyReturnType( ?string $fq_class_name = null, ?CodeLocation $return_type_location = null, bool $did_explicitly_return = false, - bool $closure_inside_call = false + bool $closure_inside_call = false, ): void { ReturnTypeAnalyzer::verifyReturnType( $this->function, @@ -1468,7 +1470,7 @@ public function addOrUpdateParamType( ProjectAnalyzer $project_analyzer, string $param_name, Union $inferred_return_type, - bool $docblock_only = false + bool $docblock_only = false, ): void { $manipulator = FunctionDocblockManipulator::getForFunction( $project_analyzer, @@ -1545,7 +1547,7 @@ public function examineParamTypes( StatementsAnalyzer $statements_analyzer, Context $context, Codebase $codebase, - PhpParser\Node $stmt = null + PhpParser\Node $stmt = null, ): void { $storage = $this->getFunctionLikeStorage($statements_analyzer); @@ -1801,7 +1803,7 @@ private function getFunctionInformation( Codebase $codebase, NodeDataProvider $type_provider, FunctionLikeStorage $storage, - bool $add_mutations + bool $add_mutations, ): ?array { $classlike_storage_provider = $codebase->classlike_storage_provider; $real_method_id = null; @@ -2048,7 +2050,7 @@ private function getFunctionInformation( private function detectUnusedParameters( StatementsAnalyzer $statements_analyzer, FunctionLikeStorage $storage, - Context $context + Context $context, ): array { $codebase = $statements_analyzer->getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/InterfaceAnalyzer.php b/src/Psalm/Internal/Analyzer/InterfaceAnalyzer.php index dd2a107498b..abca24a9dba 100644 --- a/src/Psalm/Internal/Analyzer/InterfaceAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/InterfaceAnalyzer.php @@ -1,5 +1,7 @@ severity = $severity; $this->line_from = $line_from; diff --git a/src/Psalm/Internal/Analyzer/MethodAnalyzer.php b/src/Psalm/Internal/Analyzer/MethodAnalyzer.php index 89af7aaec71..9ed7e955bec 100644 --- a/src/Psalm/Internal/Analyzer/MethodAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/MethodAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); @@ -99,7 +101,7 @@ public static function checkStatic( Codebase $codebase, CodeLocation $code_location, array $suppressed_issues, - ?bool &$is_dynamic_this_method = false + ?bool &$is_dynamic_this_method = false, ): void { $codebase_methods = $codebase->methods; @@ -165,7 +167,7 @@ public static function checkMethodExists( MethodIdentifier $method_id, CodeLocation $code_location, array $suppressed_issues, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): ?bool { if ($codebase->methods->methodExists( $method_id, @@ -193,7 +195,7 @@ public static function checkMethodExists( public static function isMethodVisible( MethodIdentifier $method_id, Context $context, - StatementsSource $source + StatementsSource $source, ): bool { $codebase = $source->getCodebase(); @@ -278,7 +280,7 @@ public static function isMethodVisible( */ public static function checkMethodSignatureMustOmitReturnType( MethodStorage $method_storage, - CodeLocation $code_location + CodeLocation $code_location, ): void { if ($method_storage->signature_return_type === null) { return; diff --git a/src/Psalm/Internal/Analyzer/MethodComparator.php b/src/Psalm/Internal/Analyzer/MethodComparator.php index 82e1c6c4863..3fbd080d7c9 100644 --- a/src/Psalm/Internal/Analyzer/MethodComparator.php +++ b/src/Psalm/Internal/Analyzer/MethodComparator.php @@ -1,5 +1,7 @@ name, @@ -252,7 +254,7 @@ private static function checkForObviousMethodMismatches( bool $prevent_abstract_override, bool $trait_mismatches_are_fatal, CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): void { if ($implementer_visibility > $guide_visibility) { if ($trait_mismatches_are_fatal @@ -349,7 +351,7 @@ private static function compareMethodParams( string $cased_implementer_method_id, bool $prevent_method_signature_mismatch, CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): void { if ($prevent_method_signature_mismatch) { if (!$guide_classlike_storage->user_defined @@ -557,7 +559,7 @@ private static function compareMethodSignatureParams( string $cased_guide_method_id, string $cased_implementer_method_id, CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): void { $guide_param_signature_type = $guide_param->signature_type ? TypeExpander::expandUnion( @@ -677,7 +679,7 @@ private static function compareMethodDocblockParams( Union $guide_param_type, Union $implementer_param_type, CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): void { $implementer_method_storage_param_type = TypeExpander::expandUnion( $codebase, @@ -843,7 +845,7 @@ private static function compareMethodSignatureReturnTypes( string $implementer_called_class_name, string $cased_implementer_method_id, CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): void { $guide_signature_return_type = TypeExpander::expandUnion( $codebase, @@ -930,7 +932,7 @@ private static function compareMethodDocblockReturnTypes( string $implementer_called_class_name, ?MethodIdentifier $implementer_declaring_method_id, CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): void { $implementer_method_storage_return_type = TypeExpander::expandUnion( $codebase, @@ -1055,7 +1057,7 @@ private static function transformTemplates( array $template_extended_params, string $base_class_name, Union &$templated_type, - Codebase $codebase + Codebase $codebase, ): void { if (isset($template_extended_params[$base_class_name])) { $map = $template_extended_params[$base_class_name]; diff --git a/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php b/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php index e08bffbe29e..964e4dc2f54 100644 --- a/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php @@ -1,5 +1,7 @@ codebase->alter_code = true; $this->codebase->infer_types_from_usage = true; @@ -1261,7 +1263,7 @@ public function getMethodMutations( MethodIdentifier $original_method_id, Context $this_context, string $root_file_path, - string $root_file_name + string $root_file_name, ): void { $fq_class_name = $original_method_id->fq_class_name; @@ -1308,7 +1310,7 @@ public function getMethodMutations( public function getFunctionLikeAnalyzer( MethodIdentifier $method_id, - string $file_path + string $file_path, ): ?FunctionLikeAnalyzer { $file_analyzer = new FileAnalyzer( $this, diff --git a/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php b/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php index 4b8946623b5..d32aa2cfde0 100644 --- a/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php @@ -1,5 +1,7 @@ break_types[] = 'loop'; @@ -172,7 +174,7 @@ private static function analyzeDoNaively( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Stmt\Do_ $stmt, Context $context, - LoopScope $loop_scope + LoopScope $loop_scope, ): void { $do_context = clone $context; diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/ForAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/ForAnalyzer.php index 4c0dd4ee16f..7d96a9c4ffd 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/ForAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/ForAnalyzer.php @@ -1,5 +1,7 @@ assigned_var_ids; $context->assigned_var_ids = []; diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php index bb55c91f764..324566b137f 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php @@ -1,5 +1,7 @@ isNull()) { IssueBuffer::maybeAdd( @@ -733,7 +735,7 @@ public static function handleIterable( Context $context, ?Union &$key_type, ?Union &$value_type, - bool &$has_valid_iterator + bool &$has_valid_iterator, ): void { if ($iterator_atomic_type->extra_types) { $iterator_atomic_types = array_merge( @@ -970,7 +972,7 @@ public static function getKeyValueParamsForTraversableObject( Atomic $iterator_atomic_type, Codebase $codebase, ?Union &$key_type, - ?Union &$value_type + ?Union &$value_type, ): void { if ($iterator_atomic_type instanceof TIterable || ($iterator_atomic_type instanceof TGenericObject @@ -1047,7 +1049,7 @@ private static function getFakeMethodCallType( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr $foreach_expr, Context $context, - string $method_name + string $method_name, ): ?Union { $old_data_provider = $statements_analyzer->node_data; @@ -1106,7 +1108,7 @@ private static function getExtendedType( string $calling_class, array $template_extended_params, ?array $class_template_types = null, - ?array $calling_type_params = null + ?array $calling_type_params = null, ): ?Union { if ($calling_class === $template_class) { if (isset($class_template_types[$template_name]) && $calling_type_params) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php index e1c5e5e4024..e75b8525b54 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php @@ -1,5 +1,7 @@ node_data->getType($stmt); diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseAnalyzer.php index 31fca6dc0f7..ec96cb8e4e9 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php index f55d1d0a63e..823ff884990 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php @@ -1,5 +1,7 @@ cond_referenced_var_ids; @@ -336,7 +338,7 @@ public static function addConditionallyAssignedVarsToContext( PhpParser\Node\Expr $cond, Context $post_leaving_if_context, Context $post_if_context, - array $assigned_in_conditional_var_ids + array $assigned_in_conditional_var_ids, ): void { // this filters out coercions to expected types in ArgumentAnalyzer $assigned_in_conditional_var_ids = array_filter($assigned_in_conditional_var_ids); @@ -440,7 +442,7 @@ public static function updateIfScope( array $assigned_var_ids, array $possibly_assigned_var_ids, array $newly_reconciled_var_ids, - bool $update_new_vars = true + bool $update_new_vars = true, ): void { $redefined_vars = $if_context->getRedefinedVars($outer_context->vars_in_scope); diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php index a5a006a0b31..e2e45b76b31 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php index f1f5ad61fca..f1cbe68619b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php @@ -1,5 +1,7 @@ final_actions, true)) { $loop_context->vars_in_scope = $pre_outer_context->vars_in_scope; @@ -570,7 +572,7 @@ private static function applyPreConditionToLoopContext( array $pre_condition_clauses, Context $loop_context, Context $outer_context, - bool $is_do + bool $is_do, ): array { $pre_referenced_var_ids = $loop_context->cond_referenced_var_ids; $loop_context->cond_referenced_var_ids = []; diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/SwitchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/SwitchAnalyzer.php index a0d9d48200c..ad676bcc99f 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/SwitchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/SwitchAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/SwitchCaseAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/SwitchCaseAnalyzer.php index e116f1173f7..500587683a7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/SwitchCaseAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/SwitchCaseAnalyzer.php @@ -1,5 +1,7 @@ cond && $switch_var_id @@ -653,7 +655,7 @@ private static function handleNonReturningCase( private static function simplifyCaseEqualityExpression( PhpParser\Node\Expr $case_equality_expr, - PhpParser\Node\Expr\Variable $var + PhpParser\Node\Expr\Variable $var, ): ?PhpParser\Node\Expr\FuncCall { if ($case_equality_expr instanceof PhpParser\Node\Expr\BinaryOp\BooleanOr) { $nested_or_options = self::getOptionsFromNestedOr($case_equality_expr, $var); @@ -697,7 +699,7 @@ private static function simplifyCaseEqualityExpression( private static function getOptionsFromNestedOr( PhpParser\Node\Expr $case_equality_expr, PhpParser\Node\Expr\Variable $var, - array $in_array_values = [] + array $in_array_values = [], ): ?array { if ($case_equality_expr instanceof PhpParser\Node\Expr\BinaryOp\Identical && $case_equality_expr->left instanceof PhpParser\Node\Expr\Variable diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php index 18536b49394..f6f928102be 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php @@ -1,5 +1,7 @@ cond instanceof PhpParser\Node\Expr\ConstFetch && $stmt->cond->name->getParts() === ['true']) @@ -121,7 +123,7 @@ public static function analyze( * @return list */ public static function getAndExpressions( - PhpParser\Node\Expr $expr + PhpParser\Node\Expr $expr, ): array { if ($expr instanceof PhpParser\Node\Expr\BinaryOp\BooleanAnd) { return [...self::getAndExpressions($expr->left), ...self::getAndExpressions($expr->right)]; diff --git a/src/Psalm/Internal/Analyzer/Statements/BreakAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/BreakAnalyzer.php index cbf9be6c0ea..2d2830d7771 100644 --- a/src/Psalm/Internal/Analyzer/Statements/BreakAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/BreakAnalyzer.php @@ -1,5 +1,7 @@ loop_scope; diff --git a/src/Psalm/Internal/Analyzer/Statements/ContinueAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ContinueAnalyzer.php index 9e04d165440..9f6405a1dbb 100644 --- a/src/Psalm/Internal/Analyzer/Statements/ContinueAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/ContinueAnalyzer.php @@ -1,5 +1,7 @@ num instanceof PhpParser\Node\Scalar\LNumber? $stmt->num->value : 1; diff --git a/src/Psalm/Internal/Analyzer/Statements/EchoAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/EchoAnalyzer.php index 300b8fe02aa..bc84fcd54e4 100644 --- a/src/Psalm/Internal/Analyzer/Statements/EchoAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/EchoAnalyzer.php @@ -1,5 +1,7 @@ items) === 0) { @@ -242,7 +244,7 @@ private static function analyzeArrayItem( Context $context, ArrayCreationInfo $array_creation_info, PhpParser\Node\Expr\ArrayItem $item, - Codebase $codebase + Codebase $codebase, ): void { if ($item->unpack) { if (ExpressionAnalyzer::analyze($statements_analyzer, $item->value, $context) === false) { @@ -520,7 +522,7 @@ private static function handleUnpackedArray( ArrayCreationInfo $array_creation_info, PhpParser\Node\Expr\ArrayItem $item, Union $unpacked_array_type, - Codebase $codebase + Codebase $codebase, ): void { $all_non_empty = true; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php index 43161d22f3b..abe9804e680 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php @@ -1,5 +1,7 @@ getArgs()[0]->value) ? ExpressionIdentifier::getExtendedVarId( @@ -864,7 +866,7 @@ private static function processIrreconcilableFunctionCall( PhpParser\Node\Expr $expr, StatementsAnalyzer $source, Codebase $codebase, - bool $negate + bool $negate, ): void { if ($first_var_type->hasMixed()) { return; @@ -928,7 +930,7 @@ private static function processIrreconcilableFunctionCall( protected static function processCustomAssertion( PhpParser\Node\Expr $expr, ?string $this_class_name, - FileSource $source + FileSource $source, ): array { if (!$source instanceof StatementsAnalyzer) { return []; @@ -1230,7 +1232,7 @@ protected static function processCustomAssertion( protected static function getInstanceOfAssertions( PhpParser\Node\Expr\Instanceof_ $stmt, ?string $this_class_name, - FileSource $source + FileSource $source, ): array { if ($stmt->class instanceof PhpParser\Node\Name) { if (!in_array(strtolower($stmt->class->getFirst()), ['self', 'static', 'parent'], true)) { @@ -1294,7 +1296,7 @@ protected static function getInstanceOfAssertions( */ protected static function hasNullVariable( PhpParser\Node\Expr\BinaryOp $conditional, - FileSource $source + FileSource $source, ): ?int { if ($conditional->right instanceof PhpParser\Node\Expr\ConstFetch && strtolower($conditional->right->name->getFirst()) === 'null' @@ -1322,7 +1324,7 @@ protected static function hasNullVariable( * @param Identical|Equal|NotIdentical|NotEqual $conditional */ public static function hasFalseVariable( - PhpParser\Node\Expr\BinaryOp $conditional + PhpParser\Node\Expr\BinaryOp $conditional, ): ?int { if ($conditional->right instanceof PhpParser\Node\Expr\ConstFetch && strtolower($conditional->right->name->getFirst()) === 'false' @@ -1343,7 +1345,7 @@ public static function hasFalseVariable( * @param Identical|Equal|NotIdentical|NotEqual $conditional */ public static function hasTrueVariable( - PhpParser\Node\Expr\BinaryOp $conditional + PhpParser\Node\Expr\BinaryOp $conditional, ): ?int { if ($conditional->right instanceof PhpParser\Node\Expr\ConstFetch && strtolower($conditional->right->name->getFirst()) === 'true' @@ -1364,7 +1366,7 @@ public static function hasTrueVariable( * @param Identical|Equal|NotIdentical|NotEqual $conditional */ protected static function hasEmptyArrayVariable( - PhpParser\Node\Expr\BinaryOp $conditional + PhpParser\Node\Expr\BinaryOp $conditional, ): ?int { if ($conditional->right instanceof PhpParser\Node\Expr\Array_ && !$conditional->right->items @@ -1383,11 +1385,10 @@ protected static function hasEmptyArrayVariable( /** * @param Identical|Equal|NotIdentical|NotEqual $conditional - * @return false|int */ protected static function hasGetTypeCheck( - PhpParser\Node\Expr\BinaryOp $conditional - ) { + PhpParser\Node\Expr\BinaryOp $conditional, + ): false|int { if ($conditional->right instanceof PhpParser\Node\Expr\FuncCall && $conditional->right->name instanceof PhpParser\Node\Name && strtolower($conditional->right->name->getFirst()) === 'gettype' @@ -1411,11 +1412,10 @@ protected static function hasGetTypeCheck( /** * @param Identical|Equal|NotIdentical|NotEqual $conditional - * @return false|int */ protected static function hasGetDebugTypeCheck( - PhpParser\Node\Expr\BinaryOp $conditional - ) { + PhpParser\Node\Expr\BinaryOp $conditional, + ): false|int { if ($conditional->right instanceof PhpParser\Node\Expr\FuncCall && $conditional->right->name instanceof PhpParser\Node\Name && strtolower($conditional->right->name->getFirst()) === 'get_debug_type' @@ -1441,12 +1441,11 @@ protected static function hasGetDebugTypeCheck( /** * @param Identical|Equal|NotIdentical|NotEqual $conditional - * @return false|int */ protected static function hasGetClassCheck( PhpParser\Node\Expr\BinaryOp $conditional, - FileSource $source - ) { + FileSource $source, + ): false|int { if (!$source instanceof StatementsAnalyzer) { return false; } @@ -1534,12 +1533,11 @@ protected static function hasGetClassCheck( /** * @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional - * @return false|int */ protected static function hasNonEmptyCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$min_count - ) { + ?int &$min_count, + ): false|int { if ($conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name && in_array(strtolower($conditional->left->name->getFirst()), ['count', 'sizeof']) @@ -1576,12 +1574,11 @@ protected static function hasNonEmptyCountEqualityCheck( /** * @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional - * @return false|int */ protected static function hasLessThanCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$max_count - ) { + ?int &$max_count, + ): false|int { $left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name && in_array(strtolower($conditional->left->name->getFirst()), ['count', 'sizeof']) @@ -1625,12 +1622,11 @@ protected static function hasLessThanCountEqualityCheck( /** * @param Equal|Identical|NotEqual|NotIdentical $conditional - * @return false|int */ protected static function hasCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$count - ) { + ?int &$count, + ): false|int { $left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name && in_array(strtolower($conditional->left->name->getFirst()), ['count', 'sizeof']) @@ -1658,13 +1654,12 @@ protected static function hasCountEqualityCheck( /** * @param PhpParser\Node\Expr\BinaryOp\Greater|PhpParser\Node\Expr\BinaryOp\GreaterOrEqual $conditional - * @return false|int */ protected static function hasSuperiorNumberCheck( FileSource $source, PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$literal_value_comparison - ) { + ?int &$literal_value_comparison, + ): false|int { $right_assignment = false; $value_right = null; if ($source instanceof StatementsAnalyzer @@ -1718,13 +1713,12 @@ protected static function hasSuperiorNumberCheck( /** * @param PhpParser\Node\Expr\BinaryOp\Smaller|PhpParser\Node\Expr\BinaryOp\SmallerOrEqual $conditional - * @return false|int */ protected static function hasInferiorNumberCheck( FileSource $source, PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$literal_value_comparison - ) { + ?int &$literal_value_comparison, + ): false|int { $right_assignment = false; $value_right = null; if ($source instanceof StatementsAnalyzer @@ -1778,11 +1772,10 @@ protected static function hasInferiorNumberCheck( /** * @param PhpParser\Node\Expr\BinaryOp\Greater|PhpParser\Node\Expr\BinaryOp\GreaterOrEqual $conditional - * @return false|int */ protected static function hasReconcilableNonEmptyCountEqualityCheck( - PhpParser\Node\Expr\BinaryOp $conditional - ) { + PhpParser\Node\Expr\BinaryOp $conditional, + ): false|int { $left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name && in_array(strtolower($conditional->left->name->getFirst()), ['count', 'sizeof']); @@ -1800,12 +1793,11 @@ protected static function hasReconcilableNonEmptyCountEqualityCheck( /** * @param Identical|Equal|NotIdentical|NotEqual $conditional - * @return false|int */ protected static function hasTypedValueComparison( PhpParser\Node\Expr\BinaryOp $conditional, - FileSource $source - ) { + FileSource $source, + ): false|int { if (!$source instanceof StatementsAnalyzer) { return false; } @@ -1838,7 +1830,7 @@ protected static function hasTypedValueComparison( protected static function hasIsACheck( PhpParser\Node\Expr\FuncCall $stmt, - StatementsAnalyzer $source + StatementsAnalyzer $source, ): bool { if ($stmt->name instanceof PhpParser\Node\Name && (strtolower($stmt->name->getFirst()) === 'is_a' @@ -1916,7 +1908,7 @@ private static function handleIsTypeCheck( ?string $first_var_name, ?Union $first_var_type, PhpParser\Node\Expr\FuncCall $expr, - bool $negate + bool $negate, ): array { $if_types = []; if ($stmt->name instanceof PhpParser\Node\Name @@ -2062,7 +2054,7 @@ private static function getNullInequalityAssertions( FileSource $source, ?string $this_class_name, ?Codebase $codebase, - int $null_position + int $null_position, ): array { $if_types = []; @@ -2145,7 +2137,7 @@ private static function getFalseInequalityAssertions( ?Codebase $codebase, int $false_position, bool $cache, - bool $inside_conditional + bool $inside_conditional, ): array { $if_types = []; @@ -2265,7 +2257,7 @@ private static function getTrueInequalityAssertions( ?Codebase $codebase, int $true_position, bool $cache, - bool $inside_conditional + bool $inside_conditional, ): array { $if_types = []; @@ -2417,7 +2409,7 @@ private static function getEmptyInequalityAssertions( ?string $this_class_name, FileSource $source, ?Codebase $codebase, - int $empty_array_position + int $empty_array_position, ): array { $if_types = []; @@ -2493,7 +2485,7 @@ private static function getGettypeInequalityAssertions( PhpParser\Node\Expr\BinaryOp $conditional, ?string $this_class_name, FileSource $source, - int $gettype_position + int $gettype_position, ): array { $if_types = []; @@ -2559,7 +2551,7 @@ private static function getGetdebugTypeInequalityAssertions( PhpParser\Node\Expr\BinaryOp $conditional, ?string $this_class_name, FileSource $source, - int $get_debug_type_position + int $get_debug_type_position, ): array { $if_types = []; @@ -2616,7 +2608,7 @@ private static function getGetclassInequalityAssertions( PhpParser\Node\Expr\BinaryOp $conditional, ?string $this_class_name, StatementsAnalyzer $source, - int $getclass_position + int $getclass_position, ): array { $if_types = []; @@ -2710,7 +2702,7 @@ private static function getTypedValueInequalityAssertions( ?string $this_class_name, StatementsAnalyzer $source, ?Codebase $codebase, - int $typed_value_position + int $typed_value_position, ): array { $if_types = []; @@ -2784,7 +2776,7 @@ private static function getNullEqualityAssertions( ?string $this_class_name, FileSource $source, ?Codebase $codebase, - int $null_position + int $null_position, ): array { $if_types = []; @@ -2866,7 +2858,7 @@ private static function getTrueEqualityAssertions( ?Codebase $codebase, int $true_position, bool $cache, - bool $inside_conditional + bool $inside_conditional, ): array { $if_types = []; @@ -2994,7 +2986,7 @@ private static function getFalseEqualityAssertions( ?Codebase $codebase, int $false_position, bool $cache, - bool $inside_conditional + bool $inside_conditional, ): array { $if_types = []; @@ -3145,7 +3137,7 @@ private static function getEmptyArrayEqualityAssertions( ?string $this_class_name, FileSource $source, ?Codebase $codebase, - int $empty_array_position + int $empty_array_position, ): array { $if_types = []; @@ -3216,7 +3208,7 @@ private static function getGettypeEqualityAssertions( PhpParser\Node\Expr\BinaryOp $conditional, ?string $this_class_name, FileSource $source, - int $gettype_position + int $gettype_position, ): array { $if_types = []; @@ -3278,7 +3270,7 @@ private static function getGetdebugtypeEqualityAssertions( PhpParser\Node\Expr\BinaryOp $conditional, ?string $this_class_name, FileSource $source, - int $get_debug_type_position + int $get_debug_type_position, ): array { $if_types = []; @@ -3341,7 +3333,7 @@ private static function getGetclassEqualityAssertions( PhpParser\Node\Expr\BinaryOp $conditional, ?string $this_class_name, StatementsAnalyzer $source, - int $getclass_position + int $getclass_position, ): array { $if_types = []; @@ -3437,7 +3429,7 @@ private static function getTypedValueEqualityAssertions( ?string $this_class_name, StatementsAnalyzer $source, ?Codebase $codebase, - int $typed_value_position + int $typed_value_position, ): array { $if_types = []; @@ -3542,7 +3534,7 @@ private static function getIsaAssertions( PhpParser\Node\Expr\FuncCall $expr, StatementsAnalyzer $source, ?string $this_class_name, - ?string $first_var_name + ?string $first_var_name, ): array { $if_types = []; @@ -3645,7 +3637,7 @@ private static function getIsaAssertions( private static function getInarrayAssertions( PhpParser\Node\Expr\FuncCall $expr, StatementsAnalyzer $source, - ?string $first_var_name + ?string $first_var_name, ): array { $if_types = []; @@ -3724,7 +3716,7 @@ private static function getArrayKeyExistsAssertions( ?Union $first_var_type, ?string $first_var_name, FileSource $source, - ?string $this_class_name + ?string $this_class_name, ): array { $if_types = []; @@ -3848,7 +3840,7 @@ private static function getArrayKeyExistsAssertions( private static function getGreaterAssertions( PhpParser\Node\Expr $conditional, FileSource $source, - ?string $this_class_name + ?string $this_class_name, ): array { $if_types = []; @@ -3961,7 +3953,7 @@ private static function getGreaterAssertions( private static function getSmallerAssertions( PhpParser\Node\Expr $conditional, FileSource $source, - ?string $this_class_name + ?string $this_class_name, ): array { $if_types = []; $min_count = null; @@ -4071,7 +4063,7 @@ private static function getAndCheckInstanceofAssertions( ?Codebase $codebase, FileSource $source, ?string $this_class_name, - bool $inside_negation + bool $inside_negation, ): array { $if_types = []; @@ -4153,7 +4145,7 @@ private static function handleParadoxicalAssertions( ?string $this_class_name, Union $other_type, Codebase $codebase, - PhpParser\Node\Expr\BinaryOp $conditional + PhpParser\Node\Expr\BinaryOp $conditional, ): void { $parent_source = $source->getSource(); @@ -4206,7 +4198,7 @@ public static function isPropertyImmutableOnArgument( string $property, NodeDataProvider $node_provider, ClassLikeStorageProvider $class_provider, - PhpParser\Node\Expr\Variable $arg_expr + PhpParser\Node\Expr\Variable $arg_expr, ): ?string { $type = $node_provider->getType($arg_expr); /** @var string $name */ diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php index c071a741181..9207b360292 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php @@ -1,5 +1,7 @@ data_flow_graph && ($statements_analyzer->data_flow_graph instanceof VariableUseGraph @@ -459,7 +461,7 @@ private static function updateArrayAssignmentChildType( Union $value_type, Union $root_type, bool $offset_already_existed, - ?string $parent_var_id + ?string $parent_var_id, ): Union { $templated_assignment = false; @@ -761,7 +763,7 @@ private static function analyzeNestedArrayAssignment( Union &$root_type, Union &$current_type, ?PhpParser\Node\Expr &$current_dim, - bool &$offset_already_existed + bool &$offset_already_existed, ): void { $var_id_additions = []; @@ -1031,7 +1033,7 @@ private static function analyzeNestedArrayAssignment( */ private static function getDimKeyValues( StatementsAnalyzer $statements_analyzer, - PhpParser\Node\Expr $dim + PhpParser\Node\Expr $dim, ): array { $key_values = []; @@ -1072,7 +1074,7 @@ private static function getDimKeyValues( private static function getArrayAssignmentOffsetType( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr\ArrayDimFetch $child_stmt, - Union $child_stmt_dim_type + Union $child_stmt_dim_type, ): array { if ($child_stmt->dim instanceof PhpParser\Node\Scalar\String_ || (($child_stmt->dim instanceof PhpParser\Node\Expr\ConstFetch diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php index a49249992b5..2899b17938d 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php @@ -1,5 +1,7 @@ property_type = $property_type; $this->id = $id; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php index 127bab853f6..c88a98012b6 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); @@ -360,7 +362,7 @@ public static function trackPropertyImpurity( string $property_id, PropertyStorage $property_storage, ClassLikeStorage $declaring_class_storage, - Context $context + Context $context, ): void { $codebase = $statements_analyzer->getCodebase(); @@ -412,7 +414,7 @@ public static function trackPropertyImpurity( public static function analyzeStatement( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Stmt\Property $stmt, - Context $context + Context $context, ): void { foreach ($stmt->props as $prop) { if ($prop->default) { @@ -448,7 +450,7 @@ private static function taintProperty( string $property_id, ClassLikeStorage $class_storage, Union &$assignment_value_type, - Context $context + Context $context, ): void { if (!$statements_analyzer->data_flow_graph) { return; @@ -565,7 +567,7 @@ public static function taintUnspecializedProperty( ClassLikeStorage $class_storage, Union $assignment_value_type, Context $context, - ?string $var_property_id + ?string $var_property_id, ): void { $codebase = $statements_analyzer->getCodebase(); @@ -662,7 +664,7 @@ private static function analyzeRegularAssignment( Codebase $codebase, Union $assignment_value_type, string $prop_name, - ?string &$var_id + ?string &$var_id, ): array { $was_inside_general_use = $context->inside_general_use; $context->inside_general_use = true; @@ -882,7 +884,7 @@ private static function analyzeAtomicAssignment( Union $assignment_value_type, ?string $lhs_var_id, bool &$has_valid_assignment_type, - bool &$has_regular_setter + bool &$has_regular_setter, ): ?AssignedProperty { if ($lhs_type_part instanceof TNull) { return null; @@ -1430,7 +1432,7 @@ private static function handlePropertyRenames( string $declaring_property_class, string $prop_name, PropertyFetch $stmt, - string $file_path + string $file_path, ): void { if (!$codebase->properties_to_rename) { return; @@ -1460,7 +1462,7 @@ public static function getExpandedPropertyType( Codebase $codebase, string $fq_class_name, string $property_name, - ClassLikeStorage $storage + ClassLikeStorage $storage, ): ?Union { $property_class_name = $codebase->properties->getDeclaringClassForProperty( $fq_class_name . '::$' . $property_name, @@ -1528,7 +1530,7 @@ private static function analyzeSetCall( StatementsAnalyzer $statements_analyzer, PropertyFetch $stmt, string $prop_name, - Expr $assignment_value + Expr $assignment_value, ): void { if ($var_id) { $context->removeVarFromConflictingClauses( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/StaticPropertyAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/StaticPropertyAssignmentAnalyzer.php index e307f514644..7eaf810c14b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/StaticPropertyAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/StaticPropertyAssignmentAnalyzer.php @@ -1,5 +1,7 @@ getFQCLN(), @@ -619,7 +620,7 @@ private static function analyzeAssignment( ?Doc $doc_comment, ?string $extended_var_id, array $var_comments, - array $removed_taints + array $removed_taints, ): ?bool { if ($assign_var instanceof PhpParser\Node\Expr\Variable) { self::analyzeAssignmentToVariable( @@ -699,7 +700,7 @@ public static function assignTypeFromVarDocblock( ?Union &$comment_type = null, ?DocblockTypeLocation &$comment_type_location = null, array $not_ignored_docblock_var_ids = [], - bool $by_ref = false + bool $by_ref = false, ): void { if (!$var_comment->type) { return; @@ -813,7 +814,7 @@ private static function taintAssignment( string $var_id, CodeLocation $var_location, array $removed_taints, - array $added_taints + array $added_taints, ): void { $parent_nodes = $type->parent_nodes; @@ -837,7 +838,7 @@ private static function taintAssignment( public static function analyzeAssignmentOperation( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr\AssignOp $stmt, - Context $context + Context $context, ): bool { if ($stmt instanceof PhpParser\Node\Expr\AssignOp\BitwiseAnd) { $operation = new VirtualBitwiseAnd($stmt->var, $stmt->expr, $stmt->getAttributes()); @@ -896,7 +897,7 @@ public static function analyzeAssignmentOperation( public static function analyzeAssignmentRef( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr\AssignRef $stmt, - Context $context + Context $context, ): bool { ExpressionAnalyzer::analyze($statements_analyzer, $stmt->expr, $context, false, null, false, null, true); @@ -1033,7 +1034,7 @@ public static function assignByRefParam( Union $by_ref_out_type, Context $context, bool $constrain_type = true, - bool $prevent_null = false + bool $prevent_null = false, ): void { if ($stmt instanceof PhpParser\Node\Expr\PropertyFetch && $stmt->name instanceof PhpParser\Node\Identifier) { $prop_name = $stmt->name->name; @@ -1169,7 +1170,7 @@ private static function analyzeDestructuringAssignment( ?PhpParser\Comment\Doc $doc_comment, ?string $extended_var_id, array $var_comments, - array $removed_taints + array $removed_taints, ): void { if (!$assign_value_type->hasArray() && !$assign_value_type->isMixed() @@ -1594,7 +1595,7 @@ private static function analyzePropertyAssignment( Context $context, ?PhpParser\Node\Expr $assign_value, Union $assign_value_type, - ?string $var_id + ?string $var_id, ): void { if (!$assign_var->name instanceof PhpParser\Node\Identifier) { $was_inside_general_use = $context->inside_general_use; @@ -1699,7 +1700,7 @@ private static function analyzeAssignmentToVariable( ?PhpParser\Node\Expr $assign_value, Union $assign_value_type, ?string $var_id, - Context $context + Context $context, ): void { if (is_string($assign_var->name)) { if ($var_id) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php index 1f5f90309e6..93ce365571e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php @@ -1,5 +1,7 @@ getCodebase() : null; @@ -277,10 +279,7 @@ public static function analyze( } } - /** - * @param int|float $result - */ - private static function getNumericalType($result): Union + private static function getNumericalType(int|float $result): Union { if (is_int($result)) { return Type::getInt(false, $result); @@ -309,7 +308,7 @@ private static function analyzeOperands( bool &$has_valid_left_operand, bool &$has_valid_right_operand, bool &$has_string_increment, - Union &$result_type = null + Union &$result_type = null, ): ?Union { if (($left_type_part instanceof TLiteralInt || $left_type_part instanceof TLiteralFloat) && ($right_type_part instanceof TLiteralInt || $right_type_part instanceof TLiteralFloat) @@ -925,15 +924,11 @@ private static function analyzeOperands( return null; } - /** - * @param float|int $operand1 - * @param float|int $operand2 - */ public static function arithmeticOperation( PhpParser\Node $operation, - $operand1, - $operand2, - bool $allow_float_result + float|int $operand1, + float|int $operand2, + bool $allow_float_result, ): ?Union { if ($operation instanceof PhpParser\Node\Expr\BinaryOp\Plus) { $result = $operand1 + $operand2; @@ -981,7 +976,7 @@ private static function analyzeOperandsBetweenIntRange( PhpParser\Node $parent, ?Union &$result_type, TIntRange $left_type_part, - TIntRange $right_type_part + TIntRange $right_type_part, ): void { if ($parent instanceof PhpParser\Node\Expr\BinaryOp\Div) { //can't assume an int range will stay int after division @@ -1083,7 +1078,7 @@ private static function analyzeOperandsBetweenIntRangeAndInt( PhpParser\Node $parent, ?Union &$result_type, Atomic $left_type_part, - Atomic $right_type_part + Atomic $right_type_part, ): void { if (!$left_type_part instanceof TIntRange) { $left_type_part = TIntRange::convertToIntRange($left_type_part); @@ -1099,7 +1094,7 @@ private static function analyzeMulBetweenIntRange( PhpParser\Node\Expr\BinaryOp\Mul $parent, ?Union &$result_type, TIntRange $left_type_part, - TIntRange $right_type_part + TIntRange $right_type_part, ): void { //Mul is a special case because of double negatives. We can only infer when we know both signs strictly if ($right_type_part->min_bound !== null @@ -1275,7 +1270,7 @@ private static function analyzeMulBetweenIntRange( private static function analyzePowBetweenIntRange( ?Union &$result_type, TIntRange $left_type_part, - TIntRange $right_type_part + TIntRange $right_type_part, ): void { //If Pow first operand is negative, the result could be positive or negative, else it will be positive //If Pow second operand is negative, the result will be float, if it's 0, it will be 1/-1, else positive @@ -1348,7 +1343,7 @@ private static function analyzePowBetweenIntRange( private static function analyzeModBetweenIntRange( ?Union &$result_type, TIntRange $left_type_part, - TIntRange $right_type_part + TIntRange $right_type_part, ): void { //result of Mod is not directly dependant on the bounds of the range if ($right_type_part->min_bound !== null && $right_type_part->min_bound === $right_type_part->max_bound) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/CoalesceAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/CoalesceAnalyzer.php index 8a0eed58346..27365076dd1 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/CoalesceAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/CoalesceAnalyzer.php @@ -1,5 +1,7 @@ left; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php index b90ffbc387d..0e1f84bbef2 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); @@ -312,7 +314,7 @@ private static function analyzeOperand( PhpParser\Node\Expr $operand, Union $operand_type, string $side, - Context $context + Context $context, ): void { $codebase = $statements_analyzer->getCodebase(); $config = Config::getInstance(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/NonComparisonOpAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/NonComparisonOpAnalyzer.php index 7f3e7f5391f..5ea2c1143ca 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/NonComparisonOpAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/NonComparisonOpAnalyzer.php @@ -1,5 +1,7 @@ node_data->getType($stmt->left); $stmt_right_type = $statements_analyzer->node_data->getType($stmt->right); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php index d315e36f900..9f55ba32b02 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php @@ -1,5 +1,7 @@ 100) { $statements_analyzer->node_data->setType($stmt, Type::getString()); @@ -373,7 +375,7 @@ public static function addDataFlow( PhpParser\Node\Expr $stmt, PhpParser\Node\Expr $left, PhpParser\Node\Expr $right, - string $type = 'binaryop' + string $type = 'binaryop', ): void { if ($stmt->getLine() === -1) { throw new UnexpectedValueException('bad'); @@ -455,7 +457,7 @@ private static function checkForImpureEqualityComparison( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr\BinaryOp\Equal $stmt, Union $stmt_left_type, - Union $stmt_right_type + Union $stmt_right_type, ): void { $codebase = $statements_analyzer->getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BitwiseNotAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BitwiseNotAnalyzer.php index 3efa5c6ce69..dfb83b797b5 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BitwiseNotAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BitwiseNotAnalyzer.php @@ -1,5 +1,7 @@ expr, $context) === false) { return false; @@ -104,7 +106,7 @@ public static function analyze( private static function addDataFlow( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr $stmt, - PhpParser\Node\Expr $value + PhpParser\Node\Expr $value, ): void { $result_type = $statements_analyzer->node_data->getType($stmt); if ($statements_analyzer->data_flow_graph instanceof VariableUseGraph && $result_type) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BooleanNotAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BooleanNotAnalyzer.php index fa053702791..5d113df1daf 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BooleanNotAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BooleanNotAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); @@ -240,7 +242,7 @@ private static function checkFunctionLikeTypeMatches( ?array $class_generic_params, ?TemplateResult $template_result, bool $specialize_taint, - bool $in_call_map + bool $in_call_map, ): ?bool { if (!$function_param->type) { if (!$codebase->infer_types_from_usage && !$statements_analyzer->data_flow_graph) { @@ -676,7 +678,7 @@ public static function verifyType( ?Atomic $unpacked_atomic_array, bool $specialize_taint, bool $in_call_map, - CodeLocation $function_call_location + CodeLocation $function_call_location, ): ?bool { $codebase = $statements_analyzer->getCodebase(); @@ -1170,7 +1172,7 @@ private static function verifyExplicitParam( Union $param_type, CodeLocation $arg_location, PhpParser\Node\Expr $input_expr, - Context $context + Context $context, ): void { $codebase = $statements_analyzer->getCodebase(); @@ -1345,7 +1347,7 @@ private static function coerceValueAfterGatekeeperArgument( ?Union $signature_param_type, Context $context, bool $unpack, - ?Atomic $unpacked_atomic_array + ?Atomic $unpacked_atomic_array, ): void { if ($param_type->hasMixed()) { return; @@ -1471,7 +1473,7 @@ private static function processTaintedness( Union $input_type, PhpParser\Node\Expr $expr, Context $context, - bool $specialize_taint + bool $specialize_taint, ): void { $codebase = $statements_analyzer->getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentMapPopulator.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentMapPopulator.php index fbbc5e24ea6..0620ebe4703 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentMapPopulator.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentMapPopulator.php @@ -1,5 +1,7 @@ file_provider->getContents($statements_analyzer->getFilePath()); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php index 653ffedc9ac..1f63aa343a3 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); @@ -367,7 +369,7 @@ private static function handleClosureArg( TemplateResult $template_result, int $argument_offset, PhpParser\Node\Arg $arg, - FunctionLikeParameter $param + FunctionLikeParameter $param, ): void { if (!$param->type) { return; @@ -528,7 +530,6 @@ private static function handleClosureArg( /** * @param list $args - * @param string|MethodIdentifier|null $method_id * @param array $function_params * @return false|null * @psalm-suppress ComplexMethod there's just not much that can be done about this @@ -536,13 +537,13 @@ private static function handleClosureArg( public static function checkArgumentsMatch( StatementsAnalyzer $statements_analyzer, array $args, - $method_id, + string|MethodIdentifier|null $method_id, array $function_params, ?FunctionLikeStorage $function_storage, ?ClassLikeStorage $class_storage, TemplateResult $template_result, CodeLocation $code_location, - Context $context + Context $context, ): ?bool { $in_call_map = $method_id ? InternalCallMapHandler::inCallMap((string) $method_id) : false; @@ -985,7 +986,7 @@ private static function handlePossiblyMatchingByRefParam( int $argument_offset, PhpParser\Node\Arg $arg, Context $context, - ?TemplateResult $template_result + ?TemplateResult $template_result, ): ?bool { if ($arg->value instanceof PhpParser\Node\Scalar || $arg->value instanceof PhpParser\Node\Expr\Cast @@ -1130,7 +1131,7 @@ private static function handlePossiblyMatchingByRefParam( private static function evaluateArbitraryParam( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Arg $arg, - Context $context + Context $context, ): ?bool { // there are a bunch of things we want to evaluate even when we don't // know what function/method is being called @@ -1241,7 +1242,7 @@ private static function handleByRefFunctionArg( ?string $method_id, int $argument_offset, PhpParser\Node\Arg $arg, - Context $context + Context $context, ): ?bool { $var_id = ExpressionIdentifier::getVarId( $arg->value, @@ -1378,7 +1379,7 @@ private static function getProvisionalTemplateResultForFunctionLike( ?TemplateResult $template_result, array $args, array $function_params, - ?FunctionLikeParameter $last_param + ?FunctionLikeParameter $last_param, ): ?TemplateResult { $template_types = CallAnalyzer::getTemplateTypesForCall( $codebase, @@ -1458,7 +1459,6 @@ private static function getProvisionalTemplateResultForFunctionLike( /** * @param array $args - * @param string|MethodIdentifier|null $method_id * @param array $function_params */ private static function checkArgCount( @@ -1471,9 +1471,9 @@ private static function checkArgCount( array $args, array $function_params, bool $in_call_map, - $method_id, + string|MethodIdentifier|null $method_id, ?string $cased_method_id, - CodeLocation $code_location + CodeLocation $code_location, ): void { if (!$is_variadic && count($args) > count($function_params) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php index c1aa8540e1a..63a8085b83f 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php @@ -1,5 +1,7 @@ value; $nb_args = count($args); @@ -336,7 +338,7 @@ public static function handleAddition( public static function handleSplice( StatementsAnalyzer $statements_analyzer, array $args, - Context $context + Context $context, ): ?bool { $context->inside_call = true; $array_arg = $args[0]->value; @@ -620,7 +622,7 @@ public static function handleByRefArrayAdjustment( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Arg $arg, Context $context, - bool $is_array_shift + bool $is_array_shift, ): void { $var_id = ExpressionIdentifier::getVarId( $arg->value, @@ -743,7 +745,7 @@ private static function checkClosureType( int $min_closure_param_count, int $max_closure_param_count, array $array_arg_types, - bool $check_functions + bool $check_functions, ): void { $codebase = $statements_analyzer->getCodebase(); @@ -908,7 +910,7 @@ private static function checkClosureTypeArgs( PhpParser\Node\Arg $closure_arg, int $min_closure_param_count, int $max_closure_param_count, - array $array_arg_types + array $array_arg_types, ): void { $codebase = $statements_analyzer->getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php index 6802fa495db..71b507ec9d5 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php @@ -1,5 +1,7 @@ is_trait ? $static_class_storage @@ -188,7 +190,7 @@ private static function resolveTemplateParam( Union $input_type_extends, ClassLikeStorage $static_class_storage, TGenericObject $lhs_type_part, - ?TemplateResult $template_result = null + ?TemplateResult $template_result = null, ): ?Union { $output_type_extends = null; foreach ($input_type_extends->getAtomicTypes() as $type_extends_atomic) { @@ -262,7 +264,7 @@ private static function expandType( Union $input_type_extends, array $e, string $static_fq_class_name, - ?array $static_template_types + ?array $static_template_types, ): array { $output_type_extends = []; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php index 21bdf3f9ea7..c979c370255 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php @@ -1,5 +1,7 @@ name; @@ -433,7 +435,7 @@ private static function handleNamedFunction( PhpParser\Node\Expr\FuncCall $stmt, PhpParser\Node\Name $function_name, Context $context, - CodeLocation $code_location + CodeLocation $code_location, ): FunctionCallInfo { $function_call_info = new FunctionCallInfo(); @@ -612,7 +614,7 @@ private static function getAnalyzeNamedExpression( PhpParser\Node\Expr\FuncCall $stmt, PhpParser\Node\Expr\FuncCall $real_stmt, PhpParser\Node\Expr $function_name, - Context $context + Context $context, ): FunctionCallInfo { $function_call_info = new FunctionCallInfo(); @@ -887,7 +889,7 @@ private static function analyzeInvokeCall( PhpParser\Node\Expr\FuncCall $real_stmt, PhpParser\Node\Expr $function_name, Context $context, - Atomic $atomic_type + Atomic $atomic_type, ): void { $old_data_provider = $statements_analyzer->node_data; @@ -943,7 +945,7 @@ private static function processAssertFunctionEffects( Codebase $codebase, PhpParser\Node\Expr\FuncCall $stmt, PhpParser\Node\Arg $first_arg, - Context $context + Context $context, ): void { $first_arg_value_id = spl_object_id($first_arg->value); @@ -1035,7 +1037,7 @@ private static function checkFunctionCallPurity( PhpParser\Node\Expr\FuncCall $stmt, PhpParser\Node $function_name, FunctionCallInfo $function_call_info, - Context $context + Context $context, ): void { $config = $codebase->config; @@ -1123,7 +1125,7 @@ private static function checkFunctionCallPurity( private static function callUsesByReferenceArguments( FunctionCallInfo $function_call_info, - PhpParser\Node\Expr\FuncCall $stmt + PhpParser\Node\Expr\FuncCall $stmt, ): bool { // If the function doesn't have any by-reference parameters // we shouldn't look any further. diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php index c2e38864d5b..e455be4f045 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php @@ -1,5 +1,7 @@ config; @@ -314,7 +316,7 @@ private static function getReturnTypeFromCallMapWithArgs( string $function_id, array $call_args, TCallable $callmap_callable, - Context $context + Context $context, ): Union { $call_map_key = strtolower($function_id); @@ -540,7 +542,7 @@ private static function taintReturnType( FunctionLikeStorage $function_storage, Union &$stmt_type, TemplateResult $template_result, - Context $context + Context $context, ): ?DataFlowNode { if (!$statements_analyzer->data_flow_graph) { return null; @@ -702,7 +704,7 @@ public static function taintUsingFlows( CodeLocation $node_location, DataFlowNode $function_call_node, array $removed_taints, - array $added_taints = [] + array $added_taints = [], ): void { foreach ($function_storage->return_source_params as $i => $path_type) { if (!isset($args[$i])) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/HighOrderFunctionArgHandler.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/HighOrderFunctionArgHandler.php index 3d1a51c4e67..0e479caf902 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/HighOrderFunctionArgHandler.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/HighOrderFunctionArgHandler.php @@ -59,7 +59,7 @@ public static function remapLowerBounds( StatementsAnalyzer $statements_analyzer, TemplateResult $inferred_template_result, HighOrderFunctionArgInfo $input_function, - Union $container_function_type + Union $container_function_type, ): TemplateResult { // Try to infer container callable by $inferred_template_result $container_type = TemplateInferredTypeReplacer::replace( @@ -116,7 +116,7 @@ public static function enhanceCallableArgType( PhpParser\Node\Expr $arg_expr, StatementsAnalyzer $statements_analyzer, HighOrderFunctionArgInfo $high_order_callable_info, - TemplateResult $high_order_template_result + TemplateResult $high_order_template_result, ): void { // Psalm can infer simple callable/closure. // But can't infer first-class-callable or high-order function. @@ -152,7 +152,7 @@ public static function getCallableArgInfo( Context $context, PhpParser\Node\Expr $input_arg_expr, StatementsAnalyzer $statements_analyzer, - FunctionLikeParameter $container_param + FunctionLikeParameter $container_param, ): ?HighOrderFunctionArgInfo { if (!self::isSupported($container_param)) { return null; @@ -305,7 +305,7 @@ private static function isSupported(FunctionLikeParameter $container_param): boo private static function fromLiteralString( Union $constant, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): ?HighOrderFunctionArgInfo { $literal = $constant->isSingle() ? $constant->getSingleAtomic() : null; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/HighOrderFunctionArgInfo.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/HighOrderFunctionArgInfo.php index 526e6ee1141..c7cb62a05a3 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/HighOrderFunctionArgInfo.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/HighOrderFunctionArgInfo.php @@ -35,7 +35,7 @@ final class HighOrderFunctionArgInfo public function __construct( string $type, FunctionLikeStorage $function_storage, - ClassLikeStorage $class_storage = null + ClassLikeStorage $class_storage = null, ) { $this->type = $type; $this->function_storage = $function_storage; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php index 7e033b36f1d..38b6571a1a1 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php @@ -1,5 +1,7 @@ as->isMixed() @@ -536,7 +538,7 @@ private static function getIntersectionReturnType( Atomic $lhs_type_part, ?string $lhs_var_id, AtomicMethodCallAnalysisResult $result, - array $intersection_types + array $intersection_types, ): array { $all_intersection_return_type = null; $all_intersection_existent_method_ids = []; @@ -593,7 +595,7 @@ private static function updateResultReturnType( AtomicMethodCallAnalysisResult $result, Union $return_type_candidate, ?Union $all_intersection_return_type, - Codebase $codebase + Codebase $codebase, ): void { if ($all_intersection_return_type) { $return_type_candidate = Type::intersectUnionTypes( @@ -615,7 +617,7 @@ private static function handleInvalidClass( ?string $lhs_var_id, Context $context, bool $is_intersection, - AtomicMethodCallAnalysisResult $result + AtomicMethodCallAnalysisResult $result, ): void { switch (get_class($lhs_type_part)) { case TNull::class: @@ -735,7 +737,7 @@ private static function handleTemplatedMixins( StatementsSource $source, PhpParser\Node\Expr\MethodCall $stmt, StatementsAnalyzer $statements_analyzer, - string $fq_class_name + string $fq_class_name, ): array { $naive_method_exists = false; @@ -824,7 +826,7 @@ private static function handleRegularMixins( PhpParser\Node\Expr\MethodCall $stmt, StatementsAnalyzer $statements_analyzer, string $fq_class_name, - ?string $lhs_var_id + ?string $lhs_var_id, ): array { $naive_method_exists = false; @@ -912,7 +914,7 @@ private static function handleCallableObject( Context $context, ?TCallable $lhs_type_part_callable, AtomicMethodCallAnalysisResult $result, - ?TemplateResult $inferred_template_result = null + ?TemplateResult $inferred_template_result = null, ): void { $method_id = 'object::__invoke'; $result->existent_method_ids[] = $method_id; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php index 980043f1ce7..d2823b626a5 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php @@ -1,5 +1,7 @@ config; @@ -538,7 +540,7 @@ private static function getMagicGetterOrSetterProperty( PhpParser\Node\Expr\MethodCall $stmt, PhpParser\Node\Identifier $stmt_name, Context $context, - string $fq_class_name + string $fq_class_name, ): ?Union { $method_name = strtolower($stmt_name->name); if (!in_array($method_name, ['__get', '__set'], true)) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php index d3d42a95ef3..97ad79b4052 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php @@ -1,5 +1,7 @@ methods; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallPurityAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallPurityAnalyzer.php index 760adf93590..0f2677fc9f5 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallPurityAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallPurityAnalyzer.php @@ -1,5 +1,7 @@ external_mutation_free && $statements_analyzer->node_data->isPureCompatible($stmt->var); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php index a277406d062..d5592a84bc9 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php @@ -1,5 +1,7 @@ data_flow_graph || !$declaring_method_id @@ -559,7 +561,7 @@ public static function replaceTemplateTypes( TemplateResult $template_result, MethodIdentifier $method_id, int $arg_count, - Codebase $codebase + Codebase $codebase, ): Union { if ($template_result->template_types) { $bindable_template_types = $return_type_candidate->getTemplateTypes(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php index 2cc632a35e3..0249a5c6a2a 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); $codebase_methods = $codebase->methods; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php index 8e9346d803d..2c8e14f4a84 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php @@ -1,5 +1,7 @@ fq_class_name; $method_name_lc = $method_id->method_name; @@ -250,7 +252,7 @@ public static function handleMissingOrMagicMethod( ?string $intersection_method_id, string $cased_method_id, AtomicMethodCallAnalysisResult $result, - ?Atomic $lhs_type_part + ?Atomic $lhs_type_part, ): void { $fq_class_name = $method_id->fq_class_name; $method_name_lc = $method_id->method_name; @@ -417,7 +419,7 @@ private static function createFirstClassCallableReturnType(?MethodStorage $metho private static function findPseudoMethodAndClassStorages( Codebase $codebase, ClassLikeStorage $static_class_storage, - string $method_name_lc + string $method_name_lc, ): ?array { if (isset($static_class_storage->declaring_pseudo_method_ids[$method_name_lc])) { $method_id = $static_class_storage->declaring_pseudo_method_ids[$method_name_lc]; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php index 4773c21b650..7a6bde5b6ed 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php @@ -1,5 +1,7 @@ inside_call; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php index 874f0618172..4466c2765b5 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php @@ -1,5 +1,7 @@ getArgs()[0] ?? null; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php index 45476ca22b6..e55a28611e0 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php @@ -1,5 +1,7 @@ classlike_storage_provider->get($fq_class_name); @@ -627,7 +629,7 @@ private static function analyzeConstructorExpression( PhpParser\Node\Expr $stmt_class, Config $config, ?string &$fq_class_name, - bool &$can_extend + bool &$can_extend, ): void { $was_inside_general_use = $context->inside_general_use; $context->inside_general_use = true; @@ -734,7 +736,7 @@ private static function getNewType( PhpParser\Node\Expr\New_ $stmt, Union $stmt_class_type, Config $config, - bool &$can_extend + bool &$can_extend, ): ?Union { $new_types = []; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php index fa7cc498184..b9e4d72f445 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php @@ -1,5 +1,7 @@ data_flow_graph) { return; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php index b0839345418..8a76455c7b0 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); @@ -907,7 +909,7 @@ private static function checkPseudoMethod( array $args, ClassLikeStorage $class_storage, MethodStorage $pseudo_method_storage, - Context $context + Context $context, ): ?bool { if (ArgumentsAnalyzer::analyze( $statements_analyzer, @@ -1010,7 +1012,7 @@ public static function handleNonObjectCall( PhpParser\Node\Expr\StaticCall $stmt, Context $context, Atomic $lhs_type_part, - bool $ignore_nullable_issues + bool $ignore_nullable_issues, ): void { $codebase = $statements_analyzer->getCodebase(); $config = $codebase->config; @@ -1085,7 +1087,7 @@ public static function handleNonObjectCall( private static function findPseudoMethodAndClassStorages( Codebase $codebase, ClassLikeStorage $static_class_storage, - string $method_name_lc + string $method_name_lc, ): ?array { if ($pseudo_method_storage = $static_class_storage->pseudo_static_methods[$method_name_lc] ?? null) { return [$pseudo_method_storage, $static_class_storage]; @@ -1122,7 +1124,7 @@ private static function forwardCallToInstanceMethod( PhpParser\Node\Identifier $stmt_name, Context $context, string $virtual_var_name = 'this', - bool $always_set_node_type = false + bool $always_set_node_type = false, ): bool { $old_data_provider = $statements_analyzer->node_data; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php index 607f521881a..2f907c54329 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php @@ -1,5 +1,7 @@ fq_class_name; $method_name_lc = $method_id->method_name; @@ -475,7 +477,7 @@ private static function getMethodReturnType( Context $context, string $fq_class_name, ClassLikeStorage $class_storage, - Config $config + Config $config, ): ?Union { $return_type_candidate = $codebase->methods->getMethodReturnType( $method_id, @@ -616,7 +618,7 @@ private static function resolveTemplateResultLowerBound( StaticCall $stmt, ClassLikeStorage $class_storage, MethodIdentifier $method_id, - TTemplateParam $template_type + TTemplateParam $template_type, ): array { if ($template_type->param_name === 'TFunctionArgCount') { return [ diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php index a547b291cb5..24655ecfbbe 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php @@ -1,5 +1,7 @@ getFQCLN(); @@ -278,7 +280,7 @@ public static function checkMethodArgs( TemplateResult $template_result, Context $context, CodeLocation $code_location, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): bool { $codebase = $statements_analyzer->getCodebase(); @@ -393,7 +395,7 @@ public static function getTemplateTypesForCall( ?string $appearing_class_name, ?ClassLikeStorage $calling_class_storage, array $existing_template_types = [], - array $class_template_params = [] + array $class_template_params = [], ): array { $template_types = $existing_template_types; @@ -465,7 +467,7 @@ public static function getGenericParamForOffset( string $fq_class_name, string $template_name, array $template_extended_params, - array $found_generic_params + array $found_generic_params, ): Union { if (isset($found_generic_params[$template_name][$fq_class_name])) { return $found_generic_params[$template_name][$fq_class_name]; @@ -498,7 +500,7 @@ public static function getGenericParamForOffset( */ public static function getFunctionIdsFromCallableArg( FileSource $file_source, - PhpParser\Node\Expr $callable_arg + PhpParser\Node\Expr $callable_arg, ): array { if ($callable_arg instanceof PhpParser\Node\Expr\BinaryOp\Concat) { if ($callable_arg->left instanceof PhpParser\Node\Expr\ClassConstFetch @@ -603,7 +605,7 @@ public static function checkFunctionExists( StatementsAnalyzer $statements_analyzer, string &$function_id, CodeLocation $code_location, - bool $can_be_in_root_scope + bool $can_be_in_root_scope, ): bool { $cased_function_id = $function_id; $function_id = strtolower($function_id); @@ -648,7 +650,7 @@ public static function applyAssertionsToContext( array $args, TemplateResult $template_result, Context $context, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): void { $type_assertions = []; @@ -973,7 +975,7 @@ public static function checkTemplateResult( StatementsAnalyzer $statements_analyzer, TemplateResult $template_result, CodeLocation $code_location, - ?string $function_id + ?string $function_id, ): void { if ($template_result->lower_bounds && $template_result->upper_bounds) { foreach ($template_result->upper_bounds as $template_name => $defining_map) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php index 83825307c32..4233ff42cbd 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php @@ -1,5 +1,7 @@ expr, $context) === false) { @@ -317,7 +319,7 @@ public static function castIntAttempt( StatementsAnalyzer $statements_analyzer, Union $stmt_type, PhpParser\Node\Expr $stmt, - bool $explicit_cast = false + bool $explicit_cast = false, ): Union { $codebase = $statements_analyzer->getCodebase(); @@ -507,7 +509,7 @@ public static function castFloatAttempt( StatementsAnalyzer $statements_analyzer, Union $stmt_type, PhpParser\Node\Expr $stmt, - bool $explicit_cast = false + bool $explicit_cast = false, ): Union { $codebase = $statements_analyzer->getCodebase(); @@ -697,7 +699,7 @@ public static function castStringAttempt( Context $context, Union $stmt_type, PhpParser\Node\Expr $stmt, - bool $explicit_cast = false + bool $explicit_cast = false, ): Union { $codebase = $statements_analyzer->getCodebase(); @@ -888,7 +890,7 @@ public static function castStringAttempt( private static function checkExprGeneralUse( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr\Cast $stmt, - Context $context + Context $context, ): bool { $was_inside_general_use = $context->inside_general_use; $context->inside_general_use = true; @@ -900,7 +902,7 @@ private static function checkExprGeneralUse( private static function handleRedundantCast( Union $maybe_type, StatementsAnalyzer $statements_analyzer, - PhpParser\Node\Expr\Cast $stmt + PhpParser\Node\Expr\Cast $stmt, ): void { $codebase = $statements_analyzer->getCodebase(); $project_analyzer = $statements_analyzer->getProjectAnalyzer(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php index 2dec200fc9c..22301f63f25 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); @@ -688,7 +690,7 @@ public static function analyzeFetch( public static function analyzeAssignment( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Stmt\ClassConst $stmt, - Context $context + Context $context, ): void { assert($context->self !== null); $class_storage = $statements_analyzer->getCodebase()->classlike_storage_provider->get($context->self); @@ -724,7 +726,7 @@ public static function analyzeAssignment( public static function analyze( ClassLikeStorage $class_storage, - Codebase $codebase + Codebase $codebase, ): void { foreach ($class_storage->constants as $const_name => $const_storage) { [$parent_classlike_storage, $parent_const_storage] = self::getOverriddenConstant( @@ -822,7 +824,7 @@ private static function getOverriddenConstant( ClassLikeStorage $class_storage, ClassConstantStorage $const_storage, string $const_name, - Codebase $codebase + Codebase $codebase, ): ?array { $parent_classlike_storage = $interface_const_storage = $parent_const_storage = null; $interface_overrides = []; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CloneAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CloneAnalyzer.php index 7f1927951d2..3b7aa4d4caf 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CloneAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CloneAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); $codebase_methods = $codebase->methods; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/EmptyAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/EmptyAnalyzer.php index 9728d331397..70c8af6c182 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/EmptyAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/EmptyAnalyzer.php @@ -1,5 +1,7 @@ expr, $context); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/EncapsulatedStringAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/EncapsulatedStringAnalyzer.php index 9792a91c87e..8d62ab63ae2 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/EncapsulatedStringAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/EncapsulatedStringAnalyzer.php @@ -1,5 +1,7 @@ inside_call; $context->inside_call = true; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ExitAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ExitAnalyzer.php index 36d6be84b95..12f8e9c54f0 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ExitAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ExitAnalyzer.php @@ -1,5 +1,7 @@ name)) { return '$' . $stmt->name; @@ -75,7 +77,7 @@ public static function getVarId( public static function getRootVarId( PhpParser\Node\Expr $stmt, ?string $this_class_name, - ?FileSource $source = null + ?FileSource $source = null, ): ?string { if ($stmt instanceof PhpParser\Node\Expr\Variable || $stmt instanceof PhpParser\Node\Expr\StaticPropertyFetch @@ -101,7 +103,7 @@ public static function getRootVarId( public static function getExtendedVarId( PhpParser\Node\Expr $stmt, ?string $this_class_name, - ?FileSource $source = null + ?FileSource $source = null, ): ?string { if ($stmt instanceof PhpParser\Node\Expr\Assign) { return self::getExtendedVarId($stmt->var, $this_class_name, $source); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php index 2567ca86ac3..8f7e21b3c99 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php @@ -1,5 +1,7 @@ var, @@ -365,7 +367,7 @@ public static function taintArrayFetch( ?string $keyed_array_var_id, Union &$stmt_type, Union &$offset_type, - ?Context $context = null + ?Context $context = null, ): void { if ($statements_analyzer->data_flow_graph && ($stmt_var_type = $statements_analyzer->node_data->getType($var)) @@ -466,7 +468,7 @@ public static function getArrayAccessTypeGivenOffset( ?string $extended_var_id, Context $context, PhpParser\Node\Expr $assign_value = null, - Union $replacement_type = null + Union $replacement_type = null, ): Union { $offset_type = $offset_type_original->getBuilder(); @@ -885,7 +887,7 @@ private static function checkLiteralIntArrayOffset( ?string $extended_var_id, PhpParser\Node\Expr\ArrayDimFetch $stmt, Context $context, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): void { if ($context->inside_isset || $context->inside_unset) { return; @@ -933,7 +935,7 @@ private static function checkLiteralStringArrayOffset( ?string $extended_var_id, PhpParser\Node\Expr\ArrayDimFetch $stmt, Context $context, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): void { if ($context->inside_isset || $context->inside_unset) { return; @@ -1017,7 +1019,7 @@ public static function handleMixedArrayAccess( ?string $extended_var_id, PhpParser\Node\Expr\ArrayDimFetch $stmt, ?Union $array_access_type, - Atomic $type + Atomic $type, ): Union { if (!$context->collect_initializations && !$context->collect_mutations @@ -1105,7 +1107,7 @@ private static function handleArrayAccessOnArray( array &$expected_offset_types, ?Union &$array_access_type, bool &$has_array_access, - bool &$has_valid_offset + bool &$has_valid_offset, ): void { $has_array_access = true; @@ -1236,7 +1238,7 @@ private static function handleArrayAccessOnTArray( array &$expected_offset_types, ?Union &$array_access_type, Atomic $original_type, - bool &$has_valid_offset + bool &$has_valid_offset, ): void { // if we're assigning to an empty array with a key offset, refashion that array if ($in_assignment) { @@ -1400,7 +1402,7 @@ private static function handleArrayAccessOnClassStringMap( TClassStringMap &$type, MutableUnion $offset_type, ?Union $replacement_type, - ?Union &$array_access_type + ?Union &$array_access_type, ): void { $offset_type_parts = array_values($offset_type->getAtomicTypes()); @@ -1510,7 +1512,7 @@ private static function handleArrayAccessOnKeyedArray( TKeyedArray &$type, bool $hasMixed, array &$expected_offset_types, - bool &$has_valid_offset + bool &$has_valid_offset, ): void { $generic_key_type = $type->getGenericKeyType(); @@ -1735,7 +1737,7 @@ private static function handleArrayAccessOnNamedObject( bool $in_assignment, ?PhpParser\Node\Expr $assign_value, ?Union &$array_access_type, - bool &$has_array_access + bool &$has_array_access, ): void { if (strtolower($type->value) === 'simplexmlelement') { $call_array_access_type = new Union([new TNamedObject('SimpleXMLElement')]); @@ -1884,7 +1886,7 @@ private static function handleArrayAccessOnString( MutableUnion $offset_type, array &$expected_offset_types, ?Union &$array_access_type, - bool &$has_valid_offset + bool &$has_valid_offset, ): void { if ($in_assignment && $replacement_type) { if ($replacement_type->hasMixed()) { @@ -1967,7 +1969,7 @@ private static function handleArrayAccessOnString( private static function checkArrayOffsetType( MutableUnion $offset_type, array $offset_types, - Codebase $codebase + Codebase $codebase, ): bool { $has_valid_absolute_offset = false; foreach ($offset_types as $atomic_offset_type) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php index 6636793836b..4fb88b112af 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); @@ -589,7 +591,7 @@ private static function propertyFetchCanBeAnalyzed( ?string $declaring_property_class, ClassLikeStorage $class_storage, MethodIdentifier $get_method_id, - bool $in_assignment + bool $in_assignment, ): bool { if ((!$naive_property_exists || ($stmt_var_id !== '$this' @@ -743,7 +745,7 @@ public static function localizePropertyType( Union $class_property_type, TGenericObject $lhs_type_part, ClassLikeStorage $property_class_storage, - ClassLikeStorage $property_declaring_class_storage + ClassLikeStorage $property_declaring_class_storage, ): Union { $template_types = CallAnalyzer::getTemplateTypesForCall( $codebase, @@ -816,7 +818,7 @@ public static function processTaints( string $property_id, ClassLikeStorage $class_storage, bool $in_assignment, - ?Context $context = null + ?Context $context = null, ): void { if (!$statements_analyzer->data_flow_graph) { return; @@ -923,7 +925,7 @@ public static function processUnspecialTaints( string $property_id, bool $in_assignment, ?array $added_taints, - ?array $removed_taints + ?array $removed_taints, ): void { if (!$statements_analyzer->data_flow_graph) { return; @@ -979,7 +981,7 @@ public static function processUnspecialTaints( private static function handleEnumName( StatementsAnalyzer $statements_analyzer, PropertyFetch $stmt, - Atomic $lhs_type_part + Atomic $lhs_type_part, ): void { if ($lhs_type_part instanceof TEnumCase) { $statements_analyzer->node_data->setType( @@ -995,7 +997,7 @@ private static function handleEnumValue( StatementsAnalyzer $statements_analyzer, PropertyFetch $stmt, Union $stmt_var_type, - ClassLikeStorage $class_storage + ClassLikeStorage $class_storage, ): void { $relevant_enum_cases = array_filter( $stmt_var_type->getAtomicTypes(), @@ -1043,7 +1045,7 @@ private static function handleUndefinedProperty( ?string $stmt_var_id, string $property_id, bool $has_magic_getter, - ?string $var_id + ?string $var_id, ): void { if ($context->inside_isset || $context->collect_initializations) { if ($context->pure) { @@ -1117,7 +1119,7 @@ private static function handleNonExistentClass( bool &$class_exists, bool &$interface_exists, string &$fq_class_name, - bool &$override_property_visibility + bool &$override_property_visibility, ): void { if ($codebase->interfaceExists($lhs_type_part->value)) { $interface_exists = true; @@ -1195,7 +1197,7 @@ private static function handleNonExistentProperty( ?string $stmt_var_id, bool $has_magic_getter, ?string $var_id, - bool &$has_valid_fetch_type + bool &$has_valid_fetch_type, ): void { if (($config->use_phpdoc_property_without_magic_or_parent || $class_storage->hasAttributeIncludingParents('AllowDynamicProperties', $codebase)) @@ -1262,7 +1264,7 @@ private static function getClassPropertyType( string $property_id, string $fq_class_name, string $prop_name, - TNamedObject $lhs_type_part + TNamedObject $lhs_type_part, ): Union { $class_property_type = $codebase->properties->getPropertyType( $property_id, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php index 8b30a60fc91..b078aef6ea6 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php @@ -1,5 +1,7 @@ name->toString(); @@ -103,7 +105,7 @@ public static function analyze( public static function getGlobalConstType( Codebase $codebase, string $fq_const_name, - string $const_name + string $const_name, ): ?Union { if ($const_name === 'STDERR' || $const_name === 'STDOUT' @@ -196,7 +198,7 @@ public static function getConstType( StatementsAnalyzer $statements_analyzer, string $const_name, bool $is_fully_qualified, - ?Context $context + ?Context $context, ): ?Union { $aliased_constants = $statements_analyzer->getAliases()->constants; @@ -253,7 +255,7 @@ public static function setConstType( StatementsAnalyzer $statements_analyzer, string $const_name, Union $const_type, - Context $context + Context $context, ): void { $context->vars_in_scope[$const_name] = $const_type; $context->constants[$const_name] = $const_type; @@ -269,7 +271,7 @@ public static function getConstName( PhpParser\Node\Expr $first_arg_value, NodeDataProvider $type_provider, Codebase $codebase, - Aliases $aliases + Aliases $aliases, ): ?string { $const_name = null; @@ -293,7 +295,7 @@ public static function getConstName( public static function analyzeConstAssignment( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Stmt\Const_ $stmt, - Context $context + Context $context, ): void { foreach ($stmt->consts as $const) { ExpressionAnalyzer::analyze($statements_analyzer, $const->value, $context); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/InstancePropertyFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/InstancePropertyFetchAnalyzer.php index 528acd0609d..8fe65b4f5cd 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/InstancePropertyFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/InstancePropertyFetchAnalyzer.php @@ -1,5 +1,7 @@ inside_general_use; $context->inside_general_use = true; @@ -311,7 +313,7 @@ private static function handleScopedProperty( PhpParser\Node\Expr\PropertyFetch $stmt, Codebase $codebase, ?string $stmt_var_id, - bool $in_assignment + bool $in_assignment, ): void { $stmt_type = $context->vars_in_scope[$var_id]; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/StaticPropertyFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/StaticPropertyFetchAnalyzer.php index 46a4cf0f414..a3c8151550b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/StaticPropertyFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/StaticPropertyFetchAnalyzer.php @@ -1,5 +1,7 @@ class instanceof PhpParser\Node\Name) { self::analyzeVariableStaticPropertyFetch($statements_analyzer, $stmt->class, $stmt, $context); @@ -418,7 +420,7 @@ private static function analyzeVariableStaticPropertyFetch( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr $stmt_class, PhpParser\Node\Expr\StaticPropertyFetch $stmt, - Context $context + Context $context, ): void { $was_inside_general_use = $context->inside_general_use; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/VariableFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/VariableFetchAnalyzer.php index 80ad5e0e97f..511671cea8b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/VariableFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/VariableFetchAnalyzer.php @@ -1,5 +1,7 @@ getFileAnalyzer()->project_analyzer; $codebase = $statements_analyzer->getCodebase(); @@ -431,7 +433,7 @@ private static function addDataFlowToVariable( PhpParser\Node\Expr\Variable $stmt, string $var_name, Union &$stmt_type, - Context $context + Context $context, ): void { $codebase = $statements_analyzer->getCodebase(); @@ -505,7 +507,7 @@ private static function taintVariable( StatementsAnalyzer $statements_analyzer, string $var_name, Union &$type, - PhpParser\Node\Expr\Variable $stmt + PhpParser\Node\Expr\Variable $stmt, ): void { if ($statements_analyzer->data_flow_graph instanceof TaintFlowGraph && !in_array('TaintedInput', $statements_analyzer->getSuppressedIssues()) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/IncDecExpressionAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/IncDecExpressionAnalyzer.php index 1526bb6a59f..41a8a44d13a 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/IncDecExpressionAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/IncDecExpressionAnalyzer.php @@ -1,5 +1,7 @@ inside_assignment; $context->inside_assignment = true; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php index e293afabc58..ae1800138ea 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); $config = $codebase->config; @@ -283,7 +285,7 @@ public static function getPathTo( ?NodeDataProvider $type_provider, ?StatementsAnalyzer $statements_analyzer, string $file_name, - Config $config + Config $config, ): ?string { if (DIRECTORY_SEPARATOR === '/') { $is_path_relative = $file_name[0] !== DIRECTORY_SEPARATOR; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/InstanceofAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/InstanceofAnalyzer.php index 83b04cd9478..5b021871c2a 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/InstanceofAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/InstanceofAnalyzer.php @@ -1,5 +1,7 @@ inside_general_use; $context->inside_general_use = true; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/IssetAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/IssetAnalyzer.php index 6b5d206946d..72acab392e5 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/IssetAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/IssetAnalyzer.php @@ -1,5 +1,7 @@ vars as $isset_var) { if ($isset_var instanceof PhpParser\Node\Expr\PropertyFetch @@ -41,7 +43,7 @@ public static function analyze( public static function analyzeIssetVar( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr $stmt, - Context $context + Context $context, ): void { $context->inside_isset = true; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/MagicConstAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/MagicConstAnalyzer.php index 129266f95d2..453538ac26a 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/MagicConstAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/MagicConstAnalyzer.php @@ -1,5 +1,7 @@ node_data->setType($stmt, Type::getIntRange(1, null)); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/MatchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/MatchAnalyzer.php index a76a199089a..f2676e5fa96 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/MatchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/MatchAnalyzer.php @@ -1,5 +1,7 @@ inside_call; @@ -320,7 +322,7 @@ public static function analyze( private static function convertCondsToConditional( array $conds, PhpParser\Node\Expr $match_condition, - array $attributes + array $attributes, ): PhpParser\Node\Expr { if (count($conds) === 1) { return new VirtualIdentical( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/NullsafeAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/NullsafeAnalyzer.php index 739bb5b7ba2..76aeca5f562 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/NullsafeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/NullsafeAnalyzer.php @@ -1,5 +1,7 @@ var instanceof PhpParser\Node\Expr\Variable) { $was_inside_general_use = $context->inside_general_use; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/PrintAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/PrintAnalyzer.php index 64cebbc80d4..514e1823851 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/PrintAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/PrintAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/SimpleTypeInferer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/SimpleTypeInferer.php index ab144621edb..99b55cb114b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/SimpleTypeInferer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/SimpleTypeInferer.php @@ -1,5 +1,7 @@ items) === 0) { return Type::getEmptyArray(); @@ -601,7 +603,7 @@ private static function handleArrayItem( Aliases $aliases, FileSource $file_source = null, ?array $existing_class_constants = null, - ?string $fq_classlike_name = null + ?string $fq_classlike_name = null, ): bool { if ($item->unpack) { $unpacked_array_type = self::infer( @@ -753,7 +755,7 @@ private static function handleArrayItem( private static function handleUnpackedArray( ArrayCreationInfo $array_creation_info, - Union $unpacked_array_type + Union $unpacked_array_type, ): bool { foreach ($unpacked_array_type->getAtomicTypes() as $unpacked_atomic_type) { if ($unpacked_atomic_type instanceof TList) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php index 7d990eaf1dd..f50b2e7836a 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/UnaryPlusMinusAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/UnaryPlusMinusAnalyzer.php index eb4f256f444..195efc1e080 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/UnaryPlusMinusAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/UnaryPlusMinusAnalyzer.php @@ -1,5 +1,7 @@ expr, $context) === false) { return false; @@ -113,7 +115,7 @@ private static function addDataFlow( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr $stmt, PhpParser\Node\Expr $value, - string $type + string $type, ): void { $result_type = $statements_analyzer->node_data->getType($stmt); if ($statements_analyzer->data_flow_graph instanceof VariableUseGraph && $result_type) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php index d5e6174b230..52b464ea1b7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php @@ -1,5 +1,7 @@ getDocComment(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/YieldFromAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/YieldFromAnalyzer.php index 03f63c637f3..7e460bb05b2 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/YieldFromAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/YieldFromAnalyzer.php @@ -1,5 +1,7 @@ inside_call; diff --git a/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php index 7cdb1b54a05..1c1feac782b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); @@ -577,7 +579,7 @@ private static function dispatchBeforeExpressionAnalysis( private static function dispatchAfterExpressionAnalysis( PhpParser\Node\Expr $expr, Context $context, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): ?bool { $codebase = $statements_analyzer->getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php index 4eb29ca7b62..8d1538fed0b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php @@ -1,5 +1,7 @@ collect_initializations && !$global_context) { IssueBuffer::maybeAdd( diff --git a/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php index 2ea1e981544..20e31b5586d 100644 --- a/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php @@ -1,5 +1,7 @@ getDocComment(); @@ -546,7 +548,7 @@ private static function handleTaints( PhpParser\Node\Stmt\Return_ $stmt, string $cased_method_id, Union $inferred_type, - FunctionLikeStorage $storage + FunctionLikeStorage $storage, ): void { if (!$statements_analyzer->data_flow_graph instanceof TaintFlowGraph || !$stmt->expr @@ -586,7 +588,7 @@ private static function handleTaints( private static function potentiallyInferTypesOnClosureFromParentReturnType( StatementsAnalyzer $statements_analyzer, PhpParser\Node\FunctionLike $expr, - Context $context + Context $context, ): void { // if not returning from inside of a function, return if (!$context->calling_method_id && !$context->calling_function_id) { @@ -651,7 +653,7 @@ private static function potentiallyInferTypesOnClosureFromParentReturnType( private static function inferInnerClosureTypeFromParent( Codebase $codebase, ?Union $return_type, - ?Union $parent_return_type + ?Union $parent_return_type, ): ?Union { if (!$parent_return_type) { return $return_type; diff --git a/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php index eecb5b84284..ba328489097 100644 --- a/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/ThrowAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ThrowAnalyzer.php index c0d1b0b2a45..7e6ff17b531 100644 --- a/src/Psalm/Internal/Analyzer/Statements/ThrowAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/ThrowAnalyzer.php @@ -1,5 +1,7 @@ inside_throw = true; if (ExpressionAnalyzer::analyze($statements_analyzer, $stmt->expr, $context) === false) { diff --git a/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php index b1c12d12cd4..6890c236296 100644 --- a/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php @@ -1,5 +1,7 @@ inside_unset = true; diff --git a/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php b/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php index 188ad00bb3c..e9d113476e9 100644 --- a/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php +++ b/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php @@ -1,5 +1,7 @@ findAssignStmt($stmts, $var_id, $original_location); [$assign_stmt, $assign_exp] = $search_result; @@ -122,7 +124,7 @@ private static function getPartialRemovalBounds( Codebase $codebase, CodeLocation $var_loc, int $end_bound, - bool $assign_ref = false + bool $assign_ref = false, ): FileManipulation { $var_start_loc= $var_loc->raw_file_start; $stmt_content = $codebase->file_provider->getContents( @@ -328,7 +330,7 @@ private function findAssignExp( PhpParser\Node\Expr $current_node, string $var_id, int $var_start_loc, - int $search_level = 1 + int $search_level = 1, ): array { if ($current_node instanceof PhpParser\Node\Expr\Assign || $current_node instanceof PhpParser\Node\Expr\AssignOp diff --git a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php index f1d4044bfc1..bd2223944dc 100644 --- a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php @@ -1,5 +1,7 @@ getCodebase(); @@ -339,7 +341,7 @@ private static function analyzeStatement( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Stmt $stmt, Context $context, - ?Context $global_context + ?Context $global_context, ): ?bool { if (self::dispatchBeforeStatementAnalysis($stmt, $context, $statements_analyzer) === false) { return false; @@ -721,7 +723,7 @@ private static function analyzeStatement( private static function dispatchAfterStatementAnalysis( PhpParser\Node\Stmt $stmt, Context $context, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): ?bool { $codebase = $statements_analyzer->getCodebase(); @@ -747,7 +749,7 @@ private static function dispatchAfterStatementAnalysis( private static function dispatchBeforeStatementAnalysis( PhpParser\Node\Stmt $stmt, Context $context, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): ?bool { $codebase = $statements_analyzer->getCodebase(); @@ -773,7 +775,7 @@ private static function dispatchBeforeStatementAnalysis( private function parseStatementDocblock( PhpParser\Comment\Doc $docblock, PhpParser\Node\Stmt $stmt, - Context $context + Context $context, ): void { $codebase = $this->getCodebase(); @@ -970,7 +972,7 @@ public function getUnusedVarLocations(): array public function registerPossiblyUndefinedVariable( string $undefined_var_id, - PhpParser\Node\Expr\Variable $stmt + PhpParser\Node\Expr\Variable $stmt, ): void { if (!$this->data_flow_graph) { return; diff --git a/src/Psalm/Internal/Analyzer/TraitAnalyzer.php b/src/Psalm/Internal/Analyzer/TraitAnalyzer.php index c6192a666a5..6c8823fdd1b 100644 --- a/src/Psalm/Internal/Analyzer/TraitAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/TraitAnalyzer.php @@ -1,5 +1,7 @@ source = $source; $this->file_analyzer = $source->getFileAnalyzer(); diff --git a/src/Psalm/Internal/Analyzer/TypeAnalyzer.php b/src/Psalm/Internal/Analyzer/TypeAnalyzer.php index 0c871fe2200..24ede558740 100644 --- a/src/Psalm/Internal/Analyzer/TypeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/TypeAnalyzer.php @@ -1,5 +1,7 @@ use_igbinary = $config->use_igbinary; } - /** - * @return array|object|string|null - */ - public function getItem(string $path) + public function getItem(string $path): array|object|string|null { if (!file_exists($path)) { return null; @@ -92,10 +91,7 @@ public function deleteItem(string $path): void } } - /** - * @param array|object|string $item - */ - public function saveItem(string $path, $item): void + public function saveItem(string $path, array|object|string $item): void { if ($this->use_igbinary) { $serialized = igbinary_serialize($item); diff --git a/src/Psalm/Internal/Clause.php b/src/Psalm/Internal/Clause.php index 31f32bea065..62863dbd710 100644 --- a/src/Psalm/Internal/Clause.php +++ b/src/Psalm/Internal/Clause.php @@ -1,5 +1,7 @@ hash = ($wedge ? 'w' : '') . $creating_object_id; diff --git a/src/Psalm/Internal/Cli/LanguageServer.php b/src/Psalm/Internal/Cli/LanguageServer.php index 429144b6808..6b64328af1b 100644 --- a/src/Psalm/Internal/Cli/LanguageServer.php +++ b/src/Psalm/Internal/Cli/LanguageServer.php @@ -1,5 +1,7 @@ use_color = !array_key_exists('m', $options); @@ -813,8 +815,7 @@ private static function initStdoutReportOptions( return $stdout_report_options; } - /** @return never */ - private static function clearGlobalCache(Config $config): void + private static function clearGlobalCache(Config $config): never { $cache_directory = $config->getGlobalCacheDirectory(); @@ -826,8 +827,7 @@ private static function clearGlobalCache(Config $config): void exit; } - /** @return never */ - private static function clearCache(Config $config): void + private static function clearCache(Config $config): never { $cache_directory = $config->getCacheDirectory(); @@ -1009,7 +1009,7 @@ private static function initConfig( ?string $path_to_config, string $output_format, bool $run_taint_analysis, - array $options + array $options, ): array { $init_source_dir = null; if (isset($options['i'])) { @@ -1042,7 +1042,7 @@ private static function initBaseline( array $options, Config $config, string $current_dir, - ?string $path_to_config + ?string $path_to_config, ): array { $issue_baseline = []; @@ -1098,7 +1098,7 @@ private static function storeFlowGraph(array $options, ProjectAnalyzer $project_ } /** @return false|'always'|'auto' */ - private static function shouldFindUnusedCode(array $options, Config $config) + private static function shouldFindUnusedCode(array $options, Config $config): false|string { $find_unused_code = false; if (isset($options['find-dead-code'])) { @@ -1126,17 +1126,16 @@ private static function shouldRunTaintAnalysis(array $options): bool } /** - * @param string|bool|null $find_references_to * @param false|'always'|'auto' $find_unused_code */ private static function configureProjectAnalyzer( array $options, Config $config, ProjectAnalyzer $project_analyzer, - $find_references_to, - $find_unused_code, + string|bool|null $find_references_to, + false|string $find_unused_code, bool $find_unused_variables, - bool $run_taint_analysis + bool $run_taint_analysis, ): void { if (isset($options['generate-json-map']) && is_string($options['generate-json-map'])) { $project_analyzer->getCodebase()->store_node_types = true; @@ -1222,7 +1221,7 @@ private static function configureShepherd(Config $config, array $options, array private static function generateStubs( array $options, Providers $providers, - ProjectAnalyzer $project_analyzer + ProjectAnalyzer $project_analyzer, ): void { if (isset($options['generate-stubs']) && is_string($options['generate-stubs'])) { $stubs_location = $options['generate-stubs']; diff --git a/src/Psalm/Internal/Cli/Psalter.php b/src/Psalm/Internal/Cli/Psalter.php index 9dd8eaf47d0..35ac7bada23 100644 --- a/src/Psalm/Internal/Cli/Psalter.php +++ b/src/Psalm/Internal/Cli/Psalter.php @@ -1,5 +1,7 @@ |null */ - public static function getPathsToCheck($f_paths): ?array + public static function getPathsToCheck(string|array|false|null $f_paths): ?array { $paths_to_check = []; @@ -337,7 +338,7 @@ public static function initializeConfig( string $current_dir, string $output_format, ?ClassLoader $first_autoloader, - bool $create_if_non_existent = false + bool $create_if_non_existent = false, ): Config { try { if ($path_to_config) { diff --git a/src/Psalm/Internal/Codebase/Analyzer.php b/src/Psalm/Internal/Codebase/Analyzer.php index ba0209ea6f2..8ffc358a558 100644 --- a/src/Psalm/Internal/Codebase/Analyzer.php +++ b/src/Psalm/Internal/Codebase/Analyzer.php @@ -1,5 +1,7 @@ config = $config; $this->file_provider = $file_provider; @@ -233,7 +235,7 @@ public function canReportIssues(string $file_path): bool private function getFileAnalyzer( ProjectAnalyzer $project_analyzer, string $file_path, - array $filetype_analyzers + array $filetype_analyzers, ): FileAnalyzer { $extension = pathinfo($file_path, PATHINFO_EXTENSION); @@ -254,7 +256,7 @@ public function analyzeFiles( ProjectAnalyzer $project_analyzer, int $pool_size, bool $alter_code, - bool $consolidate_analyzed_data = false + bool $consolidate_analyzed_data = false, ): void { $this->loadCachedResults($project_analyzer); @@ -1188,7 +1190,7 @@ public function addNodeType( string $file_path, PhpParser\Node $node, string $node_type, - PhpParser\Node $parent_node = null + PhpParser\Node $parent_node = null, ): void { if ($node_type === '') { throw new UnexpectedValueException('non-empty node_type expected'); @@ -1205,7 +1207,7 @@ public function addNodeArgument( int $start_position, int $end_position, string $reference, - int $argument_number + int $argument_number, ): void { if ($reference === '') { throw new UnexpectedValueException('non-empty reference expected'); diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 696b0413ae1..389ccef411b 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -1,5 +1,7 @@ config = $config; $this->classlike_storage_provider = $storage_provider; @@ -325,7 +327,7 @@ public function hasFullyQualifiedClassName( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); @@ -392,7 +394,7 @@ public function hasFullyQualifiedInterfaceName( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); @@ -459,7 +461,7 @@ public function hasFullyQualifiedEnumName( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); @@ -549,7 +551,7 @@ public function classOrInterfaceExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { return $this->classExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id) || $this->interfaceExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id); @@ -562,7 +564,7 @@ public function classOrInterfaceOrEnumExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { return $this->classExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id) || $this->interfaceExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id) @@ -576,7 +578,7 @@ public function classExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { if (isset(ClassLikeAnalyzer::SPECIAL_TYPES[$fq_class_name])) { return false; @@ -673,7 +675,7 @@ public function interfaceExists( string $fq_interface_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { if (isset(ClassLikeAnalyzer::SPECIAL_TYPES[strtolower($fq_interface_name)])) { return false; @@ -691,7 +693,7 @@ public function enumExists( string $fq_enum_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { if (isset(ClassLikeAnalyzer::SPECIAL_TYPES[strtolower($fq_enum_name)])) { return false; @@ -915,7 +917,7 @@ public function consolidateAnalyzedData(Methods $methods, ?Progress $progress, b public static function makeImmutable( PhpParser\Node\Stmt\Class_ $class_stmt, ProjectAnalyzer $project_analyzer, - string $file_path + string $file_path, ): void { $manipulator = ClassDocblockManipulator::getForClass( $project_analyzer, @@ -1191,7 +1193,7 @@ public function handleClassLikeReferenceInMigration( string $fq_class_name, ?string $calling_method_id, bool $force_change = false, - bool $was_self = false + bool $was_self = false, ): bool { if ($class_name_node instanceof VirtualNode) { return false; @@ -1373,7 +1375,7 @@ public function handleDocblockTypeInMigration( StatementsSource $source, Union $type, CodeLocation $type_location, - ?string $calling_method_id + ?string $calling_method_id, ): void { $calling_fq_class_name = $source->getFQCLN(); $fq_class_name_lc = strtolower($calling_fq_class_name ?? ''); @@ -1503,7 +1505,7 @@ public function airliftClassLikeReference( int $source_start, int $source_end, bool $add_class_constant = false, - bool $allow_self = false + bool $allow_self = false, ): void { $project_analyzer = ProjectAnalyzer::getInstance(); $codebase = $project_analyzer->getCodebase(); @@ -1539,7 +1541,7 @@ public function airliftClassDefinedDocblockType( string $destination_fq_class_name, string $source_file_path, int $source_start, - int $source_end + int $source_end, ): void { $project_analyzer = ProjectAnalyzer::getInstance(); $codebase = $project_analyzer->getCodebase(); @@ -1613,7 +1615,7 @@ public function getClassConstantType( ?StatementsAnalyzer $statements_analyzer = null, array $visited_constant_ids = [], bool $late_static_binding = false, - bool $in_value_of_context = false + bool $in_value_of_context = false, ): ?Union { $class_name = strtolower($class_name); @@ -2375,7 +2377,7 @@ private function getConstantType( int $visibility, ?StatementsAnalyzer $statements_analyzer, array $visited_constant_ids, - bool $late_static_binding + bool $late_static_binding, ): ?Union { $constant_resolver = new StorageByPatternResolver(); $resolved_constants = $constant_resolver->resolveConstants( @@ -2437,7 +2439,7 @@ private function getConstantType( private function getEnumType( ClassLikeStorage $class_like_storage, - string $constant_name + string $constant_name, ): ?Union { $constant_resolver = new StorageByPatternResolver(); $resolved_enums = $constant_resolver->resolveEnums( @@ -2459,7 +2461,7 @@ private function getEnumType( private function filterConstantNameByVisibility( ClassConstantStorage $constant_storage, - int $visibility + int $visibility, ): bool { if ($visibility === ReflectionProperty::IS_PUBLIC diff --git a/src/Psalm/Internal/Codebase/ConstantTypeResolver.php b/src/Psalm/Internal/Codebase/ConstantTypeResolver.php index 9bf8cabab2c..a07a2173ac0 100644 --- a/src/Psalm/Internal/Codebase/ConstantTypeResolver.php +++ b/src/Psalm/Internal/Codebase/ConstantTypeResolver.php @@ -1,5 +1,7 @@ id; $to_id = $to->id; @@ -63,7 +65,7 @@ public function addPath( protected static function shouldIgnoreFetch( string $path_type, string $expression_type, - array $previous_path_types + array $previous_path_types, ): bool { $el = strlen($expression_type); diff --git a/src/Psalm/Internal/Codebase/Functions.php b/src/Psalm/Internal/Codebase/Functions.php index 50e3f60fba5..8cd03ce7554 100644 --- a/src/Psalm/Internal/Codebase/Functions.php +++ b/src/Psalm/Internal/Codebase/Functions.php @@ -1,5 +1,7 @@ existence_provider->has($function_id)) { $function_exists = $this->existence_provider->doesFunctionExist($statements_analyzer, $function_id); @@ -278,7 +280,7 @@ public function getMatchingFunctionNames( string $stub, int $offset, string $file_path, - Codebase $codebase + Codebase $codebase, ): array { if ($stub[0] === '*') { $stub = substr($stub, 1); @@ -403,7 +405,7 @@ public function isCallMapFunctionPure( ?NodeTypeProvider $type_provider, string $function_id, ?array $args, - bool &$must_use = true + bool &$must_use = true, ): bool { $impure_functions = [ // file io diff --git a/src/Psalm/Internal/Codebase/InternalCallMapHandler.php b/src/Psalm/Internal/Codebase/InternalCallMapHandler.php index 71ce092eae9..85eedb0c3e7 100644 --- a/src/Psalm/Internal/Codebase/InternalCallMapHandler.php +++ b/src/Psalm/Internal/Codebase/InternalCallMapHandler.php @@ -1,5 +1,7 @@ classlike_storage_provider = $storage_provider; $this->file_reference_provider = $file_reference_provider; @@ -99,7 +101,7 @@ public function methodExists( ?StatementsSource $source = null, ?string $source_file_path = null, bool $use_method_existence_provider = true, - bool $is_used = false + bool $is_used = false, ): bool { $fq_class_name = $method_id->fq_class_name; $method_name = $method_id->method_name; @@ -346,7 +348,7 @@ public function getMethodParams( MethodIdentifier $method_id, ?StatementsSource $source = null, ?array $args = null, - ?Context $context = null + ?Context $context = null, ): array { $fq_class_name = $method_id->fq_class_name; $method_name = $method_id->method_name; @@ -492,7 +494,7 @@ public static function localizeType( Codebase $codebase, Union $type, string $appearing_fq_class_name, - string $base_fq_class_name + string $base_fq_class_name, ): Union { $class_storage = $codebase->classlike_storage_provider->get($appearing_fq_class_name); $extends = $class_storage->template_extended_params; @@ -515,7 +517,7 @@ public static function localizeType( */ public static function getExtendedTemplatedTypes( TTemplateParam $atomic_type, - array $extends + array $extends, ): array { $extra_added_types = []; @@ -557,7 +559,7 @@ public function getMethodReturnType( MethodIdentifier $method_id, ?string &$self_class, ?SourceAnalyzer $source_analyzer = null, - ?array $args = null + ?array $args = null, ): ?Union { $original_fq_class_name = $method_id->fq_class_name; $original_method_name = $method_id->method_name; @@ -926,7 +928,7 @@ public function getMethodReturnsByRef(MethodIdentifier $method_id): bool public function getMethodReturnTypeLocation( MethodIdentifier $method_id, - CodeLocation &$defined_location = null + CodeLocation &$defined_location = null, ): ?CodeLocation { $method_id = $this->getDeclaringMethodId($method_id); @@ -966,7 +968,7 @@ public function setDeclaringMethodId( string $fq_class_name, string $method_name_lc, string $declaring_fq_class_name, - string $declaring_method_name_lc + string $declaring_method_name_lc, ): void { $class_storage = $this->classlike_storage_provider->get($fq_class_name); @@ -984,7 +986,7 @@ public function setAppearingMethodId( string $fq_class_name, string $method_name_lc, string $appearing_fq_class_name, - string $appearing_method_name_lc + string $appearing_method_name_lc, ): void { $class_storage = $this->classlike_storage_provider->get($fq_class_name); @@ -996,7 +998,7 @@ public function setAppearingMethodId( /** @psalm-mutation-free */ public function getDeclaringMethodId( - MethodIdentifier $method_id + MethodIdentifier $method_id, ): ?MethodIdentifier { $fq_class_name = $this->classlikes->getUnAliasedName($method_id->fq_class_name); @@ -1019,7 +1021,7 @@ public function getDeclaringMethodId( * Get the class this method appears in (vs is declared in, which could give a trait */ public function getAppearingMethodId( - MethodIdentifier $method_id + MethodIdentifier $method_id, ): ?MethodIdentifier { $fq_class_name = $this->classlikes->getUnAliasedName($method_id->fq_class_name); diff --git a/src/Psalm/Internal/Codebase/Populator.php b/src/Psalm/Internal/Codebase/Populator.php index 022cc684e46..7771c2ac3ae 100644 --- a/src/Psalm/Internal/Codebase/Populator.php +++ b/src/Psalm/Internal/Codebase/Populator.php @@ -1,5 +1,7 @@ classlike_storage_provider = $classlike_storage_provider; $this->file_storage_provider = $file_storage_provider; @@ -273,7 +275,7 @@ private function populateClassLikeStorage(ClassLikeStorage $storage, array $depe private function populateOverriddenMethods( ClassLikeStorage $storage, - ClassLikeStorageProvider $storage_provider + ClassLikeStorageProvider $storage_provider, ): void { $interface_method_implementers = []; foreach ($storage->class_implements as $interface) { @@ -426,7 +428,7 @@ private function populateDataFromTrait( ClassLikeStorage $storage, ClassLikeStorageProvider $storage_provider, array $dependent_classlikes, - string $used_trait_lc + string $used_trait_lc, ): void { try { $used_trait_lc = strtolower( @@ -456,7 +458,7 @@ private function populateDataFromTrait( private static function extendType( Union $type, - ClassLikeStorage $storage + ClassLikeStorage $storage, ): Union { $extended_types = []; @@ -489,7 +491,7 @@ private function populateDataFromParentClass( ClassLikeStorage $storage, ClassLikeStorageProvider $storage_provider, array $dependent_classlikes, - string $parent_storage_class + string $parent_storage_class, ): void { $parent_storage_class = strtolower( $this->classlikes->getUnAliasedName( @@ -568,7 +570,7 @@ private function populateInterfaceData( ClassLikeStorage $storage, ClassLikeStorage $interface_storage, ClassLikeStorageProvider $storage_provider, - array $dependent_classlikes + array $dependent_classlikes, ): void { $this->populateClassLikeStorage($interface_storage, $dependent_classlikes); @@ -610,7 +612,7 @@ private function populateInterfaceData( private static function extendTemplateParams( ClassLikeStorage $storage, ClassLikeStorage $parent_storage, - bool $from_direct_parent + bool $from_direct_parent, ): void { if ($parent_storage->yield && !$storage->yield) { $storage->yield = $parent_storage->yield; @@ -670,7 +672,7 @@ private function populateInterfaceDataFromParentInterface( ClassLikeStorage $storage, ClassLikeStorageProvider $storage_provider, array $dependent_classlikes, - string $parent_interface_lc + string $parent_interface_lc, ): void { try { $parent_interface_lc = strtolower( @@ -716,7 +718,7 @@ private function populateDataFromImplementedInterface( ClassLikeStorage $storage, ClassLikeStorageProvider $storage_provider, array $dependent_classlikes, - string $implemented_interface_lc + string $implemented_interface_lc, ): void { try { $implemented_interface_lc = strtolower( @@ -879,7 +881,7 @@ private function populateFileStorage(FileStorage $storage, array $dependent_file private function inheritConstantsFromTrait( ClassLikeStorage $storage, - ClassLikeStorage $trait_storage + ClassLikeStorage $trait_storage, ): void { if (!$trait_storage->is_trait) { throw new Exception('Class like storage is not for a trait.'); @@ -915,7 +917,7 @@ private function inheritConstantsFromTrait( protected function inheritMethodsFromParent( ClassLikeStorage $storage, - ClassLikeStorage $parent_storage + ClassLikeStorage $parent_storage, ): void { $fq_class_name = $storage->name; $fq_class_name_lc = strtolower($fq_class_name); @@ -1030,7 +1032,7 @@ protected function inheritMethodsFromParent( private function inheritPropertiesFromParent( ClassLikeStorage $storage, - ClassLikeStorage $parent_storage + ClassLikeStorage $parent_storage, ): void { if ($parent_storage->sealed_properties !== null) { $storage->sealed_properties = $parent_storage->sealed_properties; diff --git a/src/Psalm/Internal/Codebase/Properties.php b/src/Psalm/Internal/Codebase/Properties.php index ac7c8add999..fe9957349a8 100644 --- a/src/Psalm/Internal/Codebase/Properties.php +++ b/src/Psalm/Internal/Codebase/Properties.php @@ -1,5 +1,7 @@ classlike_storage_provider = $storage_provider; $this->file_reference_provider = $file_reference_provider; @@ -61,7 +63,7 @@ public function propertyExists( bool $read_mode, ?StatementsSource $source = null, ?Context $context = null, - ?CodeLocation $code_location = null + ?CodeLocation $code_location = null, ): bool { // remove leading backslash if it exists $property_id = ltrim($property_id, '\\'); @@ -168,7 +170,7 @@ public function propertyExists( public function getDeclaringClassForProperty( string $property_id, bool $read_mode, - ?StatementsSource $source = null + ?StatementsSource $source = null, ): ?string { [$fq_class_name, $property_name] = explode('::$', $property_id); @@ -199,7 +201,7 @@ public function getDeclaringClassForProperty( public function getAppearingClassForProperty( string $property_id, bool $read_mode, - ?StatementsSource $source = null + ?StatementsSource $source = null, ): ?string { [$fq_class_name, $property_name] = explode('::$', $property_id); @@ -269,7 +271,7 @@ public function getPropertyType( string $property_id, bool $property_set, ?StatementsSource $source = null, - ?Context $context = null + ?Context $context = null, ): ?Union { // remove leading backslash if it exists $property_id = ltrim($property_id, '\\'); diff --git a/src/Psalm/Internal/Codebase/PropertyMap.php b/src/Psalm/Internal/Codebase/PropertyMap.php index d66c58c4579..2c76790ae4c 100644 --- a/src/Psalm/Internal/Codebase/PropertyMap.php +++ b/src/Psalm/Internal/Codebase/PropertyMap.php @@ -1,5 +1,7 @@ storage_provider->get($parent_class); $storage = $this->storage_provider->get($fq_class_name); @@ -472,7 +474,7 @@ private function registerInheritedMethods( */ private function registerInheritedProperties( string $fq_class_name, - string $parent_class + string $parent_class, ): void { $parent_storage = $this->storage_provider->get($parent_class); $storage = $this->storage_provider->get($fq_class_name); diff --git a/src/Psalm/Internal/Codebase/Scanner.php b/src/Psalm/Internal/Codebase/Scanner.php index ab2c586ef72..d638ee07ac4 100644 --- a/src/Psalm/Internal/Codebase/Scanner.php +++ b/src/Psalm/Internal/Codebase/Scanner.php @@ -1,5 +1,7 @@ codebase = $codebase; $this->reflection = $reflection; @@ -226,7 +228,7 @@ public function queueClassLikeForScanning( string $fq_classlike_name, bool $analyze_too = false, bool $store_failure = true, - array $phantom_classes = [] + array $phantom_classes = [], ): void { if ($fq_classlike_name[0] === '\\') { $fq_classlike_name = substr($fq_classlike_name, 1); @@ -524,7 +526,7 @@ private function convertClassesToFilePaths(ClassLikes $classlikes): void private function scanFile( string $file_path, array $filetype_scanners, - bool $will_analyze = false + bool $will_analyze = false, ): void { $file_scanner = $this->getScannerForPath($file_path, $filetype_scanners, $will_analyze); @@ -618,7 +620,7 @@ private function scanFile( private function getScannerForPath( string $file_path, array $filetype_scanners, - bool $will_analyze = false + bool $will_analyze = false, ): FileScanner { $path_parts = explode(DIRECTORY_SEPARATOR, $file_path); $file_name_parts = explode('.', array_pop($path_parts)); diff --git a/src/Psalm/Internal/Codebase/StorageByPatternResolver.php b/src/Psalm/Internal/Codebase/StorageByPatternResolver.php index ed5baed6dba..f075fd81895 100644 --- a/src/Psalm/Internal/Codebase/StorageByPatternResolver.php +++ b/src/Psalm/Internal/Codebase/StorageByPatternResolver.php @@ -26,7 +26,7 @@ final class StorageByPatternResolver */ public function resolveConstants( ClassLikeStorage $class_like_storage, - string $pattern + string $pattern, ): array { $constants = $class_like_storage->constants; @@ -59,7 +59,7 @@ public function resolveConstants( */ public function resolveEnums( ClassLikeStorage $class_like_storage, - string $pattern + string $pattern, ): array { $enum_cases = $class_like_storage->enum_cases; if (strpos($pattern, '*') === false) { diff --git a/src/Psalm/Internal/Codebase/TaintFlowGraph.php b/src/Psalm/Internal/Codebase/TaintFlowGraph.php index b18b82eb161..52828b47d44 100644 --- a/src/Psalm/Internal/Codebase/TaintFlowGraph.php +++ b/src/Psalm/Internal/Codebase/TaintFlowGraph.php @@ -1,5 +1,7 @@ id; $to_id = $to->id; @@ -146,7 +148,7 @@ public function getOriginLocations(DataFlowNode $assignment_node): array */ private function getChildNodes( DataFlowNode $generated_source, - array $visited_source_ids + array $visited_source_ids, ): ?array { $new_child_nodes = []; @@ -202,7 +204,7 @@ private function getChildNodes( */ private function getParentNodes( DataFlowNode $destination, - array $visited_source_ids + array $visited_source_ids, ): array { $new_parent_nodes = []; diff --git a/src/Psalm/Internal/Composer.php b/src/Psalm/Internal/Composer.php index 52ac9350ac3..5810e643907 100644 --- a/src/Psalm/Internal/Composer.php +++ b/src/Psalm/Internal/Composer.php @@ -1,5 +1,7 @@ id = $id; @@ -67,7 +69,7 @@ final public static function getForMethodArgument( string $cased_method_id, int $argument_offset, ?CodeLocation $arg_location, - ?CodeLocation $code_location = null + ?CodeLocation $code_location = null, ): self { $arg_id = strtolower($method_id) . '#' . ($argument_offset + 1); @@ -93,7 +95,7 @@ final public static function getForMethodArgument( final public static function getForAssignment( string $var_id, CodeLocation $assignment_location, - ?string $specialization_key = null + ?string $specialization_key = null, ): self { $id = $var_id . '-' . $assignment_location->file_name @@ -110,7 +112,7 @@ final public static function getForMethodReturn( string $method_id, string $cased_method_id, ?CodeLocation $code_location, - ?CodeLocation $function_location = null + ?CodeLocation $function_location = null, ): self { $specialization_key = null; diff --git a/src/Psalm/Internal/DataFlow/Path.php b/src/Psalm/Internal/DataFlow/Path.php index a6de16c95ee..5286461f1f5 100644 --- a/src/Psalm/Internal/DataFlow/Path.php +++ b/src/Psalm/Internal/DataFlow/Path.php @@ -1,5 +1,7 @@ type = $type; $this->length = $length; diff --git a/src/Psalm/Internal/DataFlow/TaintSink.php b/src/Psalm/Internal/DataFlow/TaintSink.php index 2d89b628d3c..011aa51f95d 100644 --- a/src/Psalm/Internal/DataFlow/TaintSink.php +++ b/src/Psalm/Internal/DataFlow/TaintSink.php @@ -1,5 +1,7 @@ type = $type; $this->old = $old; diff --git a/src/Psalm/Internal/Diff/FileDiffer.php b/src/Psalm/Internal/Diff/FileDiffer.php index 668c6456bc5..c0068b6fedd 100644 --- a/src/Psalm/Internal/Diff/FileDiffer.php +++ b/src/Psalm/Internal/Diff/FileDiffer.php @@ -33,7 +33,7 @@ class FileDiffer */ private static function calculateTrace( array $a, - array $b + array $b, ): array { $n = count($a); $m = count($b); diff --git a/src/Psalm/Internal/Diff/FileStatementsDiffer.php b/src/Psalm/Internal/Diff/FileStatementsDiffer.php index 797b6f73012..175520640db 100644 --- a/src/Psalm/Internal/Diff/FileStatementsDiffer.php +++ b/src/Psalm/Internal/Diff/FileStatementsDiffer.php @@ -1,5 +1,7 @@ getLine()])) { return self::$manipulators[$file_path][$stmt->getLine()]; @@ -53,7 +55,7 @@ public static function getForClass( private function __construct( ProjectAnalyzer $project_analyzer, Class_ $stmt, - string $file_path + string $file_path, ) { $this->stmt = $stmt; $docblock = $stmt->getDocComment(); diff --git a/src/Psalm/Internal/FileManipulation/CodeMigration.php b/src/Psalm/Internal/FileManipulation/CodeMigration.php index 641e6aaf5d1..8ccd62a8ea3 100644 --- a/src/Psalm/Internal/FileManipulation/CodeMigration.php +++ b/src/Psalm/Internal/FileManipulation/CodeMigration.php @@ -1,5 +1,7 @@ source_file_path = $source_file_path; $this->source_start = $source_start; diff --git a/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php b/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php index 7bd147c06ec..c879a71cd81 100644 --- a/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php +++ b/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php @@ -1,5 +1,7 @@ getSnippetBounds(); diff --git a/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php b/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php index b04952c0581..b1b4c43d8de 100644 --- a/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php +++ b/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php @@ -1,5 +1,7 @@ getLine()])) { return self::$manipulators[$file_path][$stmt->getLine()]; @@ -273,7 +274,7 @@ public function setReturnType( string $new_type, string $phpdoc_type, bool $is_php_compatible, - ?string $description + ?string $description, ): void { $new_type = str_replace(['', ''], '', $new_type); @@ -291,7 +292,7 @@ public function setParamType( string $param_name, ?string $php_type, string $new_type, - string $phpdoc_type + string $phpdoc_type, ): void { $new_type = str_replace(['', '', ''], '', $new_type); diff --git a/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php b/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php index 3894e4edf81..cfb3d178052 100644 --- a/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php +++ b/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php @@ -1,5 +1,7 @@ getLine()])) { return self::$manipulators[$file_path][$stmt->getLine()]; @@ -74,7 +76,7 @@ public static function getForProperty( private function __construct( ProjectAnalyzer $project_analyzer, Property $stmt, - string $file_path + string $file_path, ) { $this->stmt = $stmt; $docblock = $stmt->getDocComment(); @@ -139,7 +141,7 @@ public function setType( string $new_type, string $phpdoc_type, bool $is_php_compatible, - ?string $description = null + ?string $description = null, ): void { $new_type = str_replace(['', '', ''], '', $new_type); diff --git a/src/Psalm/Internal/Fork/ForkMessage.php b/src/Psalm/Internal/Fork/ForkMessage.php index bd1e1460a78..5672c7a6554 100644 --- a/src/Psalm/Internal/Fork/ForkMessage.php +++ b/src/Psalm/Internal/Fork/ForkMessage.php @@ -1,5 +1,7 @@ data = $data; } diff --git a/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php b/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php index 6bf9acb2c12..df199983cc9 100644 --- a/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php +++ b/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php @@ -1,5 +1,7 @@ data = $data; } diff --git a/src/Psalm/Internal/Fork/Pool.php b/src/Psalm/Internal/Fork/Pool.php index 09e525dde6d..9321cfeb553 100644 --- a/src/Psalm/Internal/Fork/Pool.php +++ b/src/Psalm/Internal/Fork/Pool.php @@ -1,5 +1,7 @@ task_done_closure = $task_done_closure; diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index 27840944143..a8f69eab51e 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -1,5 +1,7 @@ hideWarnings = $hideWarnings; $this->provideCompletion = $provideCompletion; diff --git a/src/Psalm/Internal/LanguageServer/ClientHandler.php b/src/Psalm/Internal/LanguageServer/ClientHandler.php index d935bef2358..6eceb6c0e27 100644 --- a/src/Psalm/Internal/LanguageServer/ClientHandler.php +++ b/src/Psalm/Internal/LanguageServer/ClientHandler.php @@ -35,7 +35,7 @@ public function __construct(ProtocolReader $protocolReader, ProtocolWriter $prot * @param array|object $params The method parameters * @return mixed Resolved with the result of the request or rejected with an error */ - public function request(string $method, $params) + public function request(string $method, array|object $params): mixed { $id = $this->idGenerator->generate(); @@ -77,7 +77,7 @@ function (Message $msg) use ($id, $deferred, &$listener): void { * @param string $method The method to call * @param array|object $params The method parameters */ - public function notify(string $method, $params): void + public function notify(string $method, array|object $params): void { $this->protocolWriter->write( new Message( diff --git a/src/Psalm/Internal/LanguageServer/EmitterInterface.php b/src/Psalm/Internal/LanguageServer/EmitterInterface.php index e331456fd11..35d66388a1b 100644 --- a/src/Psalm/Internal/LanguageServer/EmitterInterface.php +++ b/src/Psalm/Internal/LanguageServer/EmitterInterface.php @@ -47,7 +47,7 @@ public function on(string $eventName, callable $callBack, int $priority = 100): public function emit( string $eventName, array $arguments = [], - ?callable $continueCallBack = null + ?callable $continueCallBack = null, ): void; /** diff --git a/src/Psalm/Internal/LanguageServer/EmitterTrait.php b/src/Psalm/Internal/LanguageServer/EmitterTrait.php index c20ebe3b812..03f06a5b3d1 100644 --- a/src/Psalm/Internal/LanguageServer/EmitterTrait.php +++ b/src/Psalm/Internal/LanguageServer/EmitterTrait.php @@ -77,7 +77,7 @@ public function on(string $eventName, callable $callBack, int $priority = 100): public function emit( string $eventName, array $arguments = [], - ?callable $continueCallBack = null + ?callable $continueCallBack = null, ): void { if ($continueCallBack === null) { foreach ($this->listeners($eventName) as $listener) { diff --git a/src/Psalm/Internal/LanguageServer/LanguageClient.php b/src/Psalm/Internal/LanguageServer/LanguageClient.php index c3f5d60b2f4..306eda59ab5 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageClient.php +++ b/src/Psalm/Internal/LanguageServer/LanguageClient.php @@ -10,6 +10,7 @@ use Psalm\Internal\LanguageServer\Client\TextDocument as ClientTextDocument; use Psalm\Internal\LanguageServer\Client\Workspace as ClientWorkspace; use Revolt\EventLoop; +use Throwable; use function is_null; use function json_decode; @@ -49,7 +50,7 @@ public function __construct( ProtocolReader $reader, ProtocolWriter $writer, LanguageServer $server, - ClientConfiguration $clientConfiguration + ClientConfiguration $clientConfiguration, ) { $this->handler = new ClientHandler($reader, $writer); $this->server = $server; @@ -66,12 +67,12 @@ public function refreshConfiguration(): void { $capabilities = $this->server->clientCapabilities; if ($capabilities->workspace->configuration ?? false) { - EventLoop::queue(function () { + EventLoop::queue(function (): void { try { /** @var object $config */ [$config] = $this->workspace->requestConfiguration('psalm'); $this->configurationRefreshed((array) $config); - } catch (\Throwable) { + } catch (Throwable) { $this->server->logError('There was an error getting configuration'); } }); diff --git a/src/Psalm/Internal/LanguageServer/LanguageServer.php b/src/Psalm/Internal/LanguageServer/LanguageServer.php index 3d100cbf2eb..85110572ec8 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageServer.php +++ b/src/Psalm/Internal/LanguageServer/LanguageServer.php @@ -143,7 +143,7 @@ public function __construct( ProjectAnalyzer $project_analyzer, Codebase $codebase, ClientConfiguration $clientConfiguration, - Progress $progress + Progress $progress, ) { parent::__construct($this, '/'); @@ -232,7 +232,7 @@ public static function run( Config $config, ClientConfiguration $clientConfiguration, string $base_dir, - bool $inMemory = false + bool $inMemory = false, ): void { $progress = new Progress(); @@ -357,7 +357,6 @@ public static function run( * in. This must not necessarily be the locale of the operating * system. * @param string|null $rootPath The rootPath of the workspace. Is null if no folder is open. - * @param mixed $initializationOptions * @param string|null $trace The initial trace setting. If omitted trace is disabled ('off'). * @psalm-suppress PossiblyUnusedParam */ @@ -368,8 +367,8 @@ public function initialize( ?string $locale = null, ?string $rootPath = null, ?string $rootUri = null, - $initializationOptions = null, - ?string $trace = null + mixed $initializationOptions = null, + ?string $trace = null, //?array $workspaceFolders = null //error in json-dispatcher ): InitializeResult { $this->clientInfo = $clientInfo; diff --git a/src/Psalm/Internal/LanguageServer/PHPMarkdownContent.php b/src/Psalm/Internal/LanguageServer/PHPMarkdownContent.php index 3290ea5cd4c..60a749a6196 100644 --- a/src/Psalm/Internal/LanguageServer/PHPMarkdownContent.php +++ b/src/Psalm/Internal/LanguageServer/PHPMarkdownContent.php @@ -38,18 +38,16 @@ public function __construct(string $code, ?string $title = null, ?string $descri } parent::__construct( MarkupKind::MARKDOWN, - "$markdown```php\nloadFromCache($fq_classlike_name_lc); diff --git a/src/Psalm/Internal/LanguageServer/Provider/FileReferenceCacheProvider.php b/src/Psalm/Internal/LanguageServer/Provider/FileReferenceCacheProvider.php index ca12912ec0a..0df860fe5b3 100644 --- a/src/Psalm/Internal/LanguageServer/Provider/FileReferenceCacheProvider.php +++ b/src/Psalm/Internal/LanguageServer/Provider/FileReferenceCacheProvider.php @@ -1,5 +1,7 @@ statements_cache[$file_path]) && $this->statements_cache_time[$file_path] >= $file_modified_time @@ -70,7 +72,7 @@ public function saveStatementsToCache( string $file_path, string $file_content_hash, array $stmts, - bool $touch_only + bool $touch_only, ): void { $this->statements_cache[$file_path] = $stmts; $this->statements_cache_time[$file_path] = microtime(true); diff --git a/src/Psalm/Internal/LanguageServer/Provider/ProjectCacheProvider.php b/src/Psalm/Internal/LanguageServer/Provider/ProjectCacheProvider.php index ed210fa0ae2..5f0a1749bbe 100644 --- a/src/Psalm/Internal/LanguageServer/Provider/ProjectCacheProvider.php +++ b/src/Psalm/Internal/LanguageServer/Provider/ProjectCacheProvider.php @@ -1,5 +1,7 @@ server = $server; $this->codebase = $codebase; diff --git a/src/Psalm/Internal/LanguageServer/Server/Workspace.php b/src/Psalm/Internal/LanguageServer/Server/Workspace.php index 0efaddd2bc6..641b32090f1 100644 --- a/src/Psalm/Internal/LanguageServer/Server/Workspace.php +++ b/src/Psalm/Internal/LanguageServer/Server/Workspace.php @@ -34,7 +34,7 @@ class Workspace public function __construct( LanguageServer $server, Codebase $codebase, - ProjectAnalyzer $project_analyzer + ProjectAnalyzer $project_analyzer, ) { $this->server = $server; $this->codebase = $codebase; @@ -106,10 +106,9 @@ public function didChangeWatchedFiles(array $changes): void /** * A notification sent from the client to the server to signal the change of configuration settings. * - * @param mixed $settings * @psalm-suppress PossiblyUnusedMethod, PossiblyUnusedParam */ - public function didChangeConfiguration($settings): void + public function didChangeConfiguration(mixed $settings): void { $this->server->logDebug( 'workspace/didChangeConfiguration', @@ -121,10 +120,9 @@ public function didChangeConfiguration($settings): void * The workspace/executeCommand request is sent from the client to the server to * trigger command execution on the server. * - * @param mixed $arguments * @psalm-suppress PossiblyUnusedMethod */ - public function executeCommand(string $command, $arguments): void + public function executeCommand(string $command, mixed $arguments): void { $this->server->logDebug( 'workspace/executeCommand', diff --git a/src/Psalm/Internal/MethodIdentifier.php b/src/Psalm/Internal/MethodIdentifier.php index ad519202430..105c68b616c 100644 --- a/src/Psalm/Internal/MethodIdentifier.php +++ b/src/Psalm/Internal/MethodIdentifier.php @@ -1,5 +1,7 @@ parser = $parser; $this->error_handler = $error_handler; @@ -64,10 +66,7 @@ public function __construct( $this->non_method_changes = count($offset_map); } - /** - * @return null|int|PhpParser\Node - */ - public function enterNode(PhpParser\Node $node, bool &$traverseChildren = true) + public function enterNode(PhpParser\Node $node, bool &$traverseChildren = true): int|PhpParser\Node|null { /** @var array{startFilePos: int, endFilePos: int, startLine: int} */ $attrs = $node->getAttributes(); diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/AttributeResolver.php b/src/Psalm/Internal/PhpVisitor/Reflector/AttributeResolver.php index 339d86229d0..27f0efcf6bd 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/AttributeResolver.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/AttributeResolver.php @@ -1,5 +1,7 @@ name instanceof PhpParser\Node\Name\FullyQualified) { $fq_type_string = (string)$stmt->name; diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php index 2f1c5467b93..2ac3f84868b 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php @@ -1,5 +1,7 @@ getCodebase(); @@ -525,7 +527,7 @@ protected static function addMagicPropertyToInfo( Doc $comment, ClassLikeDocblockComment $info, array $specials, - string $property_tag + string $property_tag, ): void { $magic_property_comments = $specials[$property_tag] ?? []; diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php index fae0c8daf26..1922bc74892 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php @@ -1,5 +1,7 @@ codebase = $codebase; $this->file_storage = $file_storage; @@ -963,7 +965,7 @@ public function handleTraitUse(PhpParser\Node\Stmt\TraitUse $node): void private function extendTemplatedType( ClassLikeStorage $storage, PhpParser\Node\Stmt\ClassLike $node, - string $extended_class_name + string $extended_class_name, ): void { if (trim($extended_class_name) === '') { $storage->docblock_issues[] = new InvalidDocblock( @@ -1047,7 +1049,7 @@ private function extendTemplatedType( private function implementTemplatedType( ClassLikeStorage $storage, PhpParser\Node\Stmt\ClassLike $node, - string $implemented_class_name + string $implemented_class_name, ): void { if (trim($implemented_class_name) === '') { $storage->docblock_issues[] = new InvalidDocblock( @@ -1133,7 +1135,7 @@ private function implementTemplatedType( private function useTemplatedType( ClassLikeStorage $storage, PhpParser\Node\Stmt\TraitUse $node, - string $used_class_name + string $used_class_name, ): void { if (trim($used_class_name) === '') { $storage->docblock_issues[] = new InvalidDocblock( @@ -1249,7 +1251,7 @@ private static function registerEmptyConstructor(ClassLikeStorage $class_storage private function visitClassConstDeclaration( PhpParser\Node\Stmt\ClassConst $stmt, ClassLikeStorage $storage, - string $fq_classlike_name + string $fq_classlike_name, ): void { if ($storage->is_trait && $this->codebase->analysis_php_version_id < 8_02_00) { IssueBuffer::maybeAdd(new ConstantDeclarationInTrait( @@ -1413,7 +1415,7 @@ private function visitClassConstDeclaration( private function visitEnumDeclaration( PhpParser\Node\Stmt\EnumCase $stmt, ClassLikeStorage $storage, - string $fq_classlike_name + string $fq_classlike_name, ): void { if (isset($storage->constants[$stmt->name->name])) { IssueBuffer::maybeAdd(new DuplicateConstant( @@ -1513,7 +1515,7 @@ private function getAttributeStorageFromStatement( FileStorage $file_storage, Aliases $aliases, PhpParser\Node\Stmt $stmt, - ?string $fq_classlike_name + ?string $fq_classlike_name, ): array { $storages = []; foreach ($stmt->attrGroups as $attr_group) { @@ -1538,7 +1540,7 @@ private function visitPropertyDeclaration( PhpParser\Node\Stmt\Property $stmt, Config $config, ClassLikeStorage $storage, - string $fq_classlike_name + string $fq_classlike_name, ): void { $comment = $stmt->getDocComment(); $var_comment = null; @@ -1862,7 +1864,7 @@ public static function getTypeAliasesFromComment( PhpParser\Comment\Doc $comment, Aliases $aliases, ?array $type_aliases, - ?string $self_fqcln + ?string $self_fqcln, ): array { $parsed_docblock = DocComment::parsePreservingLength($comment); @@ -1893,7 +1895,7 @@ private static function getTypeAliasesFromCommentLines( array $type_alias_comment_lines, Aliases $aliases, ?array $type_aliases, - ?string $self_fqcln + ?string $self_fqcln, ): array { $type_alias_tokens = []; diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionResolver.php b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionResolver.php index ac05615b4fe..37e3f9f3053 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionResolver.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionResolver.php @@ -1,5 +1,7 @@ expr); @@ -404,7 +406,7 @@ public static function enterConditional( private static function functionEvaluatesToTrue( Codebase $codebase, string $file_path, - PhpParser\Node\Expr\FuncCall $function + PhpParser\Node\Expr\FuncCall $function, ): ?bool { if (!$function->name instanceof PhpParser\Node\Name) { return null; diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php index 696b7497d70..e37e0af8133 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php @@ -1,5 +1,7 @@ $return_block) { $return_lines = explode("\n", $return_block); @@ -700,7 +702,7 @@ private static function extractAllParamNames(array $lines): array private static function checkUnexpectedTags( ParsedDocblock $parsed_docblock, FunctionDocblockComment $info, - PhpParser\Comment\Doc $comment + PhpParser\Comment\Doc $comment, ): void { if (isset($parsed_docblock->tags['psalm-import-type'])) { $info->unexpected_tags['psalm-import-type']['lines'] = self::tagOffsetsToLines( diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php index 9f9a477cb4d..a6f442e6433 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php @@ -1,5 +1,7 @@ name . '::' : ''; @@ -941,7 +943,7 @@ private static function handleReturn( array $type_aliases, ?ClassLikeStorage $classlike_storage, string $cased_function_id, - FileStorage $file_storage + FileStorage $file_storage, ): void { if (!$fake_method && $docblock_info->return_type_line_number @@ -1077,7 +1079,7 @@ private static function handleReturn( private static function handleTaintFlow( FunctionDocblockComment $docblock_info, - FunctionLikeStorage $storage + FunctionLikeStorage $storage, ): void { if ($docblock_info->flows) { foreach ($docblock_info->flows as $flow) { @@ -1165,7 +1167,7 @@ private static function handleRemovedTaint( ?ClassLikeStorage $classlike_storage, string $cased_function_id, FileStorage $file_storage, - FileScanner $file_scanner + FileScanner $file_scanner, ): void { try { [$fixed_type_tokens, $function_template_types] = self::getConditionalSanitizedTypeTokens( @@ -1220,7 +1222,7 @@ private static function handleAssertions( array $class_template_types, array $function_template_types, array $type_aliases, - ?ClassLikeStorage $classlike_storage + ?ClassLikeStorage $classlike_storage, ): void { if ($docblock_info->assertions) { $storage->assertions = []; @@ -1381,7 +1383,7 @@ private static function handleParamOut( PhpParser\Node\FunctionLike $stmt, FunctionLikeStorage $storage, Codebase $codebase, - FileStorage $file_storage + FileStorage $file_storage, ): void { $param_name = substr($docblock_param_out['name'], 1); @@ -1433,7 +1435,7 @@ private static function handleTemplates( array $type_aliases, FileScanner $file_scanner, PhpParser\Node\FunctionLike $stmt, - string $cased_function_id + string $cased_function_id, ): array { $storage->template_types = []; @@ -1502,7 +1504,7 @@ private static function handleUnexpectedTags( FunctionLikeStorage $storage, PhpParser\Node\FunctionLike $stmt, FileScanner $file_scanner, - string $cased_function_id + string $cased_function_id, ): void { foreach ($docblock_info->unexpected_tags as $tag => $details) { foreach ($details['lines'] as $line) { diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php index e0ba4e3478b..a4b0a655e0d 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php @@ -1,5 +1,7 @@ codebase = $codebase; $this->file_storage = $file_storage; @@ -120,9 +122,8 @@ public function __construct( /** * @param bool $fake_method in the case of @method annotations we do something a little strange - * @return FunctionStorage|MethodStorage|false */ - public function start(PhpParser\Node\FunctionLike $stmt, bool $fake_method = false) + public function start(PhpParser\Node\FunctionLike $stmt, bool $fake_method = false): FunctionStorage|MethodStorage|false { if ($stmt instanceof PhpParser\Node\Expr\Closure || $stmt instanceof PhpParser\Node\Expr\ArrowFunction @@ -733,7 +734,7 @@ public function start(PhpParser\Node\FunctionLike $stmt, bool $fake_method = fal private function inferPropertyTypeFromConstructor( PhpParser\Node\Stmt\ClassMethod $stmt, MethodStorage $storage, - ClassLikeStorage $classlike_storage + ClassLikeStorage $classlike_storage, ): void { if (!$stmt->stmts) { return; @@ -800,7 +801,7 @@ private function getTranslatedFunctionParam( PhpParser\Node\Param $param, PhpParser\Node\FunctionLike $stmt, bool $fake_method, - ?string $fq_classlike_name + ?string $fq_classlike_name, ): FunctionLikeParameter { $param_type = null; diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/TypeHintResolver.php b/src/Psalm/Internal/PhpVisitor/Reflector/TypeHintResolver.php index 3e5fcef5d45..f66b7351ad9 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/TypeHintResolver.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/TypeHintResolver.php @@ -1,5 +1,7 @@ codebase = $codebase; $this->file_scanner = $file_scanner; diff --git a/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php b/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php index fe0bd1f4a92..55ca888a507 100644 --- a/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php @@ -1,5 +1,7 @@ fake_type_provider = $fake_type_provider; $this->real_type_provider = $real_type_provider; diff --git a/src/Psalm/Internal/PhpVisitor/YieldTypeCollector.php b/src/Psalm/Internal/PhpVisitor/YieldTypeCollector.php index 4d9f075a5e7..012dc3db73b 100644 --- a/src/Psalm/Internal/PhpVisitor/YieldTypeCollector.php +++ b/src/Psalm/Internal/PhpVisitor/YieldTypeCollector.php @@ -1,5 +1,7 @@ loadFromCache($fq_classlike_name_lc, $file_path); @@ -121,7 +123,7 @@ private function loadFromCache(string $fq_classlike_name_lc, ?string $file_path) private function getCacheLocationForClass( string $fq_classlike_name_lc, ?string $file_path, - bool $create_directory = false + bool $create_directory = false, ): string { $root_cache_directory = $this->cache->getCacheDirectory(); diff --git a/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php b/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php index 9b8c82617ea..f0e775c123f 100644 --- a/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php +++ b/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php @@ -1,5 +1,7 @@ isFirstClassCallable()) { return null; diff --git a/src/Psalm/Internal/Provider/FakeFileProvider.php b/src/Psalm/Internal/Provider/FakeFileProvider.php index 756e0d72806..66d607380a3 100644 --- a/src/Psalm/Internal/Provider/FakeFileProvider.php +++ b/src/Psalm/Internal/Provider/FakeFileProvider.php @@ -1,5 +1,7 @@ >|false */ - public function getAnalyzedMethodCache() + public function getAnalyzedMethodCache(): array|false { /** @var null|array> $cache_item */ $cache_item = $this->getCacheItem(self::ANALYZED_METHODS_CACHE_NAME); @@ -246,7 +248,7 @@ public function setAnalyzedMethodCache(array $analyzed_methods): void /** * @return array|false */ - public function getFileMapCache() + public function getFileMapCache(): array|false { /** @var array|null $cache_item */ $cache_item = $this->getCacheItem(self::FILE_MAPS_CACHE_NAME); @@ -283,10 +285,7 @@ public function setTypeCoverage(array $mixed_counts): void $this->saveCacheItem(self::TYPE_COVERAGE_CACHE_NAME, $mixed_counts); } - /** - * @return string|false - */ - public function getConfigHashCache() + public function getConfigHashCache(): string|false { $cache_directory = $this->config->getCacheDirectory(); diff --git a/src/Psalm/Internal/Provider/FileReferenceProvider.php b/src/Psalm/Internal/Provider/FileReferenceProvider.php index 15950320835..3b703fa514c 100644 --- a/src/Psalm/Internal/Provider/FileReferenceProvider.php +++ b/src/Psalm/Internal/Provider/FileReferenceProvider.php @@ -1,5 +1,7 @@ true]; @@ -755,7 +757,7 @@ public function addMethodReferenceToClassMember( public function addMethodDependencyToClassMember( string $calling_function_id, - string $referenced_member_id + string $referenced_member_id, ): void { if (!isset(self::$method_dependencies[$referenced_member_id])) { self::$method_dependencies[$referenced_member_id] = [$calling_function_id => true]; @@ -775,7 +777,7 @@ public function addMethodReferenceToClassProperty(string $calling_function_id, s public function addMethodReferenceToMissingClassMember( string $calling_function_id, - string $referenced_member_id + string $referenced_member_id, ): void { if (!isset(self::$method_references_to_missing_class_members[$referenced_member_id])) { self::$method_references_to_missing_class_members[$referenced_member_id] = [$calling_function_id => true]; @@ -795,7 +797,7 @@ public function addCallingLocationForClassMethod(CodeLocation $code_location, st public function addCallingLocationForClassProperty( CodeLocation $code_location, - string $referenced_property_id + string $referenced_property_id, ): void { if (!isset(self::$class_property_locations[$referenced_property_id])) { self::$class_property_locations[$referenced_property_id] = [$code_location]; diff --git a/src/Psalm/Internal/Provider/FileStorageCacheProvider.php b/src/Psalm/Internal/Provider/FileStorageCacheProvider.php index 9fcb7d9d32b..602be6cb6ff 100644 --- a/src/Psalm/Internal/Provider/FileStorageCacheProvider.php +++ b/src/Psalm/Internal/Provider/FileStorageCacheProvider.php @@ -1,5 +1,7 @@ |null $template_type_parameters */ public function getReturnType( StatementsSource $statements_source, string $fq_classlike_name, string $method_name, - $stmt, + PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall $stmt, Context $context, CodeLocation $code_location, ?array $template_type_parameters = null, ?string $called_fq_classlike_name = null, - ?string $called_method_name = null + ?string $called_method_name = null, ): ?Union { foreach (self::$handlers[strtolower($fq_classlike_name)] ?? [] as $class_handler) { $event = new MethodReturnTypeProviderEvent( diff --git a/src/Psalm/Internal/Provider/MethodVisibilityProvider.php b/src/Psalm/Internal/Provider/MethodVisibilityProvider.php index 276de010434..2987e3a3112 100644 --- a/src/Psalm/Internal/Provider/MethodVisibilityProvider.php +++ b/src/Psalm/Internal/Provider/MethodVisibilityProvider.php @@ -1,5 +1,7 @@ use_file_cache) { return null; @@ -221,7 +223,7 @@ public function saveStatementsToCache( string $file_path, string $file_content_hash, array $stmts, - bool $touch_only + bool $touch_only, ): void { $cache_location = $this->getCacheLocationForPath($file_path, self::PARSER_CACHE_DIRECTORY, !$touch_only); @@ -342,7 +344,7 @@ private function getParserCacheKey(string $file_path): string private function getCacheLocationForPath( string $file_path, string $subdirectory, - bool $create_directory = false + bool $create_directory = false, ): string { $root_cache_directory = $this->cache->getCacheDirectory(); diff --git a/src/Psalm/Internal/Provider/ProjectCacheProvider.php b/src/Psalm/Internal/Provider/ProjectCacheProvider.php index 4948acc5f24..107236874a4 100644 --- a/src/Psalm/Internal/Provider/ProjectCacheProvider.php +++ b/src/Psalm/Internal/Provider/ProjectCacheProvider.php @@ -1,5 +1,7 @@ file_provider = $file_provider; $this->parser_cache_provider = $parser_cache_provider; diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayColumnReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayColumnReturnTypeProvider.php index dbb3f3dfb36..de255157edf 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayColumnReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayColumnReturnTypeProvider.php @@ -1,5 +1,7 @@ isSingle()) { if ($row_type->hasArray()) { diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayCombineReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayCombineReturnTypeProvider.php index 999f0b84ef5..63f3fc49c3a 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayCombineReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayCombineReturnTypeProvider.php @@ -1,5 +1,7 @@ node_data; @@ -381,7 +383,7 @@ public static function getReturnTypeFromMappingIds( PhpParser\Node\Arg $function_call_arg, array $array_args, ?array &$assertions = null, - ?int $fake_var_discriminator = null + ?int $fake_var_discriminator = null, ): Union { $mapping_return_type = null; diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMergeReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMergeReturnTypeProvider.php index 394988baee1..6191b9e829f 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMergeReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMergeReturnTypeProvider.php @@ -1,5 +1,7 @@ file_provider = $file_provider; $this->parser_cache_provider = $parser_cache_provider; @@ -103,7 +102,7 @@ public function __construct( public function getStatementsForFile( string $file_path, int $analysis_php_version_id, - ?Progress $progress = null + ?Progress $progress = null, ): array { unset($this->errors[$file_path]); @@ -388,7 +387,7 @@ public static function parseStatements( ?string $file_path = null, ?string $existing_file_contents = null, ?array $existing_statements = null, - ?array $file_changes = null + ?array $file_changes = null, ): array { $attributes = [ 'comments', 'startLine', 'startFilePos', 'endFilePos', diff --git a/src/Psalm/Internal/ReferenceConstraint.php b/src/Psalm/Internal/ReferenceConstraint.php index 64db0e24344..c3c28e8b50c 100644 --- a/src/Psalm/Internal/ReferenceConstraint.php +++ b/src/Psalm/Internal/ReferenceConstraint.php @@ -1,5 +1,7 @@ methods->return_type_provider->registerClosure( $meta_fq_classlike_name, static function ( - MethodReturnTypeProviderEvent $event + MethodReturnTypeProviderEvent $event, ) use ( $map, $offset, $meta_fq_classlike_name, - $meta_method_name + $meta_method_name, ): ?Union { $statements_analyzer = $event->getSource(); $call_args = $event->getCallArgs(); @@ -195,11 +197,11 @@ static function ( $codebase->methods->return_type_provider->registerClosure( $meta_fq_classlike_name, static function ( - MethodReturnTypeProviderEvent $event + MethodReturnTypeProviderEvent $event, ) use ( $type_offset, $meta_fq_classlike_name, - $meta_method_name + $meta_method_name, ): ?Union { $statements_analyzer = $event->getSource(); $call_args = $event->getCallArgs(); @@ -229,11 +231,11 @@ static function ( $codebase->methods->return_type_provider->registerClosure( $meta_fq_classlike_name, static function ( - MethodReturnTypeProviderEvent $event + MethodReturnTypeProviderEvent $event, ) use ( $element_type_offset, $meta_fq_classlike_name, - $meta_method_name + $meta_method_name, ): ?Union { $statements_analyzer = $event->getSource(); $call_args = $event->getCallArgs(); @@ -292,10 +294,10 @@ static function ( $codebase->functions->return_type_provider->registerClosure( $function_id, static function ( - FunctionReturnTypeProviderEvent $event + FunctionReturnTypeProviderEvent $event, ) use ( $map, - $offset + $offset, ): Union { $statements_analyzer = $event->getStatementsSource(); $call_args = $event->getCallArgs(); @@ -342,9 +344,9 @@ static function ( $codebase->functions->return_type_provider->registerClosure( $function_id, static function ( - FunctionReturnTypeProviderEvent $event + FunctionReturnTypeProviderEvent $event, ) use ( - $type_offset + $type_offset, ): Union { $statements_analyzer = $event->getStatementsSource(); $call_args = $event->getCallArgs(); @@ -372,9 +374,9 @@ static function ( $codebase->functions->return_type_provider->registerClosure( $function_id, static function ( - FunctionReturnTypeProviderEvent $event + FunctionReturnTypeProviderEvent $event, ) use ( - $element_type_offset + $element_type_offset, ): Union { $statements_analyzer = $event->getStatementsSource(); $call_args = $event->getCallArgs(); diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php index dcff9097691..430c9e6c5e6 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php @@ -1,5 +1,7 @@ value = $value; } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php index 64c33e5874f..42a5237bd7a 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php @@ -1,5 +1,7 @@ cond = $cond; $this->if = $if; diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstantComponent.php b/src/Psalm/Internal/Scanner/UnresolvedConstantComponent.php index caede827d93..9046813131f 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstantComponent.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstantComponent.php @@ -1,5 +1,7 @@ if_context = $if_context; $this->post_if_context = $post_if_context; diff --git a/src/Psalm/Internal/Scope/IfScope.php b/src/Psalm/Internal/Scope/IfScope.php index 27a5181d970..b44489e468d 100644 --- a/src/Psalm/Internal/Scope/IfScope.php +++ b/src/Psalm/Internal/Scope/IfScope.php @@ -1,5 +1,7 @@ getCodebase(); @@ -238,7 +240,7 @@ public static function reconcile( private static function getMissingType( Assertion $assertion, - bool $inside_loop + bool $inside_loop, ): Union { if (($assertion instanceof IsIsset || $assertion instanceof IsEqualIsset) || $assertion instanceof NonEmpty @@ -282,7 +284,7 @@ private static function refine( bool $negated, ?CodeLocation $code_location, array $suppressed_issues, - int &$failed_reconciliation + int &$failed_reconciliation, ): Union { $codebase = $statements_analyzer->getCodebase(); @@ -522,7 +524,7 @@ private static function filterTypeWithAnother( Codebase $codebase, Union &$existing_type, Union $new_type, - bool &$any_scalar_type_match_found = false + bool &$any_scalar_type_match_found = false, ): ?Union { $matching_atomic_types = []; @@ -555,7 +557,7 @@ private static function filterAtomicWithAnother( Atomic &$type_1_atomic, Atomic $type_2_atomic, Codebase $codebase, - bool &$any_scalar_type_match_found + bool &$any_scalar_type_match_found, ): ?Atomic { if ($type_1_atomic instanceof TFloat && $type_2_atomic instanceof TInt @@ -826,7 +828,7 @@ private static function refineContainedAtomicWithAnother( Atomic $type_1_atomic, Atomic $type_2_atomic, Codebase $codebase, - bool $type_coerced + bool $type_coerced, ): ?Atomic { if ($type_coerced && get_class($type_2_atomic) === TNamedObject::class @@ -871,7 +873,7 @@ private static function handleLiteralEquality( ?string $var_id, bool $negated, ?CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): Union { $existing_var_atomic_types = []; @@ -1010,7 +1012,7 @@ private static function handleLiteralEqualityWithInt( ?string $var_id, bool $negated, ?CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): Union { $value = $assertion_type->value; @@ -1151,7 +1153,7 @@ private static function handleLiteralEqualityWithString( ?string $var_id, bool $negated, ?CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): Union { $value = $assertion_type->value; @@ -1294,7 +1296,7 @@ private static function handleLiteralEqualityWithFloat( ?string $var_id, bool $negated, ?CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): Union { $value = $assertion_type->value; @@ -1429,7 +1431,7 @@ private static function getCompatibleIntType( Union $existing_var_type, array $existing_var_atomic_types, TLiteralInt $assertion_type, - bool $is_loose_equality + bool $is_loose_equality, ): ?Union { foreach ($existing_var_atomic_types as $existing_var_atomic_type) { if ($existing_var_atomic_type instanceof TMixed @@ -1457,7 +1459,7 @@ private static function getCompatibleStringType( Union $existing_var_type, array $existing_var_atomic_types, TLiteralString $assertion_type, - bool $is_loose_equality + bool $is_loose_equality, ): ?Union { foreach ($existing_var_atomic_types as $existing_var_atomic_type) { if ($existing_var_atomic_type instanceof TMixed @@ -1484,7 +1486,7 @@ private static function getCompatibleFloatType( Union $existing_var_type, array $existing_var_atomic_types, TLiteralFloat $assertion_type, - bool $is_loose_equality + bool $is_loose_equality, ): ?Union { foreach ($existing_var_atomic_types as $existing_var_atomic_type) { if ($existing_var_atomic_type instanceof TMixed @@ -1515,7 +1517,7 @@ private static function handleIsA( ?CodeLocation $code_location, ?string $key, array $suppressed_issues, - bool &$should_return + bool &$should_return, ): array { $allow_string_comparison = $assertion->allow_string; diff --git a/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php b/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php index 6977e465876..80c51b7acb5 100644 --- a/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php @@ -1,5 +1,7 @@ getKeyedArray(); @@ -842,7 +844,7 @@ public static function canBeIdentical( Codebase $codebase, Atomic $type1_part, Atomic $type2_part, - bool $allow_interface_equality = true + bool $allow_interface_equality = true, ): bool { if ($type1_part instanceof TList) { $type1_part = $type1_part->getKeyedArray(); diff --git a/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php b/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php index fa3b5328974..cbeca030ac9 100644 --- a/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php @@ -1,5 +1,7 @@ is_pure && !$input_type_part->is_pure) { if ($atomic_comparison_result) { @@ -140,7 +142,7 @@ public static function isNotExplicitlyCallableTypeCallable( Codebase $codebase, Atomic $input_type_part, TCallable $container_type_part, - ?TypeComparisonResult $atomic_comparison_result + ?TypeComparisonResult $atomic_comparison_result, ): bool { if ($input_type_part instanceof TList) { $input_type_part = $input_type_part->getKeyedArray(); @@ -220,7 +222,7 @@ public static function getCallableFromAtomic( Atomic $input_type_part, ?TCallable $container_type_part = null, ?StatementsAnalyzer $statements_analyzer = null, - bool $expand_callable = false + bool $expand_callable = false, ): ?Atomic { if ($input_type_part instanceof TList) { $input_type_part = $input_type_part->getKeyedArray(); @@ -442,8 +444,8 @@ public static function getCallableMethodIdFromTKeyedArray( TKeyedArray $input_type_part, ?Codebase $codebase = null, ?string $calling_method_id = null, - ?string $file_name = null - ) { + ?string $file_name = null, + ): string|MethodIdentifier|null { if (!isset($input_type_part->properties[0]) || !isset($input_type_part->properties[1]) ) { diff --git a/src/Psalm/Internal/Type/Comparator/ClassLikeStringComparator.php b/src/Psalm/Internal/Type/Comparator/ClassLikeStringComparator.php index a3830ea83d4..e252680b31a 100644 --- a/src/Psalm/Internal/Type/Comparator/ClassLikeStringComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ClassLikeStringComparator.php @@ -1,5 +1,7 @@ min_bound === null; $is_input_max = $input_type_part->max_bound === null; @@ -47,7 +49,7 @@ public static function isContainedBy( */ public static function isContainedByUnion( TIntRange $input_type_part, - Union $container_type + Union $container_type, ): bool { $container_atomic_types = $container_type->getAtomicTypes(); $reduced_range = new TIntRange( diff --git a/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php b/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php index c9d7aad5842..f52f415929b 100644 --- a/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php +++ b/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php @@ -1,5 +1,7 @@ fallback_params === null; @@ -285,7 +287,7 @@ public static function isContainedByObjectWithProperties( TNamedObject $input_type_part, TObjectWithProperties $container_type_part, bool $allow_interface_equality, - ?TypeComparisonResult $atomic_comparison_result + ?TypeComparisonResult $atomic_comparison_result, ): bool { $all_types_contain = true; @@ -346,7 +348,7 @@ public static function isContainedByObjectWithProperties( public static function coerceToObjectWithProperties( Codebase $codebase, TNamedObject $input_type_part, - TObjectWithProperties $container_type_part + TObjectWithProperties $container_type_part, ): ?TObjectWithProperties { $storage = $codebase->classlikes->getStorageFor($input_type_part->value); diff --git a/src/Psalm/Internal/Type/Comparator/ObjectComparator.php b/src/Psalm/Internal/Type/Comparator/ObjectComparator.php index 1d264658dd8..920fe6f6d6c 100644 --- a/src/Psalm/Internal/Type/Comparator/ObjectComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ObjectComparator.php @@ -1,5 +1,7 @@ isVanillaMixed()) { return true; @@ -352,7 +354,7 @@ public static function isContainedBy( */ public static function isContainedByInPhp( ?Union $input_type, - Union $container_type + Union $container_type, ): bool { if ($container_type->isMixed()) { return true; @@ -400,7 +402,7 @@ public static function canBeContainedBy( Union $container_type, bool $ignore_null = false, bool $ignore_false = false, - array &$matching_input_keys = [] + array &$matching_input_keys = [], ): bool { if ($container_type->hasMixed()) { return true; @@ -452,7 +454,7 @@ public static function canExpressionTypesBeIdentical( Codebase $codebase, Union $type1, Union $type2, - bool $allow_interface_equality = true + bool $allow_interface_equality = true, ): bool { if ($type1->hasMixed() || $type2->hasMixed()) { return true; @@ -495,7 +497,7 @@ public static function canExpressionTypesBeIdentical( */ private static function getTypeParts( Codebase $codebase, - Union $union_type + Union $union_type, ): array { $atomic_types = []; foreach ($union_type->getAtomicTypes() as $atomic_type) { diff --git a/src/Psalm/Internal/Type/NegatedAssertionReconciler.php b/src/Psalm/Internal/Type/NegatedAssertionReconciler.php index f4de672c99e..d7f1ecc0e9b 100644 --- a/src/Psalm/Internal/Type/NegatedAssertionReconciler.php +++ b/src/Psalm/Internal/Type/NegatedAssertionReconciler.php @@ -1,5 +1,7 @@ getBuilder(); $existing_var_atomic_types = $existing_var_type->getAtomicTypes(); diff --git a/src/Psalm/Internal/Type/ParseTree.php b/src/Psalm/Internal/Type/ParseTree.php index e181b07df84..5693203547a 100644 --- a/src/Psalm/Internal/Type/ParseTree.php +++ b/src/Psalm/Internal/Type/ParseTree.php @@ -1,5 +1,7 @@ name = $name; $this->byref = $byref; diff --git a/src/Psalm/Internal/Type/ParseTree/MethodTree.php b/src/Psalm/Internal/Type/ParseTree/MethodTree.php index f77494b405c..dedc0b01ec0 100644 --- a/src/Psalm/Internal/Type/ParseTree/MethodTree.php +++ b/src/Psalm/Internal/Type/ParseTree/MethodTree.php @@ -1,5 +1,7 @@ offset_start = $offset_start; $this->offset_end = $offset_end; diff --git a/src/Psalm/Internal/Type/ParseTreeCreator.php b/src/Psalm/Internal/Type/ParseTreeCreator.php index 9fdd3fcc482..f862c8774e9 100644 --- a/src/Psalm/Internal/Type/ParseTreeCreator.php +++ b/src/Psalm/Internal/Type/ParseTreeCreator.php @@ -1,5 +1,7 @@ getBuilder(); $old_var_type_string = $existing_var_type->getId(); @@ -619,7 +621,7 @@ private static function reconcileNonEmptyCountable( bool $negated, ?CodeLocation $code_location, array $suppressed_issues, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); $existing_var_type = $existing_var_type->getBuilder(); @@ -754,7 +756,7 @@ private static function reconcileExactlyCountable( bool $negated, ?CodeLocation $code_location, array $suppressed_issues, - bool $is_equality + bool $is_equality, ): Union { $existing_var_type = $existing_var_type->getBuilder(); if ($existing_var_type->hasType('array')) { @@ -875,7 +877,7 @@ private static function reconcileHasMethod( bool $negated, ?CodeLocation $code_location, array $suppressed_issues, - int &$failed_reconciliation + int &$failed_reconciliation, ): Union { $method_name = $assertion->method; $old_var_type_string = $existing_var_type->getId(); @@ -988,7 +990,7 @@ private static function reconcileString( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); $existing_var_atomic_types = $existing_var_type->getAtomicTypes(); @@ -1078,7 +1080,7 @@ private static function reconcileInt( bool $negated, ?CodeLocation $code_location, array $suppressed_issues, - int &$failed_reconciliation + int &$failed_reconciliation, ): Union { if ($existing_var_type->hasMixed()) { if ($assertion instanceof IsLooselyEqual) { @@ -1173,7 +1175,7 @@ private static function reconcileBool( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { if ($existing_var_type->hasMixed()) { return Type::getBool(); @@ -1252,7 +1254,7 @@ private static function reconcileFalse( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { if ($existing_var_type->hasMixed()) { return Type::getFalse(); @@ -1337,7 +1339,7 @@ private static function reconcileTrue( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { if ($existing_var_type->hasMixed()) { return Type::getTrue(); @@ -1422,7 +1424,7 @@ private static function reconcileScalar( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { if ($existing_var_type->hasMixed()) { return Type::getScalar(); @@ -1497,7 +1499,7 @@ private static function reconcileNumeric( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { if ($existing_var_type->hasMixed()) { return Type::getNumeric(); @@ -1592,7 +1594,7 @@ private static function reconcileObject( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { if ($existing_var_type->hasMixed()) { return Type::getObject(); @@ -1710,7 +1712,7 @@ private static function reconcileResource( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { if ($existing_var_type->hasMixed()) { return Type::getResource(); @@ -1769,7 +1771,7 @@ private static function reconcileCountable( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); @@ -1841,7 +1843,7 @@ private static function reconcileIterable( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); @@ -1903,7 +1905,7 @@ private static function reconcileInArray( bool $negated, ?CodeLocation $code_location, array $suppressed_issues, - int &$failed_reconciliation + int &$failed_reconciliation, ): Union { $new_var_type = $assertion->type; @@ -1940,7 +1942,7 @@ private static function reconcileInArray( private static function reconcileHasArrayKey( Union $existing_var_type, - HasArrayKey $assertion + HasArrayKey $assertion, ): Union { $assertion = $assertion->key; $types = $existing_var_type->getAtomicTypes(); @@ -1981,7 +1983,7 @@ private static function reconcileIsGreaterThan( ?string $var_id, bool $negated, ?CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): Union { $existing_var_type = $existing_var_type->getBuilder(); //we add 1 from the assertion value because we're on a strict operator @@ -2090,7 +2092,7 @@ private static function reconcileIsLessThan( ?string $var_id, bool $negated, ?CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): Union { //we remove 1 from the assertion value because we're on a strict operator $assertion_value = $assertion->value - 1; @@ -2198,7 +2200,7 @@ private static function reconcileTraversable( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); @@ -2268,7 +2270,7 @@ private static function reconcileArray( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); @@ -2384,7 +2386,7 @@ private static function reconcileList( array $suppressed_issues, int &$failed_reconciliation, bool $is_equality, - bool $is_non_empty + bool $is_non_empty, ): Union { $old_var_type_string = $existing_var_type->getId(); @@ -2494,7 +2496,7 @@ private static function reconcileStringArrayAccess( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $inside_loop + bool $inside_loop, ): Union { $old_var_type_string = $existing_var_type->getId(); @@ -2565,7 +2567,7 @@ private static function reconcileIntArrayAccess( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $inside_loop + bool $inside_loop, ): Union { $old_var_type_string = $existing_var_type->getId(); @@ -2626,7 +2628,7 @@ private static function reconcileCallable( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { if ($existing_var_type->hasMixed()) { return Type::parseString('callable'); @@ -2734,7 +2736,7 @@ private static function reconcileTruthyOrNonEmpty( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $recursive_check + bool $recursive_check, ): Union { $types = $existing_var_type->getAtomicTypes(); $old_var_type_string = $existing_var_type->getId(); @@ -2928,7 +2930,7 @@ private static function reconcileClassConstant( Codebase $codebase, TClassConstant $class_constant_expression, Union $existing_type, - int &$failed_reconciliation + int &$failed_reconciliation, ): Union { $class_name = $class_constant_expression->fq_classlike_name; if (!$codebase->classlike_storage_provider->has($class_name)) { diff --git a/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php index 160bdc7482f..2b9fc1f196c 100644 --- a/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php @@ -1,5 +1,7 @@ getId(); @@ -423,7 +425,7 @@ public static function reconcile( } private static function reconcileCallable( - Union $existing_var_type + Union $existing_var_type, ): Union { $existing_var_type = $existing_var_type->getBuilder(); foreach ($existing_var_type->getAtomicTypes() as $atomic_key => $type) { @@ -453,7 +455,7 @@ private static function reconcileBool( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); $non_bool_types = []; @@ -523,7 +525,7 @@ private static function reconcileNotNonEmptyCountable( ?CodeLocation $code_location, array $suppressed_issues, bool $is_equality, - ?int $count + ?int $count, ): Union { $existing_var_type = $existing_var_type->getBuilder(); $old_var_type_string = $existing_var_type->getId(); @@ -643,7 +645,7 @@ private static function reconcileNull( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $types = $existing_var_type->getAtomicTypes(); $old_var_type_string = $existing_var_type->getId(); @@ -720,7 +722,7 @@ private static function reconcileFalse( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $types = $existing_var_type->getAtomicTypes(); $old_var_type_string = $existing_var_type->getId(); @@ -802,7 +804,7 @@ private static function reconcileTrue( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $types = $existing_var_type->getAtomicTypes(); $old_var_type_string = $existing_var_type->getId(); @@ -885,7 +887,7 @@ private static function reconcileFalsyOrEmpty( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $recursive_check + bool $recursive_check, ): Union { $existing_var_type = $existing_var_type->getBuilder(); $old_var_type_string = $existing_var_type->getId(); @@ -1068,7 +1070,7 @@ private static function reconcileScalar( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); $non_scalar_types = []; @@ -1156,7 +1158,7 @@ private static function reconcileObject( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); $non_object_types = []; @@ -1257,7 +1259,7 @@ private static function reconcileNumeric( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); $non_numeric_types = []; @@ -1353,7 +1355,7 @@ private static function reconcileInt( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); $non_int_types = []; @@ -1455,7 +1457,7 @@ private static function reconcileFloat( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); $non_float_types = []; @@ -1552,7 +1554,7 @@ private static function reconcileString( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); $non_string_types = []; @@ -1658,7 +1660,7 @@ private static function reconcileArray( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $old_var_type_string = $existing_var_type->getId(); $non_array_types = []; @@ -1763,7 +1765,7 @@ private static function reconcileResource( ?CodeLocation $code_location, array $suppressed_issues, int &$failed_reconciliation, - bool $is_equality + bool $is_equality, ): Union { $types = $existing_var_type->getAtomicTypes(); $old_var_type_string = $existing_var_type->getId(); @@ -1834,7 +1836,7 @@ private static function reconcileIsLessThanOrEqualTo( ?string $var_id, bool $negated, ?CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): Union { $existing_var_type = $existing_var_type->getBuilder(); $assertion_value = $assertion->value; @@ -1941,7 +1943,7 @@ private static function reconcileIsGreaterThanOrEqualTo( ?string $var_id, bool $negated, ?CodeLocation $code_location, - array $suppressed_issues + array $suppressed_issues, ): Union { $existing_var_type = $existing_var_type->getBuilder(); $assertion_value = $assertion->value; diff --git a/src/Psalm/Internal/Type/TemplateBound.php b/src/Psalm/Internal/Type/TemplateBound.php index 01aada21077..94febcedbc4 100644 --- a/src/Psalm/Internal/Type/TemplateBound.php +++ b/src/Psalm/Internal/Type/TemplateBound.php @@ -1,5 +1,7 @@ type = $type; $this->appearance_depth = $appearance_depth; diff --git a/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php b/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php index fc8573ab418..ba12f0b0bfb 100644 --- a/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php +++ b/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php @@ -1,5 +1,7 @@ param_name][$atomic_type->defining_class])) { return null; @@ -367,7 +369,7 @@ private static function replaceTemplateKeyOfValueOf( private static function replaceTemplatePropertiesOf( ?Codebase $codebase, TTemplatePropertiesOf $atomic_type, - array $inferred_lower_bounds + array $inferred_lower_bounds, ): ?Atomic { if (!isset($inferred_lower_bounds[$atomic_type->param_name][$atomic_type->defining_class])) { return null; @@ -396,7 +398,7 @@ private static function replaceConditional( TemplateResult $template_result, Codebase $codebase, TConditional &$atomic_type, - array $inferred_lower_bounds + array $inferred_lower_bounds, ): Union { $template_type = isset($inferred_lower_bounds[$atomic_type->param_name][$atomic_type->defining_class]) ? TemplateStandinTypeReplacer::getMostSpecificTypeFromBounds( diff --git a/src/Psalm/Internal/Type/TemplateResult.php b/src/Psalm/Internal/Type/TemplateResult.php index 35d98333479..1564250c816 100644 --- a/src/Psalm/Internal/Type/TemplateResult.php +++ b/src/Psalm/Internal/Type/TemplateResult.php @@ -1,5 +1,7 @@ defining_class === $calling_class) { return [$atomic_type]; @@ -1008,7 +1010,7 @@ public static function handleTemplateParamClassStandin( bool $add_lower_bound, ?string $bound_equality_classlike, int $depth, - bool $was_single + bool $was_single, ): array { if ($atomic_type->defining_class === $calling_class) { return [$atomic_type]; @@ -1153,7 +1155,7 @@ public static function getRootTemplateType( string $param_name, string $defining_class, array $visited_classes, - ?Codebase $codebase + ?Codebase $codebase, ): ?Union { if (isset($visited_classes[$defining_class])) { return null; @@ -1252,7 +1254,7 @@ public static function getMappedGenericTypeParams( Codebase $codebase, Atomic $input_type_part, Atomic $container_type_part, - ?array &$container_type_params_covariant = null + ?array &$container_type_params_covariant = null, ): array { $_ = null; if ($input_type_part instanceof TGenericObject || $input_type_part instanceof TIterable) { diff --git a/src/Psalm/Internal/Type/TypeAlias.php b/src/Psalm/Internal/Type/TypeAlias.php index a8c05fb6d30..3e5da8b5069 100644 --- a/src/Psalm/Internal/Type/TypeAlias.php +++ b/src/Psalm/Internal/Type/TypeAlias.php @@ -1,5 +1,7 @@ declaring_fq_classlike_name = $declaring_fq_classlike_name; $this->alias_name = $alias_name; diff --git a/src/Psalm/Internal/Type/TypeCombination.php b/src/Psalm/Internal/Type/TypeCombination.php index 863ae77f932..f57182db5fb 100644 --- a/src/Psalm/Internal/Type/TypeCombination.php +++ b/src/Psalm/Internal/Type/TypeCombination.php @@ -1,5 +1,7 @@ getKeyedArray(); @@ -975,7 +977,7 @@ private static function scrapeStringProperties( Atomic $type, TypeCombination $combination, ?Codebase $codebase, - int $literal_limit + int $literal_limit, ): void { if ($type instanceof TCallableString && isset($combination->value_types['callable'])) { return; @@ -1174,7 +1176,7 @@ private static function scrapeIntProperties( string $type_key, Atomic $type, TypeCombination $combination, - int $literal_limit + int $literal_limit, ): void { if (isset($combination->value_types['array-key'])) { return; @@ -1344,7 +1346,7 @@ private static function getClassLikes(Codebase $codebase, string $fq_classlike_n private static function handleKeyedArrayEntries( TypeCombination $combination, bool $overwrite_empty_array, - bool $from_docblock + bool $from_docblock, ): array { $new_types = []; @@ -1462,7 +1464,7 @@ private static function getArrayTypeFromGenericParams( bool $allow_mixed_union, Atomic $type, array $generic_type_params, - bool $from_docblock + bool $from_docblock, ): Atomic { if ($combination->objectlike_entries) { $objectlike_generic_type = null; diff --git a/src/Psalm/Internal/Type/TypeExpander.php b/src/Psalm/Internal/Type/TypeExpander.php index e329f92b632..788f8d37392 100644 --- a/src/Psalm/Internal/Type/TypeExpander.php +++ b/src/Psalm/Internal/Type/TypeExpander.php @@ -1,5 +1,7 @@ * @psalm-suppress ConflictingReferenceConstraint, ReferenceConstraintViolation The output type is always Atomic @@ -122,14 +122,14 @@ public static function expandAtomic( Codebase $codebase, Atomic &$return_type, ?string $self_class, - $static_class_type, + string|TNamedObject|TTemplateParam|null $static_class_type, ?string $parent_class, bool $evaluate_class_constants = true, bool $evaluate_conditional_types = false, bool $final = false, bool $expand_generic = false, bool $expand_templates = false, - bool $throw_on_unresolvable_constant = false + bool $throw_on_unresolvable_constant = false, ): array { if ($return_type instanceof TEnumCase) { return [$return_type]; @@ -606,19 +606,17 @@ public static function expandAtomic( } /** - * @param string|TNamedObject|TTemplateParam|null $static_class_type * @param-out TNamedObject|TTemplateParam $return_type - * @return TNamedObject|TTemplateParam */ private static function expandNamedObject( Codebase $codebase, TNamedObject &$return_type, ?string $self_class, - $static_class_type, + string|TNamedObject|TTemplateParam|null $static_class_type, ?string $parent_class, bool $final = false, - bool &$expand_generic = false - ) { + bool &$expand_generic = false, + ): TNamedObject|TTemplateParam { if ($expand_generic && get_class($return_type) === TNamedObject::class && !$return_type->extra_types @@ -720,21 +718,20 @@ private static function expandNamedObject( } /** - * @param string|TNamedObject|TTemplateParam|null $static_class_type * @return non-empty-list */ private static function expandConditional( Codebase $codebase, TConditional &$return_type, ?string $self_class, - $static_class_type, + string|TNamedObject|TTemplateParam|null $static_class_type, ?string $parent_class, bool $evaluate_class_constants = true, bool $evaluate_conditional_types = false, bool $final = false, bool $expand_generic = false, bool $expand_templates = false, - bool $throw_on_unresolvable_constant = false + bool $throw_on_unresolvable_constant = false, ): array { $new_as_type = self::expandUnion( $codebase, @@ -932,14 +929,13 @@ private static function expandConditional( } /** - * @param string|TNamedObject|TTemplateParam|null $static_class_type * @return non-empty-list */ private static function expandPropertiesOf( Codebase $codebase, TPropertiesOf &$return_type, ?string $self_class, - $static_class_type + string|TNamedObject|TTemplateParam|null $static_class_type, ): array { if ($self_class) { $return_type = $return_type->replaceClassLike( @@ -1016,21 +1012,20 @@ private static function expandPropertiesOf( /** * @param TKeyOf|TValueOf $return_type - * @param string|TNamedObject|TTemplateParam|null $static_class_type * @return non-empty-list */ private static function expandKeyOfValueOf( Codebase $codebase, Atomic &$return_type, ?string $self_class, - $static_class_type, + string|TNamedObject|TTemplateParam|null $static_class_type, ?string $parent_class, bool $evaluate_class_constants = true, bool $evaluate_conditional_types = false, bool $final = false, bool $expand_generic = false, bool $expand_templates = false, - bool $throw_on_unresolvable_constant = false + bool $throw_on_unresolvable_constant = false, ): array { // Expand class constants to their atomics $type_atomics = []; diff --git a/src/Psalm/Internal/Type/TypeParser.php b/src/Psalm/Internal/Type/TypeParser.php index 35ca41aa280..3f9362aa2e7 100644 --- a/src/Psalm/Internal/Type/TypeParser.php +++ b/src/Psalm/Internal/Type/TypeParser.php @@ -1,5 +1,7 @@ hasMixed()) { return new TTemplateParamClass( @@ -569,7 +571,6 @@ public static function getComputedIntsFromMask(array $potential_ints, bool $from /** * @param array> $template_type_map * @param array $type_aliases - * @return Atomic|Union * @throws TypeParseTreeException * @psalm-suppress ComplexMethod to be refactored */ @@ -578,8 +579,8 @@ private static function getTypeFromGenericTree( Codebase $codebase, array $template_type_map, array $type_aliases, - bool $from_docblock = false - ) { + bool $from_docblock = false, + ): Atomic|Union { $generic_type = $parse_tree->value; $generic_params = []; @@ -1023,7 +1024,7 @@ private static function getTypeFromUnionTree( Codebase $codebase, array $template_type_map, array $type_aliases, - bool $from_docblock + bool $from_docblock, ): Union { $has_null = false; @@ -1089,7 +1090,7 @@ private static function getTypeFromIntersectionTree( Codebase $codebase, array $template_type_map, array $type_aliases, - bool $from_docblock + bool $from_docblock, ): Atomic { $intersection_types = []; @@ -1201,7 +1202,6 @@ private static function getTypeFromIntersectionTree( /** * @param array> $template_type_map * @param array $type_aliases - * @return TCallable|TClosure * @throws TypeParseTreeException */ private static function getTypeFromCallableTree( @@ -1209,8 +1209,8 @@ private static function getTypeFromCallableTree( Codebase $codebase, array $template_type_map, array $type_aliases, - bool $from_docblock - ) { + bool $from_docblock, + ): TCallable|TClosure { $params = []; foreach ($parse_tree->children as $child_tree) { @@ -1279,7 +1279,7 @@ private static function getTypeFromCallableTree( private static function getTypeFromIndexAccessTree( IndexedAccessTree $parse_tree, array $template_type_map, - bool $from_docblock + bool $from_docblock, ): TTemplateIndexedAccess { if (!isset($parse_tree->children[0]) || !$parse_tree->children[0] instanceof Value) { throw new TypeParseTreeException('Unrecognised indexed access'); @@ -1330,7 +1330,6 @@ private static function getTypeFromIndexAccessTree( /** * @param array> $template_type_map * @param array $type_aliases - * @return TCallableKeyedArray|TKeyedArray|TObjectWithProperties|TArray * @throws TypeParseTreeException */ private static function getTypeFromKeyedArrayTree( @@ -1338,8 +1337,8 @@ private static function getTypeFromKeyedArrayTree( Codebase $codebase, array $template_type_map, array $type_aliases, - bool $from_docblock - ) { + bool $from_docblock, + ): TCallableKeyedArray|TKeyedArray|TObjectWithProperties|TArray { $properties = []; $class_strings = []; @@ -1537,7 +1536,7 @@ private static function extractIntersectionKey(Atomic $intersection_type): strin */ private static function extractKeyedIntersectionTypes( Codebase $codebase, - array $intersection_types + array $intersection_types, ): array { $keyed_intersection_types = []; $callable_intersection = null; @@ -1666,7 +1665,7 @@ private static function getTypeFromKeyedArrays( array $intersection_types, Atomic $first_type, Atomic $last_type, - bool $from_docblock + bool $from_docblock, ): Atomic { /** @var non-empty-array */ $properties = []; diff --git a/src/Psalm/Internal/Type/TypeTokenizer.php b/src/Psalm/Internal/Type/TypeTokenizer.php index 66e463e4ccd..97a25802417 100644 --- a/src/Psalm/Internal/Type/TypeTokenizer.php +++ b/src/Psalm/Internal/Type/TypeTokenizer.php @@ -1,5 +1,7 @@ old = strtolower($old); $this->new = $new; diff --git a/src/Psalm/Internal/TypeVisitor/ContainsClassLikeVisitor.php b/src/Psalm/Internal/TypeVisitor/ContainsClassLikeVisitor.php index faedea36d6d..0eebf5619a3 100644 --- a/src/Psalm/Internal/TypeVisitor/ContainsClassLikeVisitor.php +++ b/src/Psalm/Internal/TypeVisitor/ContainsClassLikeVisitor.php @@ -1,5 +1,7 @@ source = $source; $this->code_location = $code_location; diff --git a/src/Psalm/Internal/TypeVisitor/TypeLocalizer.php b/src/Psalm/Internal/TypeVisitor/TypeLocalizer.php index 81ba6a0eb42..7b0907c165b 100644 --- a/src/Psalm/Internal/TypeVisitor/TypeLocalizer.php +++ b/src/Psalm/Internal/TypeVisitor/TypeLocalizer.php @@ -1,5 +1,7 @@ extends = $extends; $this->base_fq_class_name = $base_fq_class_name; diff --git a/src/Psalm/Internal/TypeVisitor/TypeScanner.php b/src/Psalm/Internal/TypeVisitor/TypeScanner.php index d840e7327c2..0596bb1b9f2 100644 --- a/src/Psalm/Internal/TypeVisitor/TypeScanner.php +++ b/src/Psalm/Internal/TypeVisitor/TypeScanner.php @@ -1,5 +1,7 @@ scanner = $scanner; $this->file_storage = $file_storage; diff --git a/src/Psalm/Internal/VersionUtils.php b/src/Psalm/Internal/VersionUtils.php index ac0d6575809..72e8be62720 100644 --- a/src/Psalm/Internal/VersionUtils.php +++ b/src/Psalm/Internal/VersionUtils.php @@ -1,5 +1,7 @@ function_id = $function_id ? strtolower($function_id) : null; diff --git a/src/Psalm/Issue/ArgumentTypeCoercion.php b/src/Psalm/Issue/ArgumentTypeCoercion.php index 516fd4104d6..26833a207dc 100644 --- a/src/Psalm/Issue/ArgumentTypeCoercion.php +++ b/src/Psalm/Issue/ArgumentTypeCoercion.php @@ -1,5 +1,7 @@ const_id = $const_id; diff --git a/src/Psalm/Issue/ClassIssue.php b/src/Psalm/Issue/ClassIssue.php index 3efaa7e5785..9e3f1476615 100644 --- a/src/Psalm/Issue/ClassIssue.php +++ b/src/Psalm/Issue/ClassIssue.php @@ -1,5 +1,7 @@ fq_classlike_name = $fq_classlike_name; diff --git a/src/Psalm/Issue/CodeIssue.php b/src/Psalm/Issue/CodeIssue.php index ce4fcbc469b..d82c9978def 100644 --- a/src/Psalm/Issue/CodeIssue.php +++ b/src/Psalm/Issue/CodeIssue.php @@ -1,5 +1,7 @@ code_location = $code_location; $this->message = $message; diff --git a/src/Psalm/Issue/ComplexFunction.php b/src/Psalm/Issue/ComplexFunction.php index 6db2fec3865..0f42c0630fc 100644 --- a/src/Psalm/Issue/ComplexFunction.php +++ b/src/Psalm/Issue/ComplexFunction.php @@ -1,5 +1,7 @@ function_id = strtolower($function_id); diff --git a/src/Psalm/Issue/IfThisIsMismatch.php b/src/Psalm/Issue/IfThisIsMismatch.php index 508b2176eeb..e56bd547631 100644 --- a/src/Psalm/Issue/IfThisIsMismatch.php +++ b/src/Psalm/Issue/IfThisIsMismatch.php @@ -1,5 +1,7 @@ method_id = strtolower($method_id); diff --git a/src/Psalm/Issue/MethodSignatureMismatch.php b/src/Psalm/Issue/MethodSignatureMismatch.php index d3ba51725e4..5a5a31a5d3d 100644 --- a/src/Psalm/Issue/MethodSignatureMismatch.php +++ b/src/Psalm/Issue/MethodSignatureMismatch.php @@ -1,5 +1,7 @@ code_location = $code_location; $this->message = $message; diff --git a/src/Psalm/Issue/MixedArgumentTypeCoercion.php b/src/Psalm/Issue/MixedArgumentTypeCoercion.php index c9af86b0760..a7bd8f43d92 100644 --- a/src/Psalm/Issue/MixedArgumentTypeCoercion.php +++ b/src/Psalm/Issue/MixedArgumentTypeCoercion.php @@ -1,5 +1,7 @@ code_location = $code_location; $this->message = $message; diff --git a/src/Psalm/Issue/MixedArrayAccess.php b/src/Psalm/Issue/MixedArrayAccess.php index bb827b7f841..407d3822dbb 100644 --- a/src/Psalm/Issue/MixedArrayAccess.php +++ b/src/Psalm/Issue/MixedArrayAccess.php @@ -1,5 +1,7 @@ code_location = $code_location; $this->message = $message; diff --git a/src/Psalm/Issue/MixedMethodCall.php b/src/Psalm/Issue/MixedMethodCall.php index 939f787ef50..786f937a3ea 100644 --- a/src/Psalm/Issue/MixedMethodCall.php +++ b/src/Psalm/Issue/MixedMethodCall.php @@ -1,5 +1,7 @@ origin_location = $origin_location; diff --git a/src/Psalm/Issue/MixedReturnStatement.php b/src/Psalm/Issue/MixedReturnStatement.php index 758258911a9..eb1cc2bb962 100644 --- a/src/Psalm/Issue/MixedReturnStatement.php +++ b/src/Psalm/Issue/MixedReturnStatement.php @@ -1,5 +1,7 @@ dupe_key = strtolower($method_id); diff --git a/src/Psalm/Issue/PossiblyUnusedParam.php b/src/Psalm/Issue/PossiblyUnusedParam.php index 253af21166a..079bb9f1363 100644 --- a/src/Psalm/Issue/PossiblyUnusedParam.php +++ b/src/Psalm/Issue/PossiblyUnusedParam.php @@ -1,5 +1,7 @@ dupe_key = $property_id; diff --git a/src/Psalm/Issue/PossiblyUnusedReturnValue.php b/src/Psalm/Issue/PossiblyUnusedReturnValue.php index 975b3f9a228..c16ca5ca614 100644 --- a/src/Psalm/Issue/PossiblyUnusedReturnValue.php +++ b/src/Psalm/Issue/PossiblyUnusedReturnValue.php @@ -1,5 +1,7 @@ property_id = $property_id; diff --git a/src/Psalm/Issue/PropertyNotSetInConstructor.php b/src/Psalm/Issue/PropertyNotSetInConstructor.php index 187a48f9347..1c057ec3422 100644 --- a/src/Psalm/Issue/PropertyNotSetInConstructor.php +++ b/src/Psalm/Issue/PropertyNotSetInConstructor.php @@ -1,5 +1,7 @@ dupe_key = $property_id; diff --git a/src/Psalm/Issue/PropertyTypeCoercion.php b/src/Psalm/Issue/PropertyTypeCoercion.php index 457dd52ba38..eee59f8306b 100644 --- a/src/Psalm/Issue/PropertyTypeCoercion.php +++ b/src/Psalm/Issue/PropertyTypeCoercion.php @@ -1,5 +1,7 @@ getSelectionBounds(); $snippet_bounds = $location->getSnippetBounds(); diff --git a/src/Psalm/Issue/TaintedLdap.php b/src/Psalm/Issue/TaintedLdap.php index 4ab8e32e2ff..1fb8cc55461 100644 --- a/src/Psalm/Issue/TaintedLdap.php +++ b/src/Psalm/Issue/TaintedLdap.php @@ -1,5 +1,7 @@ dupe_key = strtolower($method_id); diff --git a/src/Psalm/Issue/UnusedMethodCall.php b/src/Psalm/Issue/UnusedMethodCall.php index 067b13af8e5..0a4cf9cc945 100644 --- a/src/Psalm/Issue/UnusedMethodCall.php +++ b/src/Psalm/Issue/UnusedMethodCall.php @@ -1,5 +1,7 @@ dupe_key = $property_id; diff --git a/src/Psalm/Issue/UnusedPsalmSuppress.php b/src/Psalm/Issue/UnusedPsalmSuppress.php index 570012ae719..012ddcc90a8 100644 --- a/src/Psalm/Issue/UnusedPsalmSuppress.php +++ b/src/Psalm/Issue/UnusedPsalmSuppress.php @@ -1,5 +1,7 @@ var_name = strtolower($var_name); diff --git a/src/Psalm/IssueBuffer.php b/src/Psalm/IssueBuffer.php index 8adb31ead82..b4ed924d311 100644 --- a/src/Psalm/IssueBuffer.php +++ b/src/Psalm/IssueBuffer.php @@ -1,5 +1,7 @@ stdout_report_options) { throw new UnexpectedValueException('Cannot finish without stdout report options'); @@ -851,7 +853,7 @@ public static function printSuccessMessage(ProjectAnalyzer $project_analyzer): v public static function getOutput( array $issues_data, ReportOptions $report_options, - array $mixed_counts = [0, 0] + array $mixed_counts = [0, 0], ): string { $total_expression_count = $mixed_counts[0] + $mixed_counts[1]; $mixed_expression_count = $mixed_counts[0]; diff --git a/src/Psalm/Node/VirtualNode.php b/src/Psalm/Node/VirtualNode.php index b37dd76385f..23c4e2ce275 100644 --- a/src/Psalm/Node/VirtualNode.php +++ b/src/Psalm/Node/VirtualNode.php @@ -1,5 +1,7 @@ statements_analyzer = $statements_analyzer; } - /** - * @return false|Union - */ - public function infer(PhpParser\Node\Arg $arg) + public function infer(PhpParser\Node\Arg $arg): false|Union { $already_inferred_type = $this->statements_analyzer->node_data->getType($arg->value); diff --git a/src/Psalm/Plugin/EventHandler/AddTaintsInterface.php b/src/Psalm/Plugin/EventHandler/AddTaintsInterface.php index 66909acfeab..e00d65e8e29 100644 --- a/src/Psalm/Plugin/EventHandler/AddTaintsInterface.php +++ b/src/Psalm/Plugin/EventHandler/AddTaintsInterface.php @@ -1,5 +1,7 @@ expr = $expr; $this->context = $context; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterAnalysisEvent.php index 60db94732b0..6c95a0c7394 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterAnalysisEvent.php @@ -1,5 +1,7 @@ codebase = $codebase; $this->issues = $issues; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeAnalysisEvent.php index a6c51581eae..7b627ab9ffa 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeAnalysisEvent.php @@ -1,5 +1,7 @@ stmt = $stmt; $this->classlike_storage = $classlike_storage; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeExistenceCheckEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeExistenceCheckEvent.php index d80732bcb8b..1971f150266 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeExistenceCheckEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeExistenceCheckEvent.php @@ -1,5 +1,7 @@ fq_class_name = $fq_class_name; $this->code_location = $code_location; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeVisitEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeVisitEvent.php index 3861baf0165..709708cee26 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeVisitEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeVisitEvent.php @@ -1,5 +1,7 @@ stmt = $stmt; $this->storage = $storage; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterCodebasePopulatedEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterCodebasePopulatedEvent.php index 238bf2489b5..6082be9a1a0 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterCodebasePopulatedEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterCodebasePopulatedEvent.php @@ -1,5 +1,7 @@ expr = $expr; $this->function_id = $function_id; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterExpressionAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterExpressionAnalysisEvent.php index 25bb8dab8d3..9828b39b70a 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterExpressionAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterExpressionAnalysisEvent.php @@ -1,5 +1,7 @@ expr = $expr; $this->context = $context; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterFileAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterFileAnalysisEvent.php index ec468ced212..da204223da5 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterFileAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterFileAnalysisEvent.php @@ -1,5 +1,7 @@ statements_source = $statements_source; $this->file_context = $file_context; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterFunctionCallAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterFunctionCallAnalysisEvent.php index 96b463c7d65..673ad559beb 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterFunctionCallAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterFunctionCallAnalysisEvent.php @@ -1,5 +1,7 @@ expr = $expr; $this->function_id = $function_id; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterFunctionLikeAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterFunctionLikeAnalysisEvent.php index 2c5b1fa81cb..6a624c22dc3 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterFunctionLikeAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterFunctionLikeAnalysisEvent.php @@ -1,5 +1,7 @@ stmt = $stmt; $this->functionlike_storage = $functionlike_storage; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterMethodCallAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterMethodCallAnalysisEvent.php index b0ad1ef31d5..25a77e0b486 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterMethodCallAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterMethodCallAnalysisEvent.php @@ -1,5 +1,7 @@ expr = $expr; $this->method_id = $method_id; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterStatementAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterStatementAnalysisEvent.php index f4b5473f9df..a74edefc191 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterStatementAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterStatementAnalysisEvent.php @@ -1,5 +1,7 @@ stmt = $stmt; $this->context = $context; diff --git a/src/Psalm/Plugin/EventHandler/Event/BeforeExpressionAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/BeforeExpressionAnalysisEvent.php index e83c44e5fca..63357ee4f7b 100644 --- a/src/Psalm/Plugin/EventHandler/Event/BeforeExpressionAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/BeforeExpressionAnalysisEvent.php @@ -32,7 +32,7 @@ public function __construct( Context $context, StatementsSource $statements_source, Codebase $codebase, - array $file_replacements = [] + array $file_replacements = [], ) { $this->expr = $expr; $this->context = $context; diff --git a/src/Psalm/Plugin/EventHandler/Event/BeforeFileAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/BeforeFileAnalysisEvent.php index 249ab125b38..0dbd4441c89 100644 --- a/src/Psalm/Plugin/EventHandler/Event/BeforeFileAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/BeforeFileAnalysisEvent.php @@ -1,5 +1,7 @@ statements_source = $statements_source; $this->file_context = $file_context; diff --git a/src/Psalm/Plugin/EventHandler/Event/BeforeStatementAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/BeforeStatementAnalysisEvent.php index ccd42151eb5..4a37bd1b5d8 100644 --- a/src/Psalm/Plugin/EventHandler/Event/BeforeStatementAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/BeforeStatementAnalysisEvent.php @@ -32,7 +32,7 @@ public function __construct( Context $context, StatementsSource $statements_source, Codebase $codebase, - array $file_replacements = [] + array $file_replacements = [], ) { $this->stmt = $stmt; $this->context = $context; diff --git a/src/Psalm/Plugin/EventHandler/Event/DynamicFunctionStorageProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/DynamicFunctionStorageProviderEvent.php index 639d2746e32..de9fc4c17b5 100644 --- a/src/Psalm/Plugin/EventHandler/Event/DynamicFunctionStorageProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/DynamicFunctionStorageProviderEvent.php @@ -32,7 +32,7 @@ public function __construct( string $function_id, PhpParser\Node\Expr\FuncCall $func_call, Context $context, - CodeLocation $code_location + CodeLocation $code_location, ) { $this->statement_source = $statements_source; $this->function_id = $function_id; diff --git a/src/Psalm/Plugin/EventHandler/Event/FunctionExistenceProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/FunctionExistenceProviderEvent.php index 3edaf09322e..87389cf2b1f 100644 --- a/src/Psalm/Plugin/EventHandler/Event/FunctionExistenceProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/FunctionExistenceProviderEvent.php @@ -1,5 +1,7 @@ statements_source = $statements_source; $this->function_id = $function_id; diff --git a/src/Psalm/Plugin/EventHandler/Event/FunctionParamsProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/FunctionParamsProviderEvent.php index 23f3e05ff15..a26b95a3c1a 100644 --- a/src/Psalm/Plugin/EventHandler/Event/FunctionParamsProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/FunctionParamsProviderEvent.php @@ -1,5 +1,7 @@ statements_source = $statements_source; $this->function_id = $function_id; diff --git a/src/Psalm/Plugin/EventHandler/Event/FunctionReturnTypeProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/FunctionReturnTypeProviderEvent.php index c620637bb4d..e34e333e943 100644 --- a/src/Psalm/Plugin/EventHandler/Event/FunctionReturnTypeProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/FunctionReturnTypeProviderEvent.php @@ -1,5 +1,7 @@ statements_source = $statements_source; $this->function_id = $function_id; diff --git a/src/Psalm/Plugin/EventHandler/Event/MethodExistenceProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/MethodExistenceProviderEvent.php index ff1fb8f48e5..8c86c5e2e33 100644 --- a/src/Psalm/Plugin/EventHandler/Event/MethodExistenceProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/MethodExistenceProviderEvent.php @@ -1,5 +1,7 @@ fq_classlike_name = $fq_classlike_name; $this->method_name_lowercase = $method_name_lowercase; diff --git a/src/Psalm/Plugin/EventHandler/Event/MethodParamsProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/MethodParamsProviderEvent.php index eb366963c66..babc8ffa379 100644 --- a/src/Psalm/Plugin/EventHandler/Event/MethodParamsProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/MethodParamsProviderEvent.php @@ -1,5 +1,7 @@ fq_classlike_name = $fq_classlike_name; $this->method_name_lowercase = $method_name_lowercase; diff --git a/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php index 8e4e58bced2..f2089fa5356 100644 --- a/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php @@ -1,5 +1,7 @@ |null $template_type_parameters * @param lowercase-string $method_name_lowercase * @param lowercase-string $called_method_name_lowercase @@ -45,12 +46,12 @@ public function __construct( StatementsSource $source, string $fq_classlike_name, string $method_name_lowercase, - $stmt, + PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall $stmt, Context $context, CodeLocation $code_location, ?array $template_type_parameters = null, ?string $called_fq_classlike_name = null, - ?string $called_method_name_lowercase = null + ?string $called_method_name_lowercase = null, ) { $this->source = $source; $this->fq_classlike_name = $fq_classlike_name; @@ -120,10 +121,7 @@ public function getCalledMethodNameLowercase(): ?string return $this->called_method_name_lowercase; } - /** - * @return PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall - */ - public function getStmt() + public function getStmt(): PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall { return $this->stmt; } diff --git a/src/Psalm/Plugin/EventHandler/Event/MethodVisibilityProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/MethodVisibilityProviderEvent.php index ffdf8e54b4f..b6b46458c7a 100644 --- a/src/Psalm/Plugin/EventHandler/Event/MethodVisibilityProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/MethodVisibilityProviderEvent.php @@ -1,5 +1,7 @@ source = $source; $this->fq_classlike_name = $fq_classlike_name; diff --git a/src/Psalm/Plugin/EventHandler/Event/PropertyExistenceProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/PropertyExistenceProviderEvent.php index 20681f01e61..c71b544f535 100644 --- a/src/Psalm/Plugin/EventHandler/Event/PropertyExistenceProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/PropertyExistenceProviderEvent.php @@ -1,5 +1,7 @@ fq_classlike_name = $fq_classlike_name; $this->property_name = $property_name; diff --git a/src/Psalm/Plugin/EventHandler/Event/PropertyTypeProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/PropertyTypeProviderEvent.php index 2f147607506..035ac12dc77 100644 --- a/src/Psalm/Plugin/EventHandler/Event/PropertyTypeProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/PropertyTypeProviderEvent.php @@ -1,5 +1,7 @@ fq_classlike_name = $fq_classlike_name; $this->property_name = $property_name; diff --git a/src/Psalm/Plugin/EventHandler/Event/PropertyVisibilityProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/PropertyVisibilityProviderEvent.php index 8a99c821fc1..eaccc482f22 100644 --- a/src/Psalm/Plugin/EventHandler/Event/PropertyVisibilityProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/PropertyVisibilityProviderEvent.php @@ -1,5 +1,7 @@ source = $source; $this->fq_classlike_name = $fq_classlike_name; diff --git a/src/Psalm/Plugin/EventHandler/Event/StringInterpreterEvent.php b/src/Psalm/Plugin/EventHandler/Event/StringInterpreterEvent.php index 8d612bf721c..968d955af0d 100644 --- a/src/Psalm/Plugin/EventHandler/Event/StringInterpreterEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/StringInterpreterEvent.php @@ -1,5 +1,7 @@ show_info) { $this->issues_data = array_filter( diff --git a/src/Psalm/Report/ByIssueLevelAndTypeReport.php b/src/Psalm/Report/ByIssueLevelAndTypeReport.php index c657b415749..e3e4e54db5f 100644 --- a/src/Psalm/Report/ByIssueLevelAndTypeReport.php +++ b/src/Psalm/Report/ByIssueLevelAndTypeReport.php @@ -1,5 +1,7 @@ file_name . ':' . $data->line_from . ':' . $data->column_from; diff --git a/src/Psalm/Report/CheckstyleReport.php b/src/Psalm/Report/CheckstyleReport.php index d862923b663..52de1a73b0c 100644 --- a/src/Psalm/Report/CheckstyleReport.php +++ b/src/Psalm/Report/CheckstyleReport.php @@ -1,5 +1,7 @@ file_name . ':' . $data->line_from . ':' . $data->column_from; diff --git a/src/Psalm/Report/EmacsReport.php b/src/Psalm/Report/EmacsReport.php index c1cb008e61d..256d1082e46 100644 --- a/src/Psalm/Report/EmacsReport.php +++ b/src/Psalm/Report/EmacsReport.php @@ -1,5 +1,7 @@ name = $name; $this->type = $type; diff --git a/src/Psalm/Storage/AttributeStorage.php b/src/Psalm/Storage/AttributeStorage.php index 7b9b0e7298a..3ecab7899ac 100644 --- a/src/Psalm/Storage/AttributeStorage.php +++ b/src/Psalm/Storage/AttributeStorage.php @@ -1,5 +1,7 @@ fq_class_name = $fq_class_name; $this->args = $args; diff --git a/src/Psalm/Storage/ClassConstantStorage.php b/src/Psalm/Storage/ClassConstantStorage.php index 9c6d7cfcde5..78488412a81 100644 --- a/src/Psalm/Storage/ClassConstantStorage.php +++ b/src/Psalm/Storage/ClassConstantStorage.php @@ -1,5 +1,7 @@ visibility = $visibility; $this->location = $location; diff --git a/src/Psalm/Storage/ClassLikeStorage.php b/src/Psalm/Storage/ClassLikeStorage.php index 5be0d5221ba..12ef494ae62 100644 --- a/src/Psalm/Storage/ClassLikeStorage.php +++ b/src/Psalm/Storage/ClassLikeStorage.php @@ -1,5 +1,7 @@ hasAttribute($fq_class_name)) { return true; diff --git a/src/Psalm/Storage/CustomMetadataTrait.php b/src/Psalm/Storage/CustomMetadataTrait.php index 85a8610a690..cbb80570429 100644 --- a/src/Psalm/Storage/CustomMetadataTrait.php +++ b/src/Psalm/Storage/CustomMetadataTrait.php @@ -1,5 +1,7 @@ value = $value; $this->stmt_location = $location; diff --git a/src/Psalm/Storage/FileStorage.php b/src/Psalm/Storage/FileStorage.php index fe818ff6d86..1c505d2fc2c 100644 --- a/src/Psalm/Storage/FileStorage.php +++ b/src/Psalm/Storage/FileStorage.php @@ -1,5 +1,7 @@ name = $name; $this->by_ref = $by_ref; diff --git a/src/Psalm/Storage/FunctionLikeStorage.php b/src/Psalm/Storage/FunctionLikeStorage.php index 929e2b84d7a..8c681014934 100644 --- a/src/Psalm/Storage/FunctionLikeStorage.php +++ b/src/Psalm/Storage/FunctionLikeStorage.php @@ -1,5 +1,7 @@ $rule */ - public function __construct($var_id, array $rule) + public function __construct(string|int $var_id, array $rule) { $this->rule = $rule; $this->var_id = $var_id; @@ -36,7 +37,7 @@ public function __construct($var_id, array $rule) public function getUntemplatedCopy( TemplateResult $template_result, ?string $this_var_id, - ?Codebase $codebase + ?Codebase $codebase, ): self { $assertion_rules = []; diff --git a/src/Psalm/Storage/PropertyStorage.php b/src/Psalm/Storage/PropertyStorage.php index 745e1e50ea3..b18916c3a67 100644 --- a/src/Psalm/Storage/PropertyStorage.php +++ b/src/Psalm/Storage/PropertyStorage.php @@ -1,5 +1,7 @@ getKey(); } @@ -738,7 +740,7 @@ abstract public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): ?string; abstract public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool; @@ -756,7 +758,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { // do nothing return $this; @@ -767,7 +769,7 @@ public function replaceTemplateTypesWithStandins( */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { // do nothing return $this; diff --git a/src/Psalm/Type/Atomic/CallableTrait.php b/src/Psalm/Type/Atomic/CallableTrait.php index 4ca12639b5e..56020594677 100644 --- a/src/Psalm/Type/Atomic/CallableTrait.php +++ b/src/Psalm/Type/Atomic/CallableTrait.php @@ -1,5 +1,7 @@ value = $value; $this->params = $params; @@ -127,7 +129,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { if ($use_phpdoc_format) { if ($this instanceof TNamedObject) { @@ -182,7 +184,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): string { if ($this instanceof TNamedObject) { return parent::toNamespacedString($namespace, $aliased_classes, $this_class, true); @@ -232,7 +234,7 @@ protected function replaceCallableTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): ?array { $replaced = false; $params = $this->params; @@ -300,7 +302,7 @@ protected function replaceCallableTemplateTypesWithStandins( */ protected function replaceCallableTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): ?array { $replaced = false; diff --git a/src/Psalm/Type/Atomic/DependentType.php b/src/Psalm/Type/Atomic/DependentType.php index 98cf7a5749c..ac4c953509b 100644 --- a/src/Psalm/Type/Atomic/DependentType.php +++ b/src/Psalm/Type/Atomic/DependentType.php @@ -1,5 +1,7 @@ getKeyedArray(); @@ -240,7 +242,7 @@ protected function replaceTypeParamsTemplateTypesWithStandins( */ protected function replaceTypeParamsTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): ?array { $type_params = $this->type_params; foreach ($type_params as $offset => $type_param) { diff --git a/src/Psalm/Type/Atomic/HasIntersectionTrait.php b/src/Psalm/Type/Atomic/HasIntersectionTrait.php index 9a8bc2864e2..22d07725fcd 100644 --- a/src/Psalm/Type/Atomic/HasIntersectionTrait.php +++ b/src/Psalm/Type/Atomic/HasIntersectionTrait.php @@ -1,5 +1,7 @@ extra_types) { return ''; @@ -91,7 +93,7 @@ public function getIntersectionTypes(): array */ protected function replaceIntersectionTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): ?array { if (!$this->extra_types) { return null; @@ -137,7 +139,7 @@ protected function replaceIntersectionTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): ?array { if (!$this->extra_types) { return null; diff --git a/src/Psalm/Type/Atomic/Scalar.php b/src/Psalm/Type/Atomic/Scalar.php index 764b34af86a..739bb9bb514 100644 --- a/src/Psalm/Type/Atomic/Scalar.php +++ b/src/Psalm/Type/Atomic/Scalar.php @@ -1,5 +1,7 @@ = 7_02_00 ? ($this->extends ?? 'object') : null; } @@ -45,7 +47,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { return $this->extends ?? 'object'; } diff --git a/src/Psalm/Type/Atomic/TArray.php b/src/Psalm/Type/Atomic/TArray.php index 06477607592..5082e6a1dfa 100644 --- a/src/Psalm/Type/Atomic/TArray.php +++ b/src/Psalm/Type/Atomic/TArray.php @@ -1,5 +1,7 @@ getKey(); } @@ -119,7 +121,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { $type_params = $this->replaceTypeParamsTemplateTypesWithStandins( $template_result, diff --git a/src/Psalm/Type/Atomic/TArrayKey.php b/src/Psalm/Type/Atomic/TArrayKey.php index 07307cf25f9..b7cef140a6c 100644 --- a/src/Psalm/Type/Atomic/TArrayKey.php +++ b/src/Psalm/Type/Atomic/TArrayKey.php @@ -1,5 +1,7 @@ = 7_00_00 ? 'bool' : null; } diff --git a/src/Psalm/Type/Atomic/TCallable.php b/src/Psalm/Type/Atomic/TCallable.php index 7ef847d4ab1..36e2bf3c0e4 100644 --- a/src/Psalm/Type/Atomic/TCallable.php +++ b/src/Psalm/Type/Atomic/TCallable.php @@ -1,5 +1,7 @@ value = $value; $this->params = $params; @@ -49,7 +51,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): string { return 'callable'; } @@ -88,7 +90,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { $replaced = $this->replaceCallableTemplateTypesWithStandins( $template_result, diff --git a/src/Psalm/Type/Atomic/TCallableArray.php b/src/Psalm/Type/Atomic/TCallableArray.php index d4992523b06..559b014361d 100644 --- a/src/Psalm/Type/Atomic/TCallableArray.php +++ b/src/Psalm/Type/Atomic/TCallableArray.php @@ -1,5 +1,7 @@ = 7_02_00 ? 'object' : null; } diff --git a/src/Psalm/Type/Atomic/TCallableString.php b/src/Psalm/Type/Atomic/TCallableString.php index f9c676f47af..7a157470e43 100644 --- a/src/Psalm/Type/Atomic/TCallableString.php +++ b/src/Psalm/Type/Atomic/TCallableString.php @@ -1,5 +1,7 @@ fq_classlike_name === 'static') { return 'static::' . $this->const_name; diff --git a/src/Psalm/Type/Atomic/TClassString.php b/src/Psalm/Type/Atomic/TClassString.php index 723f8f40ca9..51641ac4d84 100644 --- a/src/Psalm/Type/Atomic/TClassString.php +++ b/src/Psalm/Type/Atomic/TClassString.php @@ -1,5 +1,7 @@ as = $as; $this->as_type = $as_type; @@ -107,7 +109,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): ?string { return 'string'; } @@ -119,7 +121,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { if ($this->as === 'object') { return 'class-string'; @@ -167,7 +169,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { if (!$this->as_type) { return $this; diff --git a/src/Psalm/Type/Atomic/TClassStringMap.php b/src/Psalm/Type/Atomic/TClassStringMap.php index d15d297f10e..e55659fd709 100644 --- a/src/Psalm/Type/Atomic/TClassStringMap.php +++ b/src/Psalm/Type/Atomic/TClassStringMap.php @@ -1,5 +1,7 @@ param_name = $param_name; $this->as_type = $as_type; @@ -68,7 +70,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { if ($use_phpdoc_format) { return (new TArray([Type::getString(), $this->value_param])) @@ -101,7 +103,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): string { return 'array'; } @@ -130,7 +132,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { $cloned = null; @@ -188,7 +190,7 @@ public function replaceTemplateTypesWithStandins( */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { $value_param = TemplateInferredTypeReplacer::replace( $this->value_param, diff --git a/src/Psalm/Type/Atomic/TClosedResource.php b/src/Psalm/Type/Atomic/TClosedResource.php index 06d419ff13c..3bde7d5508e 100644 --- a/src/Psalm/Type/Atomic/TClosedResource.php +++ b/src/Psalm/Type/Atomic/TClosedResource.php @@ -1,5 +1,7 @@ params = $params; $this->return_type = $return_type; @@ -60,7 +62,7 @@ public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { $replaced = $this->replaceCallableTemplateTypesWithArgTypes($template_result, $codebase); $intersection = $this->replaceIntersectionTemplateTypesWithArgTypes($template_result, $codebase); @@ -90,7 +92,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { $replaced = $this->replaceCallableTemplateTypesWithStandins( $template_result, diff --git a/src/Psalm/Type/Atomic/TConditional.php b/src/Psalm/Type/Atomic/TConditional.php index 9d3bbc9222b..3673a3b4847 100644 --- a/src/Psalm/Type/Atomic/TConditional.php +++ b/src/Psalm/Type/Atomic/TConditional.php @@ -1,5 +1,7 @@ param_name = $param_name; $this->defining_class = $defining_class; @@ -67,7 +69,7 @@ public function setTypes( ?Union $as_type, ?Union $conditional_type = null, ?Union $if_type = null, - ?Union $else_type = null + ?Union $else_type = null, ): self { $as_type ??= $this->as_type; $conditional_type ??= $this->conditional_type; @@ -117,7 +119,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): ?string { return null; } @@ -129,7 +131,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { return ''; } @@ -149,7 +151,7 @@ public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { $conditional = TemplateInferredTypeReplacer::replace( $this->conditional_type, diff --git a/src/Psalm/Type/Atomic/TDependentGetClass.php b/src/Psalm/Type/Atomic/TDependentGetClass.php index 168355daece..76078ad6d4b 100644 --- a/src/Psalm/Type/Atomic/TDependentGetClass.php +++ b/src/Psalm/Type/Atomic/TDependentGetClass.php @@ -1,5 +1,7 @@ value; } @@ -52,7 +54,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { return $this->value . '::' . $this->case_name; } diff --git a/src/Psalm/Type/Atomic/TFalse.php b/src/Psalm/Type/Atomic/TFalse.php index 03d1e27c05f..8929777083c 100644 --- a/src/Psalm/Type/Atomic/TFalse.php +++ b/src/Psalm/Type/Atomic/TFalse.php @@ -1,5 +1,7 @@ = 7_00_00 ? 'float' : null; } diff --git a/src/Psalm/Type/Atomic/TGenericObject.php b/src/Psalm/Type/Atomic/TGenericObject.php index 45aa50b8cee..71f1afc1768 100644 --- a/src/Psalm/Type/Atomic/TGenericObject.php +++ b/src/Psalm/Type/Atomic/TGenericObject.php @@ -1,5 +1,7 @@ toNamespacedString($namespace, $aliased_classes, $this_class, true); $intersection = strrpos($result, '&'); @@ -143,7 +145,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { $types = $this->replaceTypeParamsTemplateTypesWithStandins( $template_result, diff --git a/src/Psalm/Type/Atomic/TInt.php b/src/Psalm/Type/Atomic/TInt.php index 9cfd0de654d..5d503f02ac9 100644 --- a/src/Psalm/Type/Atomic/TInt.php +++ b/src/Psalm/Type/Atomic/TInt.php @@ -1,5 +1,7 @@ = 7_00_00 ? 'int' : null; } diff --git a/src/Psalm/Type/Atomic/TIntMask.php b/src/Psalm/Type/Atomic/TIntMask.php index e6e57539022..b5686ae83bc 100644 --- a/src/Psalm/Type/Atomic/TIntMask.php +++ b/src/Psalm/Type/Atomic/TIntMask.php @@ -1,5 +1,7 @@ min_bound = $min_bound; $this->max_bound = $max_bound; @@ -56,7 +58,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { return $use_phpdoc_format ? 'int' : diff --git a/src/Psalm/Type/Atomic/TIterable.php b/src/Psalm/Type/Atomic/TIterable.php index 6b6c9ea32ab..93d1caa8875 100644 --- a/src/Psalm/Type/Atomic/TIterable.php +++ b/src/Psalm/Type/Atomic/TIterable.php @@ -1,5 +1,7 @@ = 7_01_00 ? 'iterable' : null; } @@ -160,7 +162,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { $types = $this->replaceTypeParamsTemplateTypesWithStandins( $template_result, diff --git a/src/Psalm/Type/Atomic/TKeyOf.php b/src/Psalm/Type/Atomic/TKeyOf.php index 09762e732f9..b4335a81562 100644 --- a/src/Psalm/Type/Atomic/TKeyOf.php +++ b/src/Psalm/Type/Atomic/TKeyOf.php @@ -1,5 +1,7 @@ getGenericArrayType()->toNamespacedString( @@ -291,7 +293,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): string { return 'array'; } @@ -509,7 +511,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { if ($input_type instanceof TKeyedArray && $input_type->is_list @@ -610,7 +612,7 @@ public function replaceTemplateTypesWithStandins( */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { $properties = $this->properties; foreach ($properties as $offset => $property) { @@ -699,11 +701,7 @@ public function getList(): TList : new TList($this->getGenericValueType()); } - /** - * @param string|int $name - * @return string|int - */ - private function escapeAndQuote($name) + private function escapeAndQuote(string|int $name): string|int { if (is_string($name)) { $quote = false; diff --git a/src/Psalm/Type/Atomic/TList.php b/src/Psalm/Type/Atomic/TList.php index 13c44e5b453..d4d166b65af 100644 --- a/src/Psalm/Type/Atomic/TList.php +++ b/src/Psalm/Type/Atomic/TList.php @@ -1,5 +1,7 @@ type_param])) @@ -104,7 +106,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): string { return 'array'; } @@ -133,7 +135,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { $cloned = null; @@ -190,7 +192,7 @@ public function replaceTemplateTypesWithStandins( */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { return $this->setTypeParam(TemplateInferredTypeReplacer::replace( $this->type_param, diff --git a/src/Psalm/Type/Atomic/TLiteralClassString.php b/src/Psalm/Type/Atomic/TLiteralClassString.php index c5483511c9e..b7936a488c7 100644 --- a/src/Psalm/Type/Atomic/TLiteralClassString.php +++ b/src/Psalm/Type/Atomic/TLiteralClassString.php @@ -1,5 +1,7 @@ value; } diff --git a/src/Psalm/Type/Atomic/TLiteralString.php b/src/Psalm/Type/Atomic/TLiteralString.php index 6a622887d55..6da01c89674 100644 --- a/src/Psalm/Type/Atomic/TLiteralString.php +++ b/src/Psalm/Type/Atomic/TLiteralString.php @@ -1,5 +1,7 @@ value . "'"; } diff --git a/src/Psalm/Type/Atomic/TLowercaseString.php b/src/Psalm/Type/Atomic/TLowercaseString.php index b65ac5e9dcb..f9eac221716 100644 --- a/src/Psalm/Type/Atomic/TLowercaseString.php +++ b/src/Psalm/Type/Atomic/TLowercaseString.php @@ -1,5 +1,7 @@ = 8_00_00 ? 'mixed' : null; } diff --git a/src/Psalm/Type/Atomic/TNamedObject.php b/src/Psalm/Type/Atomic/TNamedObject.php index ee7c5d38ea5..daf9571e7fd 100644 --- a/src/Psalm/Type/Atomic/TNamedObject.php +++ b/src/Psalm/Type/Atomic/TNamedObject.php @@ -1,5 +1,7 @@ value === 'static') { return 'static'; @@ -178,7 +180,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): ?string { if ($this->value === 'static') { return $analysis_php_version_id >= 8_00_00 ? 'static' : null; @@ -206,7 +208,7 @@ public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { $intersection = $this->replaceIntersectionTemplateTypesWithArgTypes($template_result, $codebase); if (!$intersection) { @@ -230,7 +232,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { $intersection = $this->replaceIntersectionTemplateTypesWithStandins( $template_result, @@ -264,7 +266,7 @@ public static function createFromName( bool $is_static = false, bool $definite_class = false, array $extra_types = [], - bool $from_docblock = false + bool $from_docblock = false, ): TNamedObject { if ($value === 'Closure') { return new TClosure($value, null, null, null, [], $extra_types, $from_docblock); diff --git a/src/Psalm/Type/Atomic/TNever.php b/src/Psalm/Type/Atomic/TNever.php index 397424b860a..a9918aeb8e2 100644 --- a/src/Psalm/Type/Atomic/TNever.php +++ b/src/Psalm/Type/Atomic/TNever.php @@ -1,5 +1,7 @@ count = $count; $this->min_count = $min_count; diff --git a/src/Psalm/Type/Atomic/TNonEmptyList.php b/src/Psalm/Type/Atomic/TNonEmptyList.php index 47c628ccd7e..f9134fee8d2 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyList.php +++ b/src/Psalm/Type/Atomic/TNonEmptyList.php @@ -1,5 +1,7 @@ count = $count; $this->min_count = $min_count; diff --git a/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php b/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php index a72f2a6e811..e9872592e9b 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php +++ b/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php @@ -1,5 +1,7 @@ = 7_02_00 ? $this->getKey() : null; } diff --git a/src/Psalm/Type/Atomic/TObjectWithProperties.php b/src/Psalm/Type/Atomic/TObjectWithProperties.php index cae5be7e7f7..96dcc33a062 100644 --- a/src/Psalm/Type/Atomic/TObjectWithProperties.php +++ b/src/Psalm/Type/Atomic/TObjectWithProperties.php @@ -1,5 +1,7 @@ properties = $properties; $this->methods = $methods; @@ -140,7 +142,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { if ($use_phpdoc_format) { return 'object'; @@ -178,7 +180,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): string { return $this->getKey(); } @@ -228,7 +230,7 @@ public function replaceTemplateTypesWithStandins( ?string $calling_function = null, bool $replace = true, bool $add_lower_bound = false, - int $depth = 0 + int $depth = 0, ): self { $properties = []; @@ -280,7 +282,7 @@ public function replaceTemplateTypesWithStandins( */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { $properties = $this->properties; foreach ($properties as $offset => $property) { diff --git a/src/Psalm/Type/Atomic/TPropertiesOf.php b/src/Psalm/Type/Atomic/TPropertiesOf.php index 49da46df53d..89707bfc9c3 100644 --- a/src/Psalm/Type/Atomic/TPropertiesOf.php +++ b/src/Psalm/Type/Atomic/TPropertiesOf.php @@ -1,5 +1,7 @@ classlike_type = $classlike_type; $this->visibility_filter = $visibility_filter; @@ -104,7 +106,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): string { return $this->getKey(); } diff --git a/src/Psalm/Type/Atomic/TResource.php b/src/Psalm/Type/Atomic/TResource.php index 1d99eef800c..b01a0987bde 100644 --- a/src/Psalm/Type/Atomic/TResource.php +++ b/src/Psalm/Type/Atomic/TResource.php @@ -1,5 +1,7 @@ = 7_00_00 ? 'string' : null; } diff --git a/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php b/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php index 80c7db23408..ac2442834af 100644 --- a/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php +++ b/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php @@ -1,5 +1,7 @@ array_param_name = $array_param_name; $this->offset_param_name = $offset_param_name; @@ -48,7 +50,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): ?string { return null; } diff --git a/src/Psalm/Type/Atomic/TTemplateKeyOf.php b/src/Psalm/Type/Atomic/TTemplateKeyOf.php index debb1fc8fa1..50f20ff1e13 100644 --- a/src/Psalm/Type/Atomic/TTemplateKeyOf.php +++ b/src/Psalm/Type/Atomic/TTemplateKeyOf.php @@ -1,5 +1,7 @@ param_name = $param_name; $this->defining_class = $defining_class; @@ -63,7 +65,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { return 'key-of<' . $this->param_name . '>'; } @@ -75,7 +77,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): ?string { return null; } @@ -90,7 +92,7 @@ public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { $as = TemplateInferredTypeReplacer::replace( $this->as, diff --git a/src/Psalm/Type/Atomic/TTemplateParam.php b/src/Psalm/Type/Atomic/TTemplateParam.php index f1bb94b88be..d896b87b817 100644 --- a/src/Psalm/Type/Atomic/TTemplateParam.php +++ b/src/Psalm/Type/Atomic/TTemplateParam.php @@ -1,5 +1,7 @@ param_name = $param_name; $this->as = $extends; @@ -103,7 +105,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): ?string { return null; } @@ -115,7 +117,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { if ($use_phpdoc_format) { return $this->as->toNamespacedString( @@ -151,7 +153,7 @@ public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { $intersection = $this->replaceIntersectionTemplateTypesWithArgTypes($template_result, $codebase); if (!$intersection) { diff --git a/src/Psalm/Type/Atomic/TTemplateParamClass.php b/src/Psalm/Type/Atomic/TTemplateParamClass.php index ccf40a27c8c..488a8e382dd 100644 --- a/src/Psalm/Type/Atomic/TTemplateParamClass.php +++ b/src/Psalm/Type/Atomic/TTemplateParamClass.php @@ -1,5 +1,7 @@ param_name = $param_name; $this->defining_class = $defining_class; @@ -61,7 +63,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { return $this->param_name . '::class'; } diff --git a/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php b/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php index 9dbc710c147..d629f704fb6 100644 --- a/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php +++ b/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php @@ -1,5 +1,7 @@ param_name = $param_name; $this->defining_class = $defining_class; @@ -70,7 +72,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): string { return $this->getKey(); } @@ -85,7 +87,7 @@ public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { $param = new TTemplateParam( $this->as->param_name, diff --git a/src/Psalm/Type/Atomic/TTemplateValueOf.php b/src/Psalm/Type/Atomic/TTemplateValueOf.php index 6d00b32ea8c..895a532ef13 100644 --- a/src/Psalm/Type/Atomic/TTemplateValueOf.php +++ b/src/Psalm/Type/Atomic/TTemplateValueOf.php @@ -1,5 +1,7 @@ param_name = $param_name; $this->defining_class = $defining_class; @@ -63,7 +65,7 @@ public function toNamespacedString( ?string $namespace, array $aliased_classes, ?string $this_class, - bool $use_phpdoc_format + bool $use_phpdoc_format, ): string { return 'value-of<' . $this->param_name . '>'; } @@ -75,7 +77,7 @@ public function toPhpString( ?string $namespace, array $aliased_classes, ?string $this_class, - int $analysis_php_version_id + int $analysis_php_version_id, ): ?string { return null; } @@ -90,7 +92,7 @@ public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool */ public function replaceTemplateTypesWithArgTypes( TemplateResult $template_result, - ?Codebase $codebase + ?Codebase $codebase, ): self { $as = TemplateInferredTypeReplacer::replace( $this->as, diff --git a/src/Psalm/Type/Atomic/TTraitString.php b/src/Psalm/Type/Atomic/TTraitString.php index 07f38880e2a..fbad80e98a0 100644 --- a/src/Psalm/Type/Atomic/TTraitString.php +++ b/src/Psalm/Type/Atomic/TTraitString.php @@ -1,5 +1,7 @@ = 7_01_00 ? $this->getKey() : null; } diff --git a/src/Psalm/Type/MutableTypeVisitor.php b/src/Psalm/Type/MutableTypeVisitor.php index a61f69dad9f..c081f35ccce 100644 --- a/src/Psalm/Type/MutableTypeVisitor.php +++ b/src/Psalm/Type/MutableTypeVisitor.php @@ -1,5 +1,7 @@ hasMixed() && !$this->isEmptyMixed()) { return $this; diff --git a/src/Psalm/Type/Reconciler.php b/src/Psalm/Type/Reconciler.php index 8d36c9990db..1f2bebbfe5a 100644 --- a/src/Psalm/Type/Reconciler.php +++ b/src/Psalm/Type/Reconciler.php @@ -1,5 +1,7 @@ by_ref) { return $this; diff --git a/src/Psalm/Type/UnionTrait.php b/src/Psalm/Type/UnionTrait.php index 3361c2ba873..c294e17b357 100644 --- a/src/Psalm/Type/UnionTrait.php +++ b/src/Psalm/Type/UnionTrait.php @@ -1,5 +1,7 @@ isSingleAndMaybeNullable()) { if ($analysis_php_version_id < 8_00_00) { @@ -1214,9 +1216,8 @@ public function isSingleLiteral(): bool /** * @psalm-mutation-free - * @return TLiteralInt|TLiteralString|TLiteralFloat */ - public function getSingleLiteral() + public function getSingleLiteral(): TLiteralInt|TLiteralString|TLiteralFloat { if (!$this->isSingleLiteral()) { throw new InvalidArgumentException("Not a single literal"); @@ -1281,7 +1282,7 @@ public function check( bool $inferred = true, bool $inherited = false, bool $prevent_template_covariance = false, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { if ($this->checked) { return true; @@ -1312,7 +1313,7 @@ public function check( public function queueClassLikesForScanning( Codebase $codebase, ?FileStorage $file_storage = null, - array $phantom_classes = [] + array $phantom_classes = [], ): void { $scanner_visitor = new TypeScanner( $codebase->scanner, @@ -1383,7 +1384,7 @@ public function equals( self $other_type, bool $ensure_source_equality = true, bool $ensure_parent_node_equality = true, - bool $ensure_possibly_undefined_equality = true + bool $ensure_possibly_undefined_equality = true, ): bool { if ($other_type === $this) { return true; diff --git a/tests/Cache/CacheTest.php b/tests/Cache/CacheTest.php index 0efce1c6876..cc81d4a604f 100644 --- a/tests/Cache/CacheTest.php +++ b/tests/Cache/CacheTest.php @@ -65,7 +65,7 @@ private static function normalizeIssueData(array $issue_data): array * @dataProvider provideCacheInteractions */ public function testCacheInteractions( - array $interactions + array $interactions, ): void { $config = Config::loadFromXML( __DIR__ . DIRECTORY_SEPARATOR . 'test_base_dir', diff --git a/tests/ComposerLockTest.php b/tests/ComposerLockTest.php index a17225c6a2e..b99c7fce283 100644 --- a/tests/ComposerLockTest.php +++ b/tests/ComposerLockTest.php @@ -212,10 +212,9 @@ private function pluginEntry(string $package_name, string $package_class): array } /** - * @param mixed $data * @psalm-pure */ - private function jsonFile($data): string + private function jsonFile(mixed $data): string { return 'data:application/json,' . json_encode($data, JSON_THROW_ON_ERROR); } diff --git a/tests/Config/Plugin/Hook/CustomArrayMapFunctionStorageProvider.php b/tests/Config/Plugin/Hook/CustomArrayMapFunctionStorageProvider.php index a491d9ecf1b..3f9c69b6570 100644 --- a/tests/Config/Plugin/Hook/CustomArrayMapFunctionStorageProvider.php +++ b/tests/Config/Plugin/Hook/CustomArrayMapFunctionStorageProvider.php @@ -108,7 +108,7 @@ private static function toValueType(Codebase $codebase, Union $array_like_type): private static function createExpectedCallable( Union $input_type, DynamicTemplateProvider $template_provider, - int $return_template_offset = 0 + int $return_template_offset = 0, ): TCallable { return new TCallable( 'callable', @@ -124,7 +124,7 @@ private static function createExpectedCallable( */ private static function createRestCallables( DynamicTemplateProvider $template_provider, - int $expected_callable_args_count + int $expected_callable_args_count, ): array { $rest_callable_params = []; @@ -160,7 +160,7 @@ private static function createReturnType(array $all_expected_callables): Union */ private static function createTemplates( DynamicTemplateProvider $template_provider, - int $expected_callable_count + int $expected_callable_count, ): array { $template_params = []; diff --git a/tests/Config/PluginListTest.php b/tests/Config/PluginListTest.php index e10e482af10..6a5224ea11a 100644 --- a/tests/Config/PluginListTest.php +++ b/tests/Config/PluginListTest.php @@ -18,14 +18,11 @@ class PluginListTest extends TestCase { use MockeryPHPUnitIntegration; - /** @var ConfigFile&MockInterface */ - private $config_file; + private ConfigFile&MockInterface $config_file; - /** @var Config&MockInterface */ - private $config; + private Config&MockInterface $config; - /** @var ComposerLock&MockInterface */ - private $composer_lock; + private ComposerLock&MockInterface $composer_lock; public function setUp(): void { diff --git a/tests/DocumentationTest.php b/tests/DocumentationTest.php index 653e25f2004..1e0eb7852f9 100644 --- a/tests/DocumentationTest.php +++ b/tests/DocumentationTest.php @@ -403,18 +403,12 @@ public function toString(): string return $this->inner->toString(); } - /** - * @param mixed $other - */ - protected function matches($other): bool + protected function matches(mixed $other): bool { return $this->inner->matches($other); } - /** - * @param mixed $other - */ - protected function failureDescription($other): string + protected function failureDescription(mixed $other): string { return $this->exporter()->shortenedExport($other) . ' ' . $this->toString(); } diff --git a/tests/EndToEnd/PsalmRunnerTrait.php b/tests/EndToEnd/PsalmRunnerTrait.php index 03e7f714ec2..8e8190ec9bb 100644 --- a/tests/EndToEnd/PsalmRunnerTrait.php +++ b/tests/EndToEnd/PsalmRunnerTrait.php @@ -22,7 +22,7 @@ private function runPsalm( array $args, string $workingDir, bool $shouldFail = false, - bool $relyOnConfigDir = true + bool $relyOnConfigDir = true, ): array { // Ensure CI agnostic output if (!in_array('--init', $args, true) && !in_array('--alter', $args, true)) { diff --git a/tests/ErrorBaselineTest.php b/tests/ErrorBaselineTest.php index 3b4741f5883..6a85520acae 100644 --- a/tests/ErrorBaselineTest.php +++ b/tests/ErrorBaselineTest.php @@ -21,8 +21,7 @@ class ErrorBaselineTest extends TestCase { use MockeryPHPUnitIntegration; - /** @var FileProvider&MockInterface */ - private $fileProvider; + private FileProvider&MockInterface $fileProvider; public function setUp(): void { diff --git a/tests/FileDiffTest.php b/tests/FileDiffTest.php index acc84f404bb..1fde22a0b32 100644 --- a/tests/FileDiffTest.php +++ b/tests/FileDiffTest.php @@ -27,7 +27,7 @@ public function testCode( array $same_signatures, array $changed_methods, array $diff_map_offsets, - array $deletion_ranges + array $deletion_ranges, ): void { if (strpos($this->getTestName(), 'SKIPPED-') !== false) { $this->markTestSkipped(); @@ -84,7 +84,7 @@ public function testPartialAstDiff( array $same_methods, array $same_signatures, array $changed_methods, - array $diff_map_offsets + array $diff_map_offsets, ): void { if (strpos($this->getTestName(), 'SKIPPED-') !== false) { $this->markTestSkipped(); diff --git a/tests/FileManipulation/ClassConstantMoveTest.php b/tests/FileManipulation/ClassConstantMoveTest.php index f06239abb0a..58579d0b01d 100644 --- a/tests/FileManipulation/ClassConstantMoveTest.php +++ b/tests/FileManipulation/ClassConstantMoveTest.php @@ -31,7 +31,7 @@ public function setUp(): void public function testValidCode( string $input_code, string $output_code, - array $constants_to_move + array $constants_to_move, ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { diff --git a/tests/FileManipulation/ClassMoveTest.php b/tests/FileManipulation/ClassMoveTest.php index e49e0cf87f8..a0b4dbf914d 100644 --- a/tests/FileManipulation/ClassMoveTest.php +++ b/tests/FileManipulation/ClassMoveTest.php @@ -31,7 +31,7 @@ public function setUp(): void public function testValidCode( string $input_code, string $output_code, - array $constants_to_move + array $constants_to_move, ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { diff --git a/tests/FileManipulation/FileManipulationTestCase.php b/tests/FileManipulation/FileManipulationTestCase.php index de361f6ffd2..f662ede7926 100644 --- a/tests/FileManipulation/FileManipulationTestCase.php +++ b/tests/FileManipulation/FileManipulationTestCase.php @@ -34,7 +34,7 @@ public function testValidCode( string $php_version, array $issues_to_fix, bool $safe_types, - bool $allow_backwards_incompatible_changes = true + bool $allow_backwards_incompatible_changes = true, ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { diff --git a/tests/FileManipulation/MethodMoveTest.php b/tests/FileManipulation/MethodMoveTest.php index 4e97bb863db..7fce5f10ca4 100644 --- a/tests/FileManipulation/MethodMoveTest.php +++ b/tests/FileManipulation/MethodMoveTest.php @@ -31,7 +31,7 @@ public function setUp(): void public function testValidCode( string $input_code, string $output_code, - array $methods_to_move + array $methods_to_move, ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { diff --git a/tests/FileManipulation/NamespaceMoveTest.php b/tests/FileManipulation/NamespaceMoveTest.php index 11920d2d6c5..787a6c8b45c 100644 --- a/tests/FileManipulation/NamespaceMoveTest.php +++ b/tests/FileManipulation/NamespaceMoveTest.php @@ -31,7 +31,7 @@ public function setUp(): void public function testValidCode( string $input_code, string $output_code, - array $namespaces_to_move + array $namespaces_to_move, ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { diff --git a/tests/FileManipulation/PropertyMoveTest.php b/tests/FileManipulation/PropertyMoveTest.php index b485cbb7cae..858619b09fd 100644 --- a/tests/FileManipulation/PropertyMoveTest.php +++ b/tests/FileManipulation/PropertyMoveTest.php @@ -31,7 +31,7 @@ public function setUp(): void public function testValidCode( string $input_code, string $output_code, - array $properties_to_move + array $properties_to_move, ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { diff --git a/tests/FileReferenceTest.php b/tests/FileReferenceTest.php index a17172d8628..b05abd88f79 100644 --- a/tests/FileReferenceTest.php +++ b/tests/FileReferenceTest.php @@ -85,7 +85,7 @@ public function testReferencedMethods( array $expected_method_references_to_members, array $expected_method_references_to_missing_members, array $expected_file_references_to_members, - array $expected_file_references_to_missing_members + array $expected_file_references_to_missing_members, ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { diff --git a/tests/FileUpdates/AnalyzedMethodTest.php b/tests/FileUpdates/AnalyzedMethodTest.php index e965084ae2b..43a4eb8e87e 100644 --- a/tests/FileUpdates/AnalyzedMethodTest.php +++ b/tests/FileUpdates/AnalyzedMethodTest.php @@ -55,7 +55,7 @@ public function testValidInclude( array $end_files, array $initial_analyzed_methods, array $unaffected_analyzed_methods, - array $ignored_issues = [] + array $ignored_issues = [], ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'SKIPPED-') !== false) { diff --git a/tests/FileUpdates/ErrorAfterUpdateTest.php b/tests/FileUpdates/ErrorAfterUpdateTest.php index 2698c80a701..b06fd6821fe 100644 --- a/tests/FileUpdates/ErrorAfterUpdateTest.php +++ b/tests/FileUpdates/ErrorAfterUpdateTest.php @@ -54,7 +54,7 @@ public function setUp(): void public function testErrorAfterUpdate( array $file_stages, string $error_message, - array $ignored_issues = [] + array $ignored_issues = [], ): void { $this->project_analyzer->getCodebase()->diff_methods = true; $this->project_analyzer->getCodebase()->reportUnusedCode(); diff --git a/tests/FileUpdates/ErrorFixTest.php b/tests/FileUpdates/ErrorFixTest.php index 875ecdabdaa..0a30e3b389d 100644 --- a/tests/FileUpdates/ErrorFixTest.php +++ b/tests/FileUpdates/ErrorFixTest.php @@ -55,7 +55,7 @@ public function setUp(): void public function testErrorFix( array $files, array $error_counts, - array $ignored_issues = [] + array $ignored_issues = [], ): void { $this->project_analyzer->getCodebase()->diff_methods = true; diff --git a/tests/FileUpdates/TemporaryUpdateTest.php b/tests/FileUpdates/TemporaryUpdateTest.php index 5acae2112f9..7ecb023f914 100644 --- a/tests/FileUpdates/TemporaryUpdateTest.php +++ b/tests/FileUpdates/TemporaryUpdateTest.php @@ -71,7 +71,7 @@ public function testErrorFix( array $error_positions, array $ignored_issues = [], bool $test_save = true, - bool $check_unused_code = false + bool $check_unused_code = false, ): void { $codebase = $this->codebase; $codebase->diff_methods = true; diff --git a/tests/IncludeTest.php b/tests/IncludeTest.php index c6a3eddbf5f..9be667aa707 100644 --- a/tests/IncludeTest.php +++ b/tests/IncludeTest.php @@ -24,7 +24,7 @@ public function testValidInclude( array $files, array $files_to_check, bool $hoist_constants = false, - array $ignored_issues = [] + array $ignored_issues = [], ): void { $codebase = $this->project_analyzer->getCodebase(); @@ -64,7 +64,7 @@ public function testInvalidInclude( array $files, array $files_to_check, string $error_message, - array $directories = [] + array $directories = [], ): void { if (strpos($this->getTestName(), 'SKIPPED-') !== false) { $this->markTestSkipped(); diff --git a/tests/Internal/Scanner/FileScannerTest.php b/tests/Internal/Scanner/FileScannerTest.php index bb2b9ee91f7..aee37010b6f 100644 --- a/tests/Internal/Scanner/FileScannerTest.php +++ b/tests/Internal/Scanner/FileScannerTest.php @@ -21,7 +21,7 @@ class FileScannerTest extends TestCase public function testScan( Config $config, string $file_contents, - FileStorage $expected_file_storage + FileStorage $expected_file_storage, ): void { $file_provider = new FakeFileProvider(); $codebase = new Codebase( diff --git a/tests/JsonOutputTest.php b/tests/JsonOutputTest.php index c20d7b9d721..fd90bb5be60 100644 --- a/tests/JsonOutputTest.php +++ b/tests/JsonOutputTest.php @@ -49,7 +49,7 @@ public function testJsonOutputErrors( int $error_count, string $message, int $line_number, - string $error + string $error, ): void { $this->addFile('somefile.php', $code); $this->analyzeFile('somefile.php', new Context()); diff --git a/tests/LanguageServer/SymbolLookupTest.php b/tests/LanguageServer/SymbolLookupTest.php index d235bc33442..4b3707bf5f7 100644 --- a/tests/LanguageServer/SymbolLookupTest.php +++ b/tests/LanguageServer/SymbolLookupTest.php @@ -626,7 +626,7 @@ public function testGetSignatureHelp( Position $position, ?string $expected_symbol, ?int $expected_argument_number, - ?int $expected_param_count + ?int $expected_param_count, ): void { $config = $this->codebase->config; $config->throw_exception = false; diff --git a/tests/PsalmPluginTest.php b/tests/PsalmPluginTest.php index b6b2515d711..ad5a57cadfb 100644 --- a/tests/PsalmPluginTest.php +++ b/tests/PsalmPluginTest.php @@ -23,11 +23,9 @@ class PsalmPluginTest extends TestCase { use MockeryPHPUnitIntegration; - /** @var PluginList&MockInterface */ - private $plugin_list; + private PluginList&MockInterface $plugin_list; - /** @var PluginListFactory&MockInterface */ - private $plugin_list_factory; + private PluginListFactory&MockInterface $plugin_list_factory; private Application $app; diff --git a/tests/Traits/InvalidCodeAnalysisTestTrait.php b/tests/Traits/InvalidCodeAnalysisTestTrait.php index f37d0033584..17a5453556f 100644 --- a/tests/Traits/InvalidCodeAnalysisTestTrait.php +++ b/tests/Traits/InvalidCodeAnalysisTestTrait.php @@ -49,7 +49,7 @@ public function testInvalidCode( string $code, string $error_message, array $error_levels = [], - string $php_version = '7.4' + string $php_version = '7.4', ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'PHP80-') !== false) { diff --git a/tests/Traits/ValidCodeAnalysisTestTrait.php b/tests/Traits/ValidCodeAnalysisTestTrait.php index 7a76481d275..4e2f62b3c46 100644 --- a/tests/Traits/ValidCodeAnalysisTestTrait.php +++ b/tests/Traits/ValidCodeAnalysisTestTrait.php @@ -40,7 +40,7 @@ public function testValidCode( string $code, array $assertions = [], array $ignored_issues = [], - string $php_version = '7.4' + string $php_version = '7.4', ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'PHP80-') !== false) { diff --git a/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php b/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php index 08e2eb1a907..a1a51d1ed4a 100644 --- a/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php +++ b/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php @@ -1,4 +1,4 @@ - Date: Mon, 24 Jul 2023 10:51:25 +0200 Subject: [PATCH 02/38] Fix --- tests/TestConfig.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/TestConfig.php b/tests/TestConfig.php index dc72087410f..967e4db1de6 100644 --- a/tests/TestConfig.php +++ b/tests/TestConfig.php @@ -57,10 +57,7 @@ protected function getContents(): string '; } - /** - * @return false - */ - public function getComposerFilePathForClassLike(string $fq_classlike_name): bool + public function getComposerFilePathForClassLike(string $fq_classlike_name): string|false { return false; } From 79751640697918ce3e8bf5e1361b5eb67dcf2737 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 24 Jul 2023 11:11:32 +0200 Subject: [PATCH 03/38] Small fix --- src/Psalm/Config.php | 3 +-- tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 9f8fcc61858..48d04d728f9 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -1330,8 +1330,7 @@ private static function fromXmlAndPaths( if (isset($config_xml->universalObjectCrates) && isset($config_xml->universalObjectCrates->class)) { /** @var SimpleXMLElement $universal_object_crate */ foreach ($config_xml->universalObjectCrates->class as $universal_object_crate) { - /** @var string $classString */ - $classString = $universal_object_crate['name']; + $classString = (string) $universal_object_crate['name']; $config->addUniversalObjectCrate($classString); } } diff --git a/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php b/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php index a1a51d1ed4a..08e2eb1a907 100644 --- a/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php +++ b/tests/fixtures/DummyProjectWithErrors/src/FileWithErrors.php @@ -1,4 +1,4 @@ - Date: Mon, 24 Jul 2023 13:49:28 +0200 Subject: [PATCH 04/38] Fix scanning of intersection types --- src/Psalm/Internal/Codebase/ClassLikes.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 696b0413ae1..b54e09b185a 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -367,8 +367,6 @@ public function hasFullyQualifiedClassName( && !$this->classlike_storage_provider->has($fq_class_name_lc) ) { if (!isset($this->existing_classes_lc[$fq_class_name_lc])) { - $this->existing_classes_lc[$fq_class_name_lc] = false; - return false; } From 93443f292ca76f47cdc44cab79d807f6771b6e97 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 24 Jul 2023 14:10:59 +0200 Subject: [PATCH 05/38] Small fix --- src/Psalm/Config/FileFilter.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Config/FileFilter.php b/src/Psalm/Config/FileFilter.php index 4115fa70ef6..dc6bd55f498 100644 --- a/src/Psalm/Config/FileFilter.php +++ b/src/Psalm/Config/FileFilter.php @@ -290,7 +290,11 @@ public static function loadFromArray( $file_path = realpath($prospective_file_path); - if (!$file_path && !$allow_missing_files) { + if (!$file_path) { + if ($allow_missing_files) { + continue; + } + throw new ConfigException( 'Could not resolve config path to ' . $prospective_file_path, ); From 1ad9fc66f8d3f332a398d6d23cf3d0f91a604f79 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 10:09:29 +0200 Subject: [PATCH 06/38] Fixes --- .github/workflows/windows-ci.yml | 2 +- composer.json | 2 +- src/Psalm/Internal/Codebase/ClassLikes.php | 10 ++++++---- tests/TypeReconciliation/ReconcilerTest.php | 2 ++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 5b6a06c4e08..f8415667bc8 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -96,4 +96,4 @@ jobs: run: php bin/generate_testsuites.php $env:CHUNK_COUNT - name: Run unit tests - run: vendor/bin/paratest --processes=$env:PARALLEL_PROCESSES --testsuite=chunk_$env:CHUNK_NUMBER --log-junit build/phpunit/phpunit.xml + run: vendor/bin/paratest -f --processes=$env:PARALLEL_PROCESSES --testsuite=chunk_$env:CHUNK_NUMBER --log-junit build/phpunit/phpunit.xml diff --git a/composer.json b/composer.json index 7f4a9f9c8a9..f9b774b8ad0 100644 --- a/composer.json +++ b/composer.json @@ -112,7 +112,7 @@ "lint": "parallel-lint ./src ./tests", "phpunit": [ "Composer\\Config::disableProcessTimeout", - "paratest --runner=WrapperRunner" + "paratest -f --runner=WrapperRunner" ], "phpunit-std": [ "Composer\\Config::disableProcessTimeout", diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index b54e09b185a..fa92b057d47 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -367,6 +367,8 @@ public function hasFullyQualifiedClassName( && !$this->classlike_storage_provider->has($fq_class_name_lc) ) { if (!isset($this->existing_classes_lc[$fq_class_name_lc])) { + $this->existing_classes_lc[$fq_class_name_lc] = false; + return false; } @@ -399,8 +401,8 @@ public function hasFullyQualifiedInterfaceName( || !$this->classlike_storage_provider->has($fq_class_name_lc) ) { if (( - !isset($this->existing_classes_lc[$fq_class_name_lc]) - || $this->existing_classes_lc[$fq_class_name_lc] + !isset($this->existing_interfaces_lc[$fq_class_name_lc]) + || $this->existing_interfaces_lc[$fq_class_name_lc] ) && !$this->classlike_storage_provider->has($fq_class_name_lc) ) { @@ -466,8 +468,8 @@ public function hasFullyQualifiedEnumName( || !$this->classlike_storage_provider->has($fq_class_name_lc) ) { if (( - !isset($this->existing_classes_lc[$fq_class_name_lc]) - || $this->existing_classes_lc[$fq_class_name_lc] + !isset($this->existing_enums_lc[$fq_class_name_lc]) + || $this->existing_enums_lc[$fq_class_name_lc] ) && !$this->classlike_storage_provider->has($fq_class_name_lc) ) { diff --git a/tests/TypeReconciliation/ReconcilerTest.php b/tests/TypeReconciliation/ReconcilerTest.php index a3b722ff3fd..10ca3b22e3a 100644 --- a/tests/TypeReconciliation/ReconcilerTest.php +++ b/tests/TypeReconciliation/ReconcilerTest.php @@ -2,6 +2,7 @@ namespace Psalm\Tests\TypeReconciliation; +use Countable; use Psalm\Context; use Psalm\Internal\Analyzer\FileAnalyzer; use Psalm\Internal\Analyzer\StatementsAnalyzer; @@ -61,6 +62,7 @@ class A {} class B {} interface SomeInterface {} '); + $this->project_analyzer->getCodebase()->queueClassLikeForScanning(Countable::class); $this->project_analyzer->getCodebase()->scanFiles(); } From 8cc5af9592d4c22727ece0106f1e703934a3274c Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 10:38:48 +0200 Subject: [PATCH 07/38] Fix thread data merging --- src/Psalm/Internal/Codebase/ClassLikes.php | 27 ++++++++++++------- .../Codebase/InternalCallMapHandlerTest.php | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index fa92b057d47..1092db27cb4 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -2347,15 +2347,24 @@ public function addThreadData(array $thread_data): void $existing_classes, ] = $thread_data; - $this->existing_classlikes_lc = array_merge($existing_classlikes_lc, $this->existing_classlikes_lc); - $this->existing_classes_lc = array_merge($existing_classes_lc, $this->existing_classes_lc); - $this->existing_traits_lc = array_merge($existing_traits_lc, $this->existing_traits_lc); - $this->existing_traits = array_merge($existing_traits, $this->existing_traits); - $this->existing_enums_lc = array_merge($existing_enums_lc, $this->existing_enums_lc); - $this->existing_enums = array_merge($existing_enums, $this->existing_enums); - $this->existing_interfaces_lc = array_merge($existing_interfaces_lc, $this->existing_interfaces_lc); - $this->existing_interfaces = array_merge($existing_interfaces, $this->existing_interfaces); - $this->existing_classes = array_merge($existing_classes, $this->existing_classes); + $this->existing_classlikes_lc = self::mergeThreadData($existing_classlikes_lc, $this->existing_classlikes_lc); + $this->existing_classes_lc = self::mergeThreadData($existing_classes_lc, $this->existing_classes_lc); + $this->existing_traits_lc = self::mergeThreadData($existing_traits_lc, $this->existing_traits_lc); + $this->existing_traits = self::mergeThreadData($existing_traits, $this->existing_traits); + $this->existing_enums_lc = self::mergeThreadData($existing_enums_lc, $this->existing_enums_lc); + $this->existing_enums = self::mergeThreadData($existing_enums, $this->existing_enums); + $this->existing_interfaces_lc = self::mergeThreadData($existing_interfaces_lc, $this->existing_interfaces_lc); + $this->existing_interfaces = self::mergeThreadData($existing_interfaces, $this->existing_interfaces); + $this->existing_classes = self::mergeThreadData($existing_classes, $this->existing_classes); + } + private static function mergeThreadData(array $old, array $new): array + { + foreach ($new as $name => $value) { + if (!isset($old[$name]) || (!$old[$name] && $value)) { + $old[$name] = $value; + } + } + return $old; } public function getStorageFor(string $fq_class_name): ?ClassLikeStorage diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index b21fc991a6b..9e19fb4d6d2 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -631,6 +631,7 @@ private function assertTypeValidity(ReflectionType $reflected, string $specified } catch (InvalidArgumentException $e) { if (preg_match('/^Could not get class storage for (.*)$/', $e->getMessage(), $matches) && !class_exists($matches[1]) + && !interface_exists($matches[1]) ) { $this->fail("Class used in CallMap does not exist: {$matches[1]}"); } From a28111799fd67878085eae3a1457706900d065ab Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 10:39:33 +0200 Subject: [PATCH 08/38] Fix --- src/Psalm/Internal/Codebase/ClassLikes.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 1092db27cb4..91b8265d9da 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -2357,6 +2357,15 @@ public function addThreadData(array $thread_data): void $this->existing_interfaces = self::mergeThreadData($existing_interfaces, $this->existing_interfaces); $this->existing_classes = self::mergeThreadData($existing_classes, $this->existing_classes); } + + /** + * @template T as string|lowercase-string + * + * @param array $old + * @param array $new + * + * @return array + */ private static function mergeThreadData(array $old, array $new): array { foreach ($new as $name => $value) { From ac5dd779559f18dd82d8567c12cda473d1df1cb9 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 10:50:01 +0200 Subject: [PATCH 09/38] Remove mistakenly (?) ignored functions --- src/Psalm/Codebase.php | 1 - src/Psalm/Internal/Codebase/ClassLikes.php | 2 -- tests/Internal/Codebase/InternalCallMapHandlerTest.php | 3 +-- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Psalm/Codebase.php b/src/Psalm/Codebase.php index 56a9aab5d34..d444fdf4a14 100644 --- a/src/Psalm/Codebase.php +++ b/src/Psalm/Codebase.php @@ -2303,7 +2303,6 @@ public function getKeyValueParamsForTraversableObject(Atomic $type): array /** * @param array $phantom_classes - * @psalm-suppress PossiblyUnusedMethod part of the public API */ public function queueClassLikeForScanning( string $fq_classlike_name, diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 91b8265d9da..32cc09de2b7 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -2360,10 +2360,8 @@ public function addThreadData(array $thread_data): void /** * @template T as string|lowercase-string - * * @param array $old * @param array $new - * * @return array */ private static function mergeThreadData(array $old, array $new): array diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index 9e19fb4d6d2..83b7409d18c 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -29,6 +29,7 @@ use function explode; use function function_exists; use function in_array; +use function interface_exists; use function is_array; use function is_int; use function json_encode; @@ -140,7 +141,6 @@ class InternalCallMapHandlerTest extends TestCase 'oci_result', 'ocigetbufferinglob', 'ocisetbufferinglob', - 'recursiveiteratoriterator::__construct', // Class used in CallMap does not exist: recursiveiterator 'sqlsrv_fetch_array', 'sqlsrv_fetch_object', 'sqlsrv_get_field', @@ -173,7 +173,6 @@ class InternalCallMapHandlerTest extends TestCase private static array $ignoredReturnTypeOnlyFunctions = [ 'appenditerator::getinneriterator' => ['8.1', '8.2'], 'appenditerator::getiteratorindex' => ['8.1', '8.2'], - 'arrayobject::getiterator' => ['8.1', '8.2'], 'cachingiterator::getinneriterator' => ['8.1', '8.2'], 'callbackfilteriterator::getinneriterator' => ['8.1', '8.2'], 'curl_multi_getcontent', From f21390d7ceec86414b483df670cca3ea29a7a0b7 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 11:11:47 +0200 Subject: [PATCH 10/38] Remove extremely strange logic --- src/Psalm/Internal/Codebase/ClassLikes.php | 24 +++------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 32cc09de2b7..2ae62e664a1 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -366,13 +366,7 @@ public function hasFullyQualifiedClassName( ) && !$this->classlike_storage_provider->has($fq_class_name_lc) ) { - if (!isset($this->existing_classes_lc[$fq_class_name_lc])) { - $this->existing_classes_lc[$fq_class_name_lc] = false; - - return false; - } - - return $this->existing_classes_lc[$fq_class_name_lc]; + return $this->existing_classes_lc[$fq_class_name_lc] = false; } return false; @@ -406,13 +400,7 @@ public function hasFullyQualifiedInterfaceName( ) && !$this->classlike_storage_provider->has($fq_class_name_lc) ) { - if (!isset($this->existing_interfaces_lc[$fq_class_name_lc])) { - $this->existing_interfaces_lc[$fq_class_name_lc] = false; - - return false; - } - - return $this->existing_interfaces_lc[$fq_class_name_lc]; + return $this->existing_interfaces_lc[$fq_class_name_lc] = false; } return false; @@ -473,13 +461,7 @@ public function hasFullyQualifiedEnumName( ) && !$this->classlike_storage_provider->has($fq_class_name_lc) ) { - if (!isset($this->existing_enums_lc[$fq_class_name_lc])) { - $this->existing_enums_lc[$fq_class_name_lc] = false; - - return false; - } - - return $this->existing_enums_lc[$fq_class_name_lc]; + return $this->existing_enums_lc[$fq_class_name_lc] = false; } return false; From 5e77f1b9e2c3244bc3f6f44831c37362d3d1baa3 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 11:52:50 +0200 Subject: [PATCH 11/38] Fixes --- src/Psalm/Internal/Codebase/ClassLikes.php | 60 ++++++---------------- 1 file changed, 15 insertions(+), 45 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 2ae62e664a1..bae1f10297b 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -356,20 +356,10 @@ public function hasFullyQualifiedClassName( } } - if (!isset($this->existing_classes_lc[$fq_class_name_lc]) - || !$this->existing_classes_lc[$fq_class_name_lc] - || !$this->classlike_storage_provider->has($fq_class_name_lc) - ) { - if (( - !isset($this->existing_classes_lc[$fq_class_name_lc]) - || $this->existing_classes_lc[$fq_class_name_lc] - ) - && !$this->classlike_storage_provider->has($fq_class_name_lc) - ) { - return $this->existing_classes_lc[$fq_class_name_lc] = false; - } - - return false; + if (isset($this->existing_classes_lc[$fq_class_name_lc])) { + return $this->existing_classes_lc[$fq_class_name_lc]; + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc)) { + return $this->existing_classes_lc[$fq_class_name_lc] = false; } if ($this->collect_locations && $code_location) { @@ -379,7 +369,7 @@ public function hasFullyQualifiedClassName( ); } - return true; + return $this->existing_classes_lc[$fq_class_name_lc] = true; } public function hasFullyQualifiedInterfaceName( @@ -390,20 +380,10 @@ public function hasFullyQualifiedInterfaceName( ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); - if (!isset($this->existing_interfaces_lc[$fq_class_name_lc]) - || !$this->existing_interfaces_lc[$fq_class_name_lc] - || !$this->classlike_storage_provider->has($fq_class_name_lc) - ) { - if (( - !isset($this->existing_interfaces_lc[$fq_class_name_lc]) - || $this->existing_interfaces_lc[$fq_class_name_lc] - ) - && !$this->classlike_storage_provider->has($fq_class_name_lc) - ) { - return $this->existing_interfaces_lc[$fq_class_name_lc] = false; - } - - return false; + if (isset($this->existing_interfaces_lc[$fq_class_name_lc])) { + return $this->existing_interfaces_lc[$fq_class_name_lc]; + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc)) { + return $this->existing_interfaces_lc[$fq_class_name_lc] = false; } if ($this->collect_references && $code_location) { @@ -440,7 +420,7 @@ public function hasFullyQualifiedInterfaceName( ); } - return true; + return $this->existing_interfaces_lc[$fq_class_name_lc] = true; } public function hasFullyQualifiedEnumName( @@ -451,20 +431,10 @@ public function hasFullyQualifiedEnumName( ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); - if (!isset($this->existing_enums_lc[$fq_class_name_lc]) - || !$this->existing_enums_lc[$fq_class_name_lc] - || !$this->classlike_storage_provider->has($fq_class_name_lc) - ) { - if (( - !isset($this->existing_enums_lc[$fq_class_name_lc]) - || $this->existing_enums_lc[$fq_class_name_lc] - ) - && !$this->classlike_storage_provider->has($fq_class_name_lc) - ) { - return $this->existing_enums_lc[$fq_class_name_lc] = false; - } - - return false; + if (isset($this->existing_enums_lc[$fq_class_name_lc])) { + return $this->existing_enums_lc[$fq_class_name_lc]; + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc)) { + return $this->existing_enums_lc[$fq_class_name_lc] = false; } if ($this->collect_references && $code_location) { @@ -501,7 +471,7 @@ public function hasFullyQualifiedEnumName( ); } - return true; + return $this->existing_enums_lc[$fq_class_name_lc] = true; } public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation $code_location = null): bool From 7e605f09cd77c09195070aafad8c0ff29800da55 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 12:18:27 +0200 Subject: [PATCH 12/38] Fixup --- src/Psalm/Internal/Codebase/ClassLikes.php | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index ea7405bce95..f1f1bc0dbf5 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -360,7 +360,13 @@ public function hasFullyQualifiedClassName( if (isset($this->existing_classes_lc[$fq_class_name_lc])) { return $this->existing_classes_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc)) { + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) + || !( + $this->classlike_storage_provider->get($fq_class_name_lc)->is_enum + || $this->classlike_storage_provider->get($fq_class_name_lc)->is_interface + || $this->classlike_storage_provider->get($fq_class_name_lc)->is_trait + ) + ) { return $this->existing_classes_lc[$fq_class_name_lc] = false; } @@ -384,7 +390,9 @@ public function hasFullyQualifiedInterfaceName( if (isset($this->existing_interfaces_lc[$fq_class_name_lc])) { return $this->existing_interfaces_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc)) { + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) + || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_interface + ) { return $this->existing_interfaces_lc[$fq_class_name_lc] = false; } @@ -435,7 +443,9 @@ public function hasFullyQualifiedEnumName( if (isset($this->existing_enums_lc[$fq_class_name_lc])) { return $this->existing_enums_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc)) { + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) + || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_enum + ) { return $this->existing_enums_lc[$fq_class_name_lc] = false; } @@ -480,10 +490,12 @@ public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); - if (!isset($this->existing_traits_lc[$fq_class_name_lc]) || - !$this->existing_traits_lc[$fq_class_name_lc] + if (isset($this->existing_enums_lc[$fq_class_name_lc])) { + return $this->existing_enums_lc[$fq_class_name_lc]; + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) + || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_trait ) { - return false; + return $this->existing_enums_lc[$fq_class_name_lc] = false; } if ($this->collect_references && $code_location) { From 964080e6c1de2aef638c7441d725d226fc3d7d6a Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 12:18:27 +0200 Subject: [PATCH 13/38] Fixup --- src/Psalm/Internal/Codebase/ClassLikes.php | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index bae1f10297b..b41327c2994 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -358,7 +358,13 @@ public function hasFullyQualifiedClassName( if (isset($this->existing_classes_lc[$fq_class_name_lc])) { return $this->existing_classes_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc)) { + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) + || !( + $this->classlike_storage_provider->get($fq_class_name_lc)->is_enum + || $this->classlike_storage_provider->get($fq_class_name_lc)->is_interface + || $this->classlike_storage_provider->get($fq_class_name_lc)->is_trait + ) + ) { return $this->existing_classes_lc[$fq_class_name_lc] = false; } @@ -382,7 +388,9 @@ public function hasFullyQualifiedInterfaceName( if (isset($this->existing_interfaces_lc[$fq_class_name_lc])) { return $this->existing_interfaces_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc)) { + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) + || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_interface + ) { return $this->existing_interfaces_lc[$fq_class_name_lc] = false; } @@ -433,7 +441,9 @@ public function hasFullyQualifiedEnumName( if (isset($this->existing_enums_lc[$fq_class_name_lc])) { return $this->existing_enums_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc)) { + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) + || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_enum + ) { return $this->existing_enums_lc[$fq_class_name_lc] = false; } @@ -478,10 +488,12 @@ public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); - if (!isset($this->existing_traits_lc[$fq_class_name_lc]) || - !$this->existing_traits_lc[$fq_class_name_lc] + if (isset($this->existing_enums_lc[$fq_class_name_lc])) { + return $this->existing_enums_lc[$fq_class_name_lc]; + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) + || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_trait ) { - return false; + return $this->existing_enums_lc[$fq_class_name_lc] = false; } if ($this->collect_references && $code_location) { From db9ac3a624d0b3c11b5f39762546e41ef79a7b63 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 12:46:41 +0200 Subject: [PATCH 14/38] Fixes --- src/Psalm/Internal/Codebase/ClassLikes.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index f1f1bc0dbf5..7fba3c224b4 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -490,12 +490,12 @@ public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); - if (isset($this->existing_enums_lc[$fq_class_name_lc])) { - return $this->existing_enums_lc[$fq_class_name_lc]; + if (isset($this->existing_traits_lc[$fq_class_name_lc])) { + return $this->existing_traits_lc[$fq_class_name_lc]; } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_trait ) { - return $this->existing_enums_lc[$fq_class_name_lc] = false; + return $this->existing_traits_lc[$fq_class_name_lc] = false; } if ($this->collect_references && $code_location) { @@ -505,7 +505,7 @@ public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation ); } - return true; + return $this->existing_traits_lc[$fq_class_name_lc] = true; } /** From e402813de819aa22b4803515d243fee826ad22f2 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 12:46:41 +0200 Subject: [PATCH 15/38] Fixes --- src/Psalm/Internal/Codebase/ClassLikes.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index b41327c2994..fe985547d47 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -488,12 +488,12 @@ public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); - if (isset($this->existing_enums_lc[$fq_class_name_lc])) { - return $this->existing_enums_lc[$fq_class_name_lc]; + if (isset($this->existing_traits_lc[$fq_class_name_lc])) { + return $this->existing_traits_lc[$fq_class_name_lc]; } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_trait ) { - return $this->existing_enums_lc[$fq_class_name_lc] = false; + return $this->existing_traits_lc[$fq_class_name_lc] = false; } if ($this->collect_references && $code_location) { @@ -503,7 +503,7 @@ public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation ); } - return true; + return $this->existing_traits_lc[$fq_class_name_lc] = true; } /** From 197668a85a2887e0936f365c5fbb9ad2a863b3ec Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 25 Jul 2023 12:57:38 +0200 Subject: [PATCH 16/38] Fix file references --- src/Psalm/Internal/Codebase/ClassLikes.php | 60 +++++++++++----------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index fe985547d47..a38fea15f80 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -356,6 +356,13 @@ public function hasFullyQualifiedClassName( } } + if ($this->collect_locations && $code_location) { + $this->file_reference_provider->addCallingLocationForClass( + $code_location, + strtolower($fq_class_name), + ); + } + if (isset($this->existing_classes_lc[$fq_class_name_lc])) { return $this->existing_classes_lc[$fq_class_name_lc]; } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) @@ -368,13 +375,6 @@ public function hasFullyQualifiedClassName( return $this->existing_classes_lc[$fq_class_name_lc] = false; } - if ($this->collect_locations && $code_location) { - $this->file_reference_provider->addCallingLocationForClass( - $code_location, - strtolower($fq_class_name), - ); - } - return $this->existing_classes_lc[$fq_class_name_lc] = true; } @@ -386,14 +386,6 @@ public function hasFullyQualifiedInterfaceName( ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); - if (isset($this->existing_interfaces_lc[$fq_class_name_lc])) { - return $this->existing_interfaces_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) - || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_interface - ) { - return $this->existing_interfaces_lc[$fq_class_name_lc] = false; - } - if ($this->collect_references && $code_location) { if ($calling_method_id) { $this->file_reference_provider->addMethodReferenceToClass( @@ -428,6 +420,14 @@ public function hasFullyQualifiedInterfaceName( ); } + if (isset($this->existing_interfaces_lc[$fq_class_name_lc])) { + return $this->existing_interfaces_lc[$fq_class_name_lc]; + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) + || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_interface + ) { + return $this->existing_interfaces_lc[$fq_class_name_lc] = false; + } + return $this->existing_interfaces_lc[$fq_class_name_lc] = true; } @@ -439,14 +439,6 @@ public function hasFullyQualifiedEnumName( ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); - if (isset($this->existing_enums_lc[$fq_class_name_lc])) { - return $this->existing_enums_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) - || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_enum - ) { - return $this->existing_enums_lc[$fq_class_name_lc] = false; - } - if ($this->collect_references && $code_location) { if ($calling_method_id) { $this->file_reference_provider->addMethodReferenceToClass( @@ -481,6 +473,14 @@ public function hasFullyQualifiedEnumName( ); } + if (isset($this->existing_enums_lc[$fq_class_name_lc])) { + return $this->existing_enums_lc[$fq_class_name_lc]; + } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) + || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_enum + ) { + return $this->existing_enums_lc[$fq_class_name_lc] = false; + } + return $this->existing_enums_lc[$fq_class_name_lc] = true; } @@ -488,6 +488,13 @@ public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); + if ($this->collect_references && $code_location) { + $this->file_reference_provider->addNonMethodReferenceToClass( + $code_location->file_path, + $fq_class_name_lc, + ); + } + if (isset($this->existing_traits_lc[$fq_class_name_lc])) { return $this->existing_traits_lc[$fq_class_name_lc]; } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) @@ -496,13 +503,6 @@ public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation return $this->existing_traits_lc[$fq_class_name_lc] = false; } - if ($this->collect_references && $code_location) { - $this->file_reference_provider->addNonMethodReferenceToClass( - $code_location->file_path, - $fq_class_name_lc, - ); - } - return $this->existing_traits_lc[$fq_class_name_lc] = true; } From e67ea0b1245726cc33aed61d9c386a920b031801 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 26 Jul 2023 09:17:45 +0200 Subject: [PATCH 17/38] Simplify --- src/Psalm/Internal/Codebase/ClassLikes.php | 154 +++++++++++++-------- 1 file changed, 94 insertions(+), 60 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index f8c2032a3d3..15953d98755 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -1,7 +1,5 @@ config = $config; $this->classlike_storage_provider = $storage_provider; @@ -327,7 +325,7 @@ public function hasFullyQualifiedClassName( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null, + ?string $calling_method_id = null ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); @@ -358,6 +356,28 @@ public function hasFullyQualifiedClassName( } } + if (!isset($this->existing_classes_lc[$fq_class_name_lc]) + || !$this->existing_classes_lc[$fq_class_name_lc] + || !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (( + !isset($this->existing_classes_lc[$fq_class_name_lc]) + || $this->existing_classes_lc[$fq_class_name_lc] + ) + && !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (!isset($this->existing_classes_lc[$fq_class_name_lc])) { + $this->existing_classes_lc[$fq_class_name_lc] = false; + + return false; + } + + return $this->existing_classes_lc[$fq_class_name_lc]; + } + + return false; + } + if ($this->collect_locations && $code_location) { $this->file_reference_provider->addCallingLocationForClass( $code_location, @@ -365,29 +385,39 @@ public function hasFullyQualifiedClassName( ); } - if (isset($this->existing_classes_lc[$fq_class_name_lc])) { - return $this->existing_classes_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) - || !( - $this->classlike_storage_provider->get($fq_class_name_lc)->is_enum - || $this->classlike_storage_provider->get($fq_class_name_lc)->is_interface - || $this->classlike_storage_provider->get($fq_class_name_lc)->is_trait - ) - ) { - return $this->existing_classes_lc[$fq_class_name_lc] = false; - } - - return $this->existing_classes_lc[$fq_class_name_lc] = true; + return true; } public function hasFullyQualifiedInterfaceName( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null, + ?string $calling_method_id = null ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); + if (!isset($this->existing_interfaces_lc[$fq_class_name_lc]) + || !$this->existing_interfaces_lc[$fq_class_name_lc] + || !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (( + !isset($this->existing_classes_lc[$fq_class_name_lc]) + || $this->existing_classes_lc[$fq_class_name_lc] + ) + && !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (!isset($this->existing_interfaces_lc[$fq_class_name_lc])) { + $this->existing_interfaces_lc[$fq_class_name_lc] = false; + + return false; + } + + return $this->existing_interfaces_lc[$fq_class_name_lc]; + } + + return false; + } + if ($this->collect_references && $code_location) { if ($calling_method_id) { $this->file_reference_provider->addMethodReferenceToClass( @@ -422,25 +452,39 @@ public function hasFullyQualifiedInterfaceName( ); } - if (isset($this->existing_interfaces_lc[$fq_class_name_lc])) { - return $this->existing_interfaces_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) - || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_interface - ) { - return $this->existing_interfaces_lc[$fq_class_name_lc] = false; - } - - return $this->existing_interfaces_lc[$fq_class_name_lc] = true; + return true; } public function hasFullyQualifiedEnumName( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null, + ?string $calling_method_id = null ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); + if (!isset($this->existing_enums_lc[$fq_class_name_lc]) + || !$this->existing_enums_lc[$fq_class_name_lc] + || !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (( + !isset($this->existing_classes_lc[$fq_class_name_lc]) + || $this->existing_classes_lc[$fq_class_name_lc] + ) + && !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (!isset($this->existing_enums_lc[$fq_class_name_lc])) { + $this->existing_enums_lc[$fq_class_name_lc] = false; + + return false; + } + + return $this->existing_enums_lc[$fq_class_name_lc]; + } + + return false; + } + if ($this->collect_references && $code_location) { if ($calling_method_id) { $this->file_reference_provider->addMethodReferenceToClass( @@ -475,21 +519,19 @@ public function hasFullyQualifiedEnumName( ); } - if (isset($this->existing_enums_lc[$fq_class_name_lc])) { - return $this->existing_enums_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) - || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_enum - ) { - return $this->existing_enums_lc[$fq_class_name_lc] = false; - } - - return $this->existing_enums_lc[$fq_class_name_lc] = true; + return true; } public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation $code_location = null): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); + if (!isset($this->existing_traits_lc[$fq_class_name_lc]) || + !$this->existing_traits_lc[$fq_class_name_lc] + ) { + return false; + } + if ($this->collect_references && $code_location) { $this->file_reference_provider->addNonMethodReferenceToClass( $code_location->file_path, @@ -497,15 +539,7 @@ public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation ); } - if (isset($this->existing_traits_lc[$fq_class_name_lc])) { - return $this->existing_traits_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) - || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_trait - ) { - return $this->existing_traits_lc[$fq_class_name_lc] = false; - } - - return $this->existing_traits_lc[$fq_class_name_lc] = true; + return true; } /** @@ -515,7 +549,7 @@ public function classOrInterfaceExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null, + ?string $calling_method_id = null ): bool { return $this->classExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id) || $this->interfaceExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id); @@ -528,7 +562,7 @@ public function classOrInterfaceOrEnumExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null, + ?string $calling_method_id = null ): bool { return $this->classExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id) || $this->interfaceExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id) @@ -542,7 +576,7 @@ public function classExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null, + ?string $calling_method_id = null ): bool { if (isset(ClassLikeAnalyzer::SPECIAL_TYPES[$fq_class_name])) { return false; @@ -639,7 +673,7 @@ public function interfaceExists( string $fq_interface_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null, + ?string $calling_method_id = null ): bool { if (isset(ClassLikeAnalyzer::SPECIAL_TYPES[strtolower($fq_interface_name)])) { return false; @@ -657,7 +691,7 @@ public function enumExists( string $fq_enum_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null, + ?string $calling_method_id = null ): bool { if (isset(ClassLikeAnalyzer::SPECIAL_TYPES[strtolower($fq_enum_name)])) { return false; @@ -881,7 +915,7 @@ public function consolidateAnalyzedData(Methods $methods, ?Progress $progress, b public static function makeImmutable( PhpParser\Node\Stmt\Class_ $class_stmt, ProjectAnalyzer $project_analyzer, - string $file_path, + string $file_path ): void { $manipulator = ClassDocblockManipulator::getForClass( $project_analyzer, @@ -1157,7 +1191,7 @@ public function handleClassLikeReferenceInMigration( string $fq_class_name, ?string $calling_method_id, bool $force_change = false, - bool $was_self = false, + bool $was_self = false ): bool { if ($class_name_node instanceof VirtualNode) { return false; @@ -1339,7 +1373,7 @@ public function handleDocblockTypeInMigration( StatementsSource $source, Union $type, CodeLocation $type_location, - ?string $calling_method_id, + ?string $calling_method_id ): void { $calling_fq_class_name = $source->getFQCLN(); $fq_class_name_lc = strtolower($calling_fq_class_name ?? ''); @@ -1469,7 +1503,7 @@ public function airliftClassLikeReference( int $source_start, int $source_end, bool $add_class_constant = false, - bool $allow_self = false, + bool $allow_self = false ): void { $project_analyzer = ProjectAnalyzer::getInstance(); $codebase = $project_analyzer->getCodebase(); @@ -1505,7 +1539,7 @@ public function airliftClassDefinedDocblockType( string $destination_fq_class_name, string $source_file_path, int $source_start, - int $source_end, + int $source_end ): void { $project_analyzer = ProjectAnalyzer::getInstance(); $codebase = $project_analyzer->getCodebase(); @@ -1579,7 +1613,7 @@ public function getClassConstantType( ?StatementsAnalyzer $statements_analyzer = null, array $visited_constant_ids = [], bool $late_static_binding = false, - bool $in_value_of_context = false, + bool $in_value_of_context = false ): ?Union { $class_name = strtolower($class_name); @@ -2357,7 +2391,7 @@ private function getConstantType( int $visibility, ?StatementsAnalyzer $statements_analyzer, array $visited_constant_ids, - bool $late_static_binding, + bool $late_static_binding ): ?Union { $constant_resolver = new StorageByPatternResolver(); $resolved_constants = $constant_resolver->resolveConstants( @@ -2419,7 +2453,7 @@ private function getConstantType( private function getEnumType( ClassLikeStorage $class_like_storage, - string $constant_name, + string $constant_name ): ?Union { $constant_resolver = new StorageByPatternResolver(); $resolved_enums = $constant_resolver->resolveEnums( @@ -2441,7 +2475,7 @@ private function getEnumType( private function filterConstantNameByVisibility( ClassConstantStorage $constant_storage, - int $visibility, + int $visibility ): bool { if ($visibility === ReflectionProperty::IS_PUBLIC From efcdc273765b3c5a8e7ea1a6be95e2957ef7f28f Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 26 Jul 2023 09:17:45 +0200 Subject: [PATCH 18/38] Simplify --- src/Psalm/Internal/Codebase/ClassLikes.php | 116 ++++++++++++++------- 1 file changed, 76 insertions(+), 40 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index a38fea15f80..15953d98755 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -356,6 +356,28 @@ public function hasFullyQualifiedClassName( } } + if (!isset($this->existing_classes_lc[$fq_class_name_lc]) + || !$this->existing_classes_lc[$fq_class_name_lc] + || !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (( + !isset($this->existing_classes_lc[$fq_class_name_lc]) + || $this->existing_classes_lc[$fq_class_name_lc] + ) + && !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (!isset($this->existing_classes_lc[$fq_class_name_lc])) { + $this->existing_classes_lc[$fq_class_name_lc] = false; + + return false; + } + + return $this->existing_classes_lc[$fq_class_name_lc]; + } + + return false; + } + if ($this->collect_locations && $code_location) { $this->file_reference_provider->addCallingLocationForClass( $code_location, @@ -363,19 +385,7 @@ public function hasFullyQualifiedClassName( ); } - if (isset($this->existing_classes_lc[$fq_class_name_lc])) { - return $this->existing_classes_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) - || !( - $this->classlike_storage_provider->get($fq_class_name_lc)->is_enum - || $this->classlike_storage_provider->get($fq_class_name_lc)->is_interface - || $this->classlike_storage_provider->get($fq_class_name_lc)->is_trait - ) - ) { - return $this->existing_classes_lc[$fq_class_name_lc] = false; - } - - return $this->existing_classes_lc[$fq_class_name_lc] = true; + return true; } public function hasFullyQualifiedInterfaceName( @@ -386,6 +396,28 @@ public function hasFullyQualifiedInterfaceName( ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); + if (!isset($this->existing_interfaces_lc[$fq_class_name_lc]) + || !$this->existing_interfaces_lc[$fq_class_name_lc] + || !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (( + !isset($this->existing_classes_lc[$fq_class_name_lc]) + || $this->existing_classes_lc[$fq_class_name_lc] + ) + && !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (!isset($this->existing_interfaces_lc[$fq_class_name_lc])) { + $this->existing_interfaces_lc[$fq_class_name_lc] = false; + + return false; + } + + return $this->existing_interfaces_lc[$fq_class_name_lc]; + } + + return false; + } + if ($this->collect_references && $code_location) { if ($calling_method_id) { $this->file_reference_provider->addMethodReferenceToClass( @@ -420,15 +452,7 @@ public function hasFullyQualifiedInterfaceName( ); } - if (isset($this->existing_interfaces_lc[$fq_class_name_lc])) { - return $this->existing_interfaces_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) - || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_interface - ) { - return $this->existing_interfaces_lc[$fq_class_name_lc] = false; - } - - return $this->existing_interfaces_lc[$fq_class_name_lc] = true; + return true; } public function hasFullyQualifiedEnumName( @@ -439,6 +463,28 @@ public function hasFullyQualifiedEnumName( ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); + if (!isset($this->existing_enums_lc[$fq_class_name_lc]) + || !$this->existing_enums_lc[$fq_class_name_lc] + || !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (( + !isset($this->existing_classes_lc[$fq_class_name_lc]) + || $this->existing_classes_lc[$fq_class_name_lc] + ) + && !$this->classlike_storage_provider->has($fq_class_name_lc) + ) { + if (!isset($this->existing_enums_lc[$fq_class_name_lc])) { + $this->existing_enums_lc[$fq_class_name_lc] = false; + + return false; + } + + return $this->existing_enums_lc[$fq_class_name_lc]; + } + + return false; + } + if ($this->collect_references && $code_location) { if ($calling_method_id) { $this->file_reference_provider->addMethodReferenceToClass( @@ -473,21 +519,19 @@ public function hasFullyQualifiedEnumName( ); } - if (isset($this->existing_enums_lc[$fq_class_name_lc])) { - return $this->existing_enums_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) - || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_enum - ) { - return $this->existing_enums_lc[$fq_class_name_lc] = false; - } - - return $this->existing_enums_lc[$fq_class_name_lc] = true; + return true; } public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation $code_location = null): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); + if (!isset($this->existing_traits_lc[$fq_class_name_lc]) || + !$this->existing_traits_lc[$fq_class_name_lc] + ) { + return false; + } + if ($this->collect_references && $code_location) { $this->file_reference_provider->addNonMethodReferenceToClass( $code_location->file_path, @@ -495,15 +539,7 @@ public function hasFullyQualifiedTraitName(string $fq_class_name, ?CodeLocation ); } - if (isset($this->existing_traits_lc[$fq_class_name_lc])) { - return $this->existing_traits_lc[$fq_class_name_lc]; - } elseif (!$this->classlike_storage_provider->has($fq_class_name_lc) - || !$this->classlike_storage_provider->get($fq_class_name_lc)->is_trait - ) { - return $this->existing_traits_lc[$fq_class_name_lc] = false; - } - - return $this->existing_traits_lc[$fq_class_name_lc] = true; + return true; } /** From ede836703345b68f3f7d932fcfee9cde4bed63eb Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 26 Jul 2023 09:57:08 +0200 Subject: [PATCH 19/38] Revert for now --- tests/Internal/Codebase/InternalCallMapHandlerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index 83b7409d18c..b21fc991a6b 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -29,7 +29,6 @@ use function explode; use function function_exists; use function in_array; -use function interface_exists; use function is_array; use function is_int; use function json_encode; @@ -141,6 +140,7 @@ class InternalCallMapHandlerTest extends TestCase 'oci_result', 'ocigetbufferinglob', 'ocisetbufferinglob', + 'recursiveiteratoriterator::__construct', // Class used in CallMap does not exist: recursiveiterator 'sqlsrv_fetch_array', 'sqlsrv_fetch_object', 'sqlsrv_get_field', @@ -173,6 +173,7 @@ class InternalCallMapHandlerTest extends TestCase private static array $ignoredReturnTypeOnlyFunctions = [ 'appenditerator::getinneriterator' => ['8.1', '8.2'], 'appenditerator::getiteratorindex' => ['8.1', '8.2'], + 'arrayobject::getiterator' => ['8.1', '8.2'], 'cachingiterator::getinneriterator' => ['8.1', '8.2'], 'callbackfilteriterator::getinneriterator' => ['8.1', '8.2'], 'curl_multi_getcontent', @@ -630,7 +631,6 @@ private function assertTypeValidity(ReflectionType $reflected, string $specified } catch (InvalidArgumentException $e) { if (preg_match('/^Could not get class storage for (.*)$/', $e->getMessage(), $matches) && !class_exists($matches[1]) - && !interface_exists($matches[1]) ) { $this->fail("Class used in CallMap does not exist: {$matches[1]}"); } From f68e071f53dd9b78f8dc97c338acc8fbc1b3beec Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 26 Jul 2023 11:04:15 +0200 Subject: [PATCH 20/38] Update UPGRADING.md --- UPGRADING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UPGRADING.md b/UPGRADING.md index 2fb773dc2df..e3f30b530ff 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -13,6 +13,10 @@ - [BC] The return type of `Psalm\Internal\LanguageServer\ProtocolWriter#write() changed from `Amp\Promise` to `void` due to the switch to Amp v3 +- [BC] All parameters and return typehints are now strictly typed. + +- [BC] `strict_types` is now applied to all files of the Psalm codebase. + # Upgrading from Psalm 4 to Psalm 5 ## Changed From c957aa84a9d56507193e47e2746286b19685d40b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 28 Jul 2023 11:34:16 +0200 Subject: [PATCH 21/38] fix --- src/Psalm/Internal/LanguageServer/LanguageServer.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Psalm/Internal/LanguageServer/LanguageServer.php b/src/Psalm/Internal/LanguageServer/LanguageServer.php index 1ef1c9628cf..b0721aa078e 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageServer.php +++ b/src/Psalm/Internal/LanguageServer/LanguageServer.php @@ -363,10 +363,6 @@ public static function run( * Is null if the process has not been started by another process. If the parent process is * not alive then the server should exit (see exit notification) its process. * @param ClientInfo|null $clientInfo Information about the client - * @param string|null $locale The locale the client is currently showing the user interface - * in. This must not necessarily be the locale of the operating - * system. - * @param string|null $rootPath The rootPath of the workspace. Is null if no folder is open. * @param string|null $trace The initial trace setting. If omitted trace is disabled ('off'). * @param string|null $workDoneToken The token to be used to report progress during init. * @psalm-return InitializeResult @@ -375,9 +371,8 @@ public function initialize( ClientCapabilities $capabilities, ?ClientInfo $clientInfo = null, ?string $rootUri = null, - mixed $initializationOptions = null, ?string $trace = null, - //?array $workspaceFolders = null //error in json-dispatcher + ?string $workDoneToken = null ): InitializeResult { $this->clientInfo = $clientInfo; $this->clientCapabilities = $capabilities; From c7ab83767a87de69f8213cb0adcc425ddc78f264 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 28 Jul 2023 11:35:38 +0200 Subject: [PATCH 22/38] cs-fix --- src/Psalm/Internal/Codebase/ClassLikes.php | 36 +++++++++---------- .../Client/Progress/Progress.php | 2 +- .../Client/Progress/ProgressInterface.php | 2 +- .../LanguageServer/LanguageServer.php | 6 ++-- tests/LanguageServer/PathMapperTest.php | 4 +-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 15953d98755..823a13e1f66 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -152,7 +152,7 @@ public function __construct( ClassLikeStorageProvider $storage_provider, FileReferenceProvider $file_reference_provider, StatementsProvider $statements_provider, - Scanner $scanner + Scanner $scanner, ) { $this->config = $config; $this->classlike_storage_provider = $storage_provider; @@ -325,7 +325,7 @@ public function hasFullyQualifiedClassName( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); @@ -392,7 +392,7 @@ public function hasFullyQualifiedInterfaceName( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); @@ -459,7 +459,7 @@ public function hasFullyQualifiedEnumName( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { $fq_class_name_lc = strtolower($this->getUnAliasedName($fq_class_name)); @@ -549,7 +549,7 @@ public function classOrInterfaceExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { return $this->classExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id) || $this->interfaceExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id); @@ -562,7 +562,7 @@ public function classOrInterfaceOrEnumExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { return $this->classExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id) || $this->interfaceExists($fq_class_name, $code_location, $calling_fq_class_name, $calling_method_id) @@ -576,7 +576,7 @@ public function classExists( string $fq_class_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { if (isset(ClassLikeAnalyzer::SPECIAL_TYPES[$fq_class_name])) { return false; @@ -673,7 +673,7 @@ public function interfaceExists( string $fq_interface_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { if (isset(ClassLikeAnalyzer::SPECIAL_TYPES[strtolower($fq_interface_name)])) { return false; @@ -691,7 +691,7 @@ public function enumExists( string $fq_enum_name, ?CodeLocation $code_location = null, ?string $calling_fq_class_name = null, - ?string $calling_method_id = null + ?string $calling_method_id = null, ): bool { if (isset(ClassLikeAnalyzer::SPECIAL_TYPES[strtolower($fq_enum_name)])) { return false; @@ -915,7 +915,7 @@ public function consolidateAnalyzedData(Methods $methods, ?Progress $progress, b public static function makeImmutable( PhpParser\Node\Stmt\Class_ $class_stmt, ProjectAnalyzer $project_analyzer, - string $file_path + string $file_path, ): void { $manipulator = ClassDocblockManipulator::getForClass( $project_analyzer, @@ -1191,7 +1191,7 @@ public function handleClassLikeReferenceInMigration( string $fq_class_name, ?string $calling_method_id, bool $force_change = false, - bool $was_self = false + bool $was_self = false, ): bool { if ($class_name_node instanceof VirtualNode) { return false; @@ -1373,7 +1373,7 @@ public function handleDocblockTypeInMigration( StatementsSource $source, Union $type, CodeLocation $type_location, - ?string $calling_method_id + ?string $calling_method_id, ): void { $calling_fq_class_name = $source->getFQCLN(); $fq_class_name_lc = strtolower($calling_fq_class_name ?? ''); @@ -1503,7 +1503,7 @@ public function airliftClassLikeReference( int $source_start, int $source_end, bool $add_class_constant = false, - bool $allow_self = false + bool $allow_self = false, ): void { $project_analyzer = ProjectAnalyzer::getInstance(); $codebase = $project_analyzer->getCodebase(); @@ -1539,7 +1539,7 @@ public function airliftClassDefinedDocblockType( string $destination_fq_class_name, string $source_file_path, int $source_start, - int $source_end + int $source_end, ): void { $project_analyzer = ProjectAnalyzer::getInstance(); $codebase = $project_analyzer->getCodebase(); @@ -1613,7 +1613,7 @@ public function getClassConstantType( ?StatementsAnalyzer $statements_analyzer = null, array $visited_constant_ids = [], bool $late_static_binding = false, - bool $in_value_of_context = false + bool $in_value_of_context = false, ): ?Union { $class_name = strtolower($class_name); @@ -2391,7 +2391,7 @@ private function getConstantType( int $visibility, ?StatementsAnalyzer $statements_analyzer, array $visited_constant_ids, - bool $late_static_binding + bool $late_static_binding, ): ?Union { $constant_resolver = new StorageByPatternResolver(); $resolved_constants = $constant_resolver->resolveConstants( @@ -2453,7 +2453,7 @@ private function getConstantType( private function getEnumType( ClassLikeStorage $class_like_storage, - string $constant_name + string $constant_name, ): ?Union { $constant_resolver = new StorageByPatternResolver(); $resolved_enums = $constant_resolver->resolveEnums( @@ -2475,7 +2475,7 @@ private function getEnumType( private function filterConstantNameByVisibility( ClassConstantStorage $constant_storage, - int $visibility + int $visibility, ): bool { if ($visibility === ReflectionProperty::IS_PUBLIC diff --git a/src/Psalm/Internal/LanguageServer/Client/Progress/Progress.php b/src/Psalm/Internal/LanguageServer/Client/Progress/Progress.php index 8a1ca5da3a9..3c5b67a2682 100644 --- a/src/Psalm/Internal/LanguageServer/Client/Progress/Progress.php +++ b/src/Psalm/Internal/LanguageServer/Client/Progress/Progress.php @@ -27,7 +27,7 @@ public function __construct(ClientHandler $handler, string $token) public function begin( string $title, ?string $message = null, - ?int $percentage = null + ?int $percentage = null, ): void { if ($this->status === self::STATUS_ACTIVE) { throw new LogicException('Progress has already been started'); diff --git a/src/Psalm/Internal/LanguageServer/Client/Progress/ProgressInterface.php b/src/Psalm/Internal/LanguageServer/Client/Progress/ProgressInterface.php index 78f045c2c53..1dcee6e2f19 100644 --- a/src/Psalm/Internal/LanguageServer/Client/Progress/ProgressInterface.php +++ b/src/Psalm/Internal/LanguageServer/Client/Progress/ProgressInterface.php @@ -8,7 +8,7 @@ interface ProgressInterface public function begin( string $title, ?string $message = null, - ?int $percentage = null + ?int $percentage = null, ): void; public function update(?string $message = null, ?int $percentage = null): void; diff --git a/src/Psalm/Internal/LanguageServer/LanguageServer.php b/src/Psalm/Internal/LanguageServer/LanguageServer.php index b0721aa078e..462098e5dcd 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageServer.php +++ b/src/Psalm/Internal/LanguageServer/LanguageServer.php @@ -147,7 +147,7 @@ public function __construct( Codebase $codebase, ClientConfiguration $clientConfiguration, Progress $progress, - PathMapper $path_mapper + PathMapper $path_mapper, ) { parent::__construct($this, '/'); @@ -240,7 +240,7 @@ public static function run( ClientConfiguration $clientConfiguration, string $base_dir, PathMapper $path_mapper, - bool $inMemory = false + bool $inMemory = false, ): void { $progress = new Progress(); @@ -372,7 +372,7 @@ public function initialize( ?ClientInfo $clientInfo = null, ?string $rootUri = null, ?string $trace = null, - ?string $workDoneToken = null + ?string $workDoneToken = null, ): InitializeResult { $this->clientInfo = $clientInfo; $this->clientCapabilities = $capabilities; diff --git a/tests/LanguageServer/PathMapperTest.php b/tests/LanguageServer/PathMapperTest.php index 2e64b356399..dbd508db3ee 100644 --- a/tests/LanguageServer/PathMapperTest.php +++ b/tests/LanguageServer/PathMapperTest.php @@ -37,7 +37,7 @@ public function testMapsClientToServer( ?string $client_root_reconfigured, string $client_root_provided_later, string $client_path, - string $server_ath + string $server_ath, ): void { $mapper = new PathMapper($server_root, $client_root_reconfigured); $mapper->configureClientRoot($client_root_provided_later); @@ -53,7 +53,7 @@ public function testMapsServerToClient( ?string $client_root_preconfigured, string $client_root_provided_later, string $client_path, - string $server_path + string $server_path, ): void { $mapper = new PathMapper($server_root, $client_root_preconfigured); $mapper->configureClientRoot($client_root_provided_later); From a233e621b2bb351f66e5a227f8576689a449c670 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 11:29:55 +0200 Subject: [PATCH 23/38] cs-fix --- src/Psalm/Config.php | 2 +- .../Internal/Analyzer/Statements/DeclareAnalyzer.php | 8 ++++---- .../Expression/Fetch/AtomicPropertyFetchAnalyzer.php | 2 +- src/Psalm/Internal/Cli/Psalm.php | 2 +- .../Codebase/AssertionsFromInheritanceResolver.php | 4 ++-- src/Psalm/Internal/Codebase/Methods.php | 2 +- src/Psalm/Internal/Type/SimpleAssertionReconciler.php | 2 +- src/Psalm/Type.php | 3 +-- src/Psalm/Type/Atomic/TCallableKeyedArray.php | 2 +- 9 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 3b39ed8f3f0..d977722fd21 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -1468,7 +1468,7 @@ public function setAdvancedErrorLevel(string $issue_key, array $config, ?string public function safeSetAdvancedErrorLevel( string $issue_key, array $config, - ?string $default_error_level = null + ?string $default_error_level = null, ): void { if (!isset($this->issue_handlers[$issue_key])) { $this->setAdvancedErrorLevel($issue_key, $config, $default_error_level); diff --git a/src/Psalm/Internal/Analyzer/Statements/DeclareAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/DeclareAnalyzer.php index fed7eb3e1f1..ee3c8059c46 100644 --- a/src/Psalm/Internal/Analyzer/Statements/DeclareAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/DeclareAnalyzer.php @@ -19,7 +19,7 @@ final class DeclareAnalyzer public static function analyze( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Stmt\Declare_ $stmt, - Context $context + Context $context, ): void { foreach ($stmt->declares as $declaration) { $declaration_key = (string) $declaration->key; @@ -55,7 +55,7 @@ public static function analyze( private static function analyzeStrictTypesDeclaration( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Stmt\DeclareDeclare $declaration, - Context $context + Context $context, ): void { if (!$declaration->value instanceof PhpParser\Node\Scalar\LNumber || !in_array($declaration->value->value, [0, 1], true) @@ -78,7 +78,7 @@ private static function analyzeStrictTypesDeclaration( private static function analyzeTicksDeclaration( StatementsAnalyzer $statements_analyzer, - PhpParser\Node\Stmt\DeclareDeclare $declaration + PhpParser\Node\Stmt\DeclareDeclare $declaration, ): void { if (!$declaration->value instanceof PhpParser\Node\Scalar\LNumber) { IssueBuffer::maybeAdd( @@ -93,7 +93,7 @@ private static function analyzeTicksDeclaration( private static function analyzeEncodingDeclaration( StatementsAnalyzer $statements_analyzer, - PhpParser\Node\Stmt\DeclareDeclare $declaration + PhpParser\Node\Stmt\DeclareDeclare $declaration, ): void { if (!$declaration->value instanceof PhpParser\Node\Scalar\String_) { IssueBuffer::maybeAdd( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php index a6004cda383..0c1bdcf0010 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php @@ -979,7 +979,7 @@ private static function handleEnumName( StatementsAnalyzer $statements_analyzer, PropertyFetch $stmt, Union $stmt_var_type, - ClassLikeStorage $class_storage + ClassLikeStorage $class_storage, ): void { $relevant_enum_cases = array_filter( $stmt_var_type->getAtomicTypes(), diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index 21285a405e4..5a2df4e477f 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -1043,7 +1043,7 @@ private static function initBaseline( Config $config, string $current_dir, ?string $path_to_config, - ?array $paths_to_check + ?array $paths_to_check, ): array { $issue_baseline = []; diff --git a/src/Psalm/Internal/Codebase/AssertionsFromInheritanceResolver.php b/src/Psalm/Internal/Codebase/AssertionsFromInheritanceResolver.php index aa42e2a8942..397633c5e19 100644 --- a/src/Psalm/Internal/Codebase/AssertionsFromInheritanceResolver.php +++ b/src/Psalm/Internal/Codebase/AssertionsFromInheritanceResolver.php @@ -22,7 +22,7 @@ final class AssertionsFromInheritanceResolver private Codebase $codebase; public function __construct( - Codebase $codebase + Codebase $codebase, ) { $this->codebase = $codebase; } @@ -32,7 +32,7 @@ public function __construct( */ public function resolve( MethodStorage $method_storage, - ClassLikeStorage $called_class + ClassLikeStorage $called_class, ): array { $method_name_lc = strtolower($method_storage->cased_name ?? ''); diff --git a/src/Psalm/Internal/Codebase/Methods.php b/src/Psalm/Internal/Codebase/Methods.php index d7df9928512..0f961f65a22 100644 --- a/src/Psalm/Internal/Codebase/Methods.php +++ b/src/Psalm/Internal/Codebase/Methods.php @@ -560,7 +560,7 @@ public function getMethodReturnType( ?string &$self_class, ?SourceAnalyzer $source_analyzer = null, ?array $args = null, - ?TemplateResult $template_result = null + ?TemplateResult $template_result = null, ): ?Union { $original_fq_class_name = $method_id->fq_class_name; $original_method_name = $method_id->method_name; diff --git a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php index b590ef98d25..d8fb79f7044 100644 --- a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php @@ -2943,7 +2943,7 @@ private static function reconcileClassConstant( private static function reconcileValueOf( Codebase $codebase, TValueOf $assertion_type, - int &$failed_reconciliation + int &$failed_reconciliation, ): ?Union { $reconciled_types = []; diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php index 01bfc03c8c1..7960ef264b6 100644 --- a/src/Psalm/Type.php +++ b/src/Psalm/Type.php @@ -263,10 +263,9 @@ public static function getNumericString(): Union /** * @psalm-suppress PossiblyUnusedMethod - * @param int|string $value * @return TLiteralString|TLiteralInt */ - public static function getLiteral($value): Atomic + public static function getLiteral(int|string $value): Atomic { if (is_int($value)) { return new TLiteralInt($value); diff --git a/src/Psalm/Type/Atomic/TCallableKeyedArray.php b/src/Psalm/Type/Atomic/TCallableKeyedArray.php index 71ca857cc97..d52681c4e6d 100644 --- a/src/Psalm/Type/Atomic/TCallableKeyedArray.php +++ b/src/Psalm/Type/Atomic/TCallableKeyedArray.php @@ -27,7 +27,7 @@ public function __construct( array $properties, ?array $class_strings = null, ?array $fallback_params = null, - bool $from_docblock = false + bool $from_docblock = false, ) { parent::__construct( $properties, From 5953b1c53a1bf93192ecf9a9f0fba199b4d8137a Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 11:35:11 +0200 Subject: [PATCH 24/38] Fixes --- .../Reflector/ClassLikeNodeScanner.php | 2 +- src/Psalm/Storage/EnumCaseStorage.php | 23 +++++++++++++++---- src/Psalm/Type/UnionTrait.php | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php index 723e1e3b5c0..aaaa127d7a6 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php @@ -1459,7 +1459,7 @@ private function visitEnumDeclaration( if (!isset($storage->enum_cases[$stmt->name->name])) { $case = new EnumCaseStorage( - $enum_value?->value, + $enum_value, $case_location, ); diff --git a/src/Psalm/Storage/EnumCaseStorage.php b/src/Psalm/Storage/EnumCaseStorage.php index ca9be915aae..6d33895cf22 100644 --- a/src/Psalm/Storage/EnumCaseStorage.php +++ b/src/Psalm/Storage/EnumCaseStorage.php @@ -1,18 +1,31 @@ value = $value; + $this->stmt_location = $location; } } diff --git a/src/Psalm/Type/UnionTrait.php b/src/Psalm/Type/UnionTrait.php index cd61607b7ba..8ae3600764e 100644 --- a/src/Psalm/Type/UnionTrait.php +++ b/src/Psalm/Type/UnionTrait.php @@ -1212,6 +1212,7 @@ public function isSingleLiteral(): bool /** * @psalm-mutation-free + * @psalm-suppress InvalidFalsableReturnType */ public function getSingleLiteral(): TLiteralInt|TLiteralString|TLiteralFloat { From 1745c8368d6b65c64e0fad87ae65ca6606122fe5 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 12:02:32 +0200 Subject: [PATCH 25/38] Finalize all classes --- src/Psalm/CodeLocation/DocblockTypeLocation.php | 2 +- src/Psalm/CodeLocation/ParseErrorLocation.php | 2 +- src/Psalm/CodeLocation/Raw.php | 2 +- src/Psalm/Internal/Algebra.php | 2 +- src/Psalm/Internal/Algebra/FormulaGenerator.php | 2 +- src/Psalm/Internal/Analyzer/AlgebraAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/AttributesAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/ClassAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php | 2 +- src/Psalm/Internal/Analyzer/ClosureAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/CommentAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/DataFlowNodeData.php | 2 +- src/Psalm/Internal/Analyzer/FunctionAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php | 2 +- .../Internal/Analyzer/FunctionLike/ReturnTypeCollector.php | 2 +- src/Psalm/Internal/Analyzer/InterfaceAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/IssueData.php | 2 +- src/Psalm/Internal/Analyzer/MethodAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/MethodComparator.php | 2 +- src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/ProjectAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/ScopeAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/Block/DoAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/Block/ForAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Block/ForeachAnalyzer.php | 2 +- .../Analyzer/Statements/Block/IfConditionalAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Block/IfElse/ElseAnalyzer.php | 2 +- .../Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/Block/SwitchAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Block/SwitchCaseAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/Block/WhileAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/BreakAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/ContinueAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/EchoAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/ArrayCreationInfo.php | 2 +- .../Internal/Analyzer/Statements/Expression/AssertionFinder.php | 2 +- .../Expression/Assignment/ArrayAssignmentAnalyzer.php | 2 +- .../Statements/Expression/Assignment/AssignedProperty.php | 2 +- .../Assignment/InstancePropertyAssignmentAnalyzer.php | 2 +- .../Expression/Assignment/StaticPropertyAssignmentAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/AssignmentAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php | 2 +- .../Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php | 2 +- .../Statements/Expression/BinaryOp/CoalesceAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php | 2 +- .../Statements/Expression/BinaryOp/NonComparisonOpAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/BinaryOpAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/BitwiseNotAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/BooleanNotAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php | 2 +- .../Statements/Expression/Call/ArgumentMapPopulator.php | 2 +- .../Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php | 2 +- .../Expression/Call/ArrayFunctionArgumentsAnalyzer.php | 2 +- .../Statements/Expression/Call/ClassTemplateParamCollector.php | 2 +- .../Statements/Expression/Call/FunctionCallAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/Call/FunctionCallInfo.php | 2 +- .../Expression/Call/FunctionCallReturnTypeFetcher.php | 2 +- .../Statements/Expression/Call/Method/AtomicCallContext.php | 2 +- .../Expression/Call/Method/AtomicMethodCallAnalysisResult.php | 2 +- .../Expression/Call/Method/AtomicMethodCallAnalyzer.php | 2 +- .../Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php | 2 +- .../Expression/Call/Method/MethodCallProhibitionAnalyzer.php | 2 +- .../Expression/Call/Method/MethodCallPurityAnalyzer.php | 2 +- .../Expression/Call/Method/MethodCallReturnTypeFetcher.php | 2 +- .../Expression/Call/Method/MethodVisibilityAnalyzer.php | 2 +- .../Expression/Call/Method/MissingMethodCallHandler.php | 2 +- .../Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php | 2 +- .../Statements/Expression/Call/NamedFunctionCallHandler.php | 2 +- .../Analyzer/Statements/Expression/Call/NewAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php | 2 +- .../Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php | 2 +- .../Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/CastAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/ClassConstAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/CloneAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/EmptyAnalyzer.php | 2 +- .../Statements/Expression/EncapsulatedStringAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/EvalAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/ExitAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/ExpressionIdentifier.php | 2 +- .../Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php | 2 +- .../Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php | 2 +- .../Expression/Fetch/InstancePropertyFetchAnalyzer.php | 2 +- .../Statements/Expression/Fetch/StaticPropertyFetchAnalyzer.php | 2 +- .../Statements/Expression/Fetch/VariableFetchAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/IncDecExpressionAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/InstanceofAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/IssetAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/MagicConstAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/MatchAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/NullsafeAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/PrintAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/SimpleTypeInferer.php | 2 +- .../Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/UnaryPlusMinusAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/YieldAnalyzer.php | 2 +- .../Analyzer/Statements/Expression/YieldFromAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/ThrowAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/UnusedAssignmentRemover.php | 2 +- src/Psalm/Internal/Analyzer/StatementsAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/TraitAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/TypeAnalyzer.php | 2 +- src/Psalm/Internal/Cache.php | 2 +- src/Psalm/Internal/Clause.php | 2 +- src/Psalm/Internal/Codebase/Analyzer.php | 2 +- src/Psalm/Internal/Codebase/ClassLikes.php | 2 +- src/Psalm/Internal/Codebase/ConstantTypeResolver.php | 2 +- src/Psalm/Internal/Codebase/Functions.php | 2 +- src/Psalm/Internal/Codebase/InternalCallMapHandler.php | 2 +- src/Psalm/Internal/Codebase/Methods.php | 2 +- src/Psalm/Internal/Codebase/Populator.php | 2 +- src/Psalm/Internal/Codebase/Properties.php | 2 +- src/Psalm/Internal/Codebase/PropertyMap.php | 2 +- src/Psalm/Internal/Codebase/ReferenceMapGenerator.php | 2 +- src/Psalm/Internal/Codebase/Reflection.php | 2 +- src/Psalm/Internal/Codebase/Scanner.php | 2 +- src/Psalm/Internal/Codebase/TaintFlowGraph.php | 2 +- src/Psalm/Internal/Codebase/VariableUseGraph.php | 2 +- src/Psalm/Internal/DataFlow/Path.php | 2 +- src/Psalm/Internal/DataFlow/TaintSink.php | 2 +- src/Psalm/Internal/DataFlow/TaintSource.php | 2 +- src/Psalm/Internal/Diff/ClassStatementsDiffer.php | 2 +- src/Psalm/Internal/Diff/DiffElem.php | 2 +- src/Psalm/Internal/Diff/FileDiffer.php | 2 +- src/Psalm/Internal/Diff/FileStatementsDiffer.php | 2 +- src/Psalm/Internal/Diff/NamespaceStatementsDiffer.php | 2 +- src/Psalm/Internal/EventDispatcher.php | 2 +- src/Psalm/Internal/ExecutionEnvironment/BuildInfoCollector.php | 2 +- src/Psalm/Internal/ExecutionEnvironment/GitInfoCollector.php | 2 +- .../Internal/FileManipulation/ClassDocblockManipulator.php | 2 +- src/Psalm/Internal/FileManipulation/CodeMigration.php | 2 +- src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php | 2 +- .../Internal/FileManipulation/FunctionDocblockManipulator.php | 2 +- .../Internal/FileManipulation/PropertyDocblockManipulator.php | 2 +- src/Psalm/Internal/Fork/ForkProcessDoneMessage.php | 2 +- src/Psalm/Internal/Fork/ForkProcessErrorMessage.php | 2 +- src/Psalm/Internal/Fork/ForkTaskDoneMessage.php | 2 +- src/Psalm/Internal/Fork/Pool.php | 2 +- src/Psalm/Internal/Fork/PsalmRestarter.php | 2 +- src/Psalm/Internal/Json/Json.php | 2 +- src/Psalm/Internal/LanguageServer/Client/TextDocument.php | 2 +- src/Psalm/Internal/LanguageServer/Client/Workspace.php | 2 +- src/Psalm/Internal/LanguageServer/ClientConfiguration.php | 2 +- src/Psalm/Internal/LanguageServer/ClientHandler.php | 2 +- src/Psalm/Internal/LanguageServer/IdGenerator.php | 2 +- src/Psalm/Internal/LanguageServer/LanguageClient.php | 2 +- src/Psalm/Internal/LanguageServer/LanguageServer.php | 2 +- src/Psalm/Internal/LanguageServer/Message.php | 2 +- src/Psalm/Internal/LanguageServer/PHPMarkdownContent.php | 2 +- src/Psalm/Internal/LanguageServer/Progress.php | 2 +- src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php | 2 +- src/Psalm/Internal/LanguageServer/ProtocolStreamWriter.php | 2 +- .../LanguageServer/Provider/ClassLikeStorageCacheProvider.php | 2 +- .../LanguageServer/Provider/FileReferenceCacheProvider.php | 2 +- .../LanguageServer/Provider/FileStorageCacheProvider.php | 2 +- .../Internal/LanguageServer/Provider/ParserCacheProvider.php | 2 +- .../Internal/LanguageServer/Provider/ProjectCacheProvider.php | 2 +- src/Psalm/Internal/LanguageServer/Reference.php | 2 +- src/Psalm/Internal/LanguageServer/Server/TextDocument.php | 2 +- src/Psalm/Internal/LanguageServer/Server/Workspace.php | 2 +- src/Psalm/Internal/MethodIdentifier.php | 2 +- src/Psalm/Internal/PhpTraverser/CustomTraverser.php | 2 +- src/Psalm/Internal/PhpVisitor/AssignmentMapVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/CheckTrivialExprVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/CloningVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/ConditionCloningVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/NodeCleanerVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/NodeCounterVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/OffsetShifterVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/ParamReplacementVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/PartialParserVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/Reflector/AttributeResolver.php | 2 +- .../Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php | 2 +- .../Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php | 2 +- src/Psalm/Internal/PhpVisitor/Reflector/ExpressionResolver.php | 2 +- src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php | 2 +- .../PhpVisitor/Reflector/FunctionLikeDocblockParser.php | 2 +- .../PhpVisitor/Reflector/FunctionLikeDocblockScanner.php | 2 +- .../Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php | 2 +- src/Psalm/Internal/PhpVisitor/Reflector/TypeHintResolver.php | 2 +- src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/SimpleNameResolver.php | 2 +- src/Psalm/Internal/PhpVisitor/TraitFinder.php | 2 +- src/Psalm/Internal/PhpVisitor/TypeMappingVisitor.php | 2 +- src/Psalm/Internal/PhpVisitor/YieldTypeCollector.php | 2 +- src/Psalm/Internal/PluginManager/Command/DisableCommand.php | 2 +- src/Psalm/Internal/PluginManager/Command/EnableCommand.php | 2 +- src/Psalm/Internal/PluginManager/Command/ShowCommand.php | 2 +- src/Psalm/Internal/PluginManager/ComposerLock.php | 2 +- src/Psalm/Internal/PluginManager/ConfigFile.php | 2 +- src/Psalm/Internal/PluginManager/PluginList.php | 2 +- src/Psalm/Internal/PluginManager/PluginListFactory.php | 2 +- .../Internal/Provider/AddRemoveTaints/HtmlFunctionTainter.php | 2 +- src/Psalm/Internal/Provider/ClassLikeStorageProvider.php | 2 +- src/Psalm/Internal/Provider/FakeFileProvider.php | 2 +- src/Psalm/Internal/Provider/FileReferenceProvider.php | 2 +- src/Psalm/Internal/Provider/FileStorageProvider.php | 2 +- src/Psalm/Internal/Provider/FunctionExistenceProvider.php | 2 +- src/Psalm/Internal/Provider/FunctionParamsProvider.php | 2 +- src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php | 2 +- src/Psalm/Internal/Provider/MethodExistenceProvider.php | 2 +- src/Psalm/Internal/Provider/MethodParamsProvider.php | 2 +- src/Psalm/Internal/Provider/MethodReturnTypeProvider.php | 2 +- src/Psalm/Internal/Provider/MethodVisibilityProvider.php | 2 +- src/Psalm/Internal/Provider/NodeDataProvider.php | 2 +- src/Psalm/Internal/Provider/PropertyExistenceProvider.php | 2 +- src/Psalm/Internal/Provider/PropertyTypeProvider.php | 2 +- .../PropertyTypeProvider/DomDocumentPropertyTypeProvider.php | 2 +- src/Psalm/Internal/Provider/PropertyVisibilityProvider.php | 2 +- src/Psalm/Internal/Provider/Providers.php | 2 +- .../ReturnTypeProvider/ArrayChunkReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/ArrayColumnReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/ArrayCombineReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/ArrayFillKeysReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/ArrayFillReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/ArrayFilterReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/ArrayMergeReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/ArrayPadReturnTypeProvider.php | 2 +- .../ArrayPointerAdjustmentReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/ArrayPopReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/ArrayRandReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/ArrayReduceReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/ArrayReverseReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/ArraySliceReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/ArraySpliceReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/BasenameReturnTypeProvider.php | 2 +- .../ClosureFromCallableReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/DateReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/DirnameReturnTypeProvider.php | 2 +- .../Internal/Provider/ReturnTypeProvider/DomNodeAppendChild.php | 2 +- .../Provider/ReturnTypeProvider/FilterVarReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/FirstArgStringReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/GetClassMethodsReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/GetObjectVarsReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/HexdecReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/ImagickPixelColorReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/InArrayReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/IteratorToArrayReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/MbInternalEncodingReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/MinMaxReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/MktimeReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/ParseUrlReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/PdoStatementReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/PdoStatementSetFetchMode.php | 2 +- .../Provider/ReturnTypeProvider/PowReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/RandReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/RoundReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/SprintfReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/StrReplaceReturnTypeProvider.php | 2 +- .../Provider/ReturnTypeProvider/StrTrReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/TriggerErrorReturnTypeProvider.php | 2 +- .../ReturnTypeProvider/VersionCompareReturnTypeProvider.php | 2 +- src/Psalm/Internal/Provider/StatementsProvider.php | 2 +- src/Psalm/Internal/ReferenceConstraint.php | 2 +- src/Psalm/Internal/Scanner/ClassLikeDocblockComment.php | 2 +- src/Psalm/Internal/Scanner/DocblockParser.php | 2 +- src/Psalm/Internal/Scanner/FunctionDocblockComment.php | 2 +- src/Psalm/Internal/Scanner/ParsedDocblock.php | 2 +- src/Psalm/Internal/Scanner/PhpStormMetaScanner.php | 2 +- .../Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php | 2 +- src/Psalm/Internal/Scanner/UnresolvedConstant/ArraySpread.php | 2 +- src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayValue.php | 2 +- src/Psalm/Internal/Scanner/UnresolvedConstant/ClassConstant.php | 2 +- src/Psalm/Internal/Scanner/UnresolvedConstant/Constant.php | 2 +- src/Psalm/Internal/Scanner/UnresolvedConstant/EnumNameFetch.php | 2 +- .../Internal/Scanner/UnresolvedConstant/EnumValueFetch.php | 2 +- src/Psalm/Internal/Scanner/UnresolvedConstant/KeyValuePair.php | 2 +- src/Psalm/Internal/Scanner/UnresolvedConstant/ScalarValue.php | 2 +- .../Scanner/UnresolvedConstant/UnresolvedAdditionOp.php | 2 +- .../Scanner/UnresolvedConstant/UnresolvedBitwiseAnd.php | 2 +- .../Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseOr.php | 2 +- .../Scanner/UnresolvedConstant/UnresolvedBitwiseXor.php | 2 +- .../Internal/Scanner/UnresolvedConstant/UnresolvedConcatOp.php | 2 +- .../Scanner/UnresolvedConstant/UnresolvedDivisionOp.php | 2 +- .../Scanner/UnresolvedConstant/UnresolvedMultiplicationOp.php | 2 +- .../Scanner/UnresolvedConstant/UnresolvedSubtractionOp.php | 2 +- .../Internal/Scanner/UnresolvedConstant/UnresolvedTernary.php | 2 +- src/Psalm/Internal/Scanner/VarDocblockComment.php | 2 +- src/Psalm/Internal/Scope/CaseScope.php | 2 +- src/Psalm/Internal/Scope/FinallyScope.php | 2 +- src/Psalm/Internal/Scope/IfConditionalScope.php | 2 +- src/Psalm/Internal/Scope/IfScope.php | 2 +- src/Psalm/Internal/Scope/LoopScope.php | 2 +- src/Psalm/Internal/Scope/SwitchScope.php | 2 +- src/Psalm/Internal/Stubs/Generator/ClassLikeStubGenerator.php | 2 +- src/Psalm/Internal/Stubs/Generator/StubsGenerator.php | 2 +- src/Psalm/Internal/Type/ArrayType.php | 2 +- src/Psalm/Internal/Type/AssertionReconciler.php | 2 +- src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php | 2 +- src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php | 2 +- src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php | 2 +- .../Internal/Type/Comparator/ClassLikeStringComparator.php | 2 +- src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php | 2 +- src/Psalm/Internal/Type/Comparator/IntegerRangeComparator.php | 2 +- src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php | 2 +- src/Psalm/Internal/Type/Comparator/ObjectComparator.php | 2 +- src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php | 2 +- src/Psalm/Internal/Type/Comparator/TypeComparisonResult.php | 2 +- src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php | 2 +- src/Psalm/Internal/Type/NegatedAssertionReconciler.php | 2 +- src/Psalm/Internal/Type/ParseTree/CallableParamTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/CallableTree.php | 2 +- .../Internal/Type/ParseTree/CallableWithReturnTypeTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/ConditionalTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/EncapsulationTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/FieldEllipsis.php | 2 +- src/Psalm/Internal/Type/ParseTree/GenericTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/IndexedAccessTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/IntersectionTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/KeyedArrayPropertyTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/KeyedArrayTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/MethodParamTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/MethodTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/MethodWithReturnTypeTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/NullableTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/Root.php | 2 +- src/Psalm/Internal/Type/ParseTree/TemplateAsTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/TemplateIsTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/UnionTree.php | 2 +- src/Psalm/Internal/Type/ParseTree/Value.php | 2 +- src/Psalm/Internal/Type/ParseTreeCreator.php | 2 +- src/Psalm/Internal/Type/SimpleAssertionReconciler.php | 2 +- src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php | 2 +- src/Psalm/Internal/Type/TemplateBound.php | 2 +- src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php | 2 +- src/Psalm/Internal/Type/TemplateResult.php | 2 +- src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php | 2 +- src/Psalm/Internal/Type/TypeAlias/ClassTypeAlias.php | 2 +- src/Psalm/Internal/Type/TypeAlias/InlineTypeAlias.php | 2 +- src/Psalm/Internal/Type/TypeAlias/LinkableTypeAlias.php | 2 +- src/Psalm/Internal/Type/TypeCombination.php | 2 +- src/Psalm/Internal/Type/TypeCombiner.php | 2 +- src/Psalm/Internal/Type/TypeExpander.php | 2 +- src/Psalm/Internal/Type/TypeParser.php | 2 +- src/Psalm/Internal/Type/TypeTokenizer.php | 2 +- src/Psalm/Internal/TypeVisitor/CanContainObjectTypeVisitor.php | 2 +- src/Psalm/Internal/TypeVisitor/ClasslikeReplacer.php | 2 +- src/Psalm/Internal/TypeVisitor/ContainsClassLikeVisitor.php | 2 +- src/Psalm/Internal/TypeVisitor/ContainsLiteralVisitor.php | 2 +- src/Psalm/Internal/TypeVisitor/ContainsStaticVisitor.php | 2 +- src/Psalm/Internal/TypeVisitor/FromDocblockSetter.php | 2 +- src/Psalm/Internal/TypeVisitor/TemplateTypeCollector.php | 2 +- src/Psalm/Internal/TypeVisitor/TypeChecker.php | 2 +- src/Psalm/Internal/TypeVisitor/TypeLocalizer.php | 2 +- src/Psalm/Internal/TypeVisitor/TypeScanner.php | 2 +- src/Psalm/Issue/InvalidInterfaceImplementation.php | 2 +- src/Psalm/Issue/PrivateFinalMethod.php | 2 +- src/Psalm/Issue/RiskyCast.php | 2 +- src/Psalm/Issue/UnusedBaselineEntry.php | 2 +- src/Psalm/Report/CountReport.php | 2 +- src/Psalm/Type/Atomic/TNonEmptyArray.php | 2 +- 367 files changed, 367 insertions(+), 367 deletions(-) diff --git a/src/Psalm/CodeLocation/DocblockTypeLocation.php b/src/Psalm/CodeLocation/DocblockTypeLocation.php index 31c1522742a..36a76aef192 100644 --- a/src/Psalm/CodeLocation/DocblockTypeLocation.php +++ b/src/Psalm/CodeLocation/DocblockTypeLocation.php @@ -8,7 +8,7 @@ use Psalm\FileSource; /** @psalm-immutable */ -class DocblockTypeLocation extends CodeLocation +final class DocblockTypeLocation extends CodeLocation { public function __construct( FileSource $file_source, diff --git a/src/Psalm/CodeLocation/ParseErrorLocation.php b/src/Psalm/CodeLocation/ParseErrorLocation.php index 9b85124d979..d20d96eb8e1 100644 --- a/src/Psalm/CodeLocation/ParseErrorLocation.php +++ b/src/Psalm/CodeLocation/ParseErrorLocation.php @@ -11,7 +11,7 @@ use function substr_count; /** @psalm-immutable */ -class ParseErrorLocation extends CodeLocation +final class ParseErrorLocation extends CodeLocation { public function __construct( PhpParser\Error $error, diff --git a/src/Psalm/CodeLocation/Raw.php b/src/Psalm/CodeLocation/Raw.php index c3496c9d3b3..bcafcaa7d25 100644 --- a/src/Psalm/CodeLocation/Raw.php +++ b/src/Psalm/CodeLocation/Raw.php @@ -10,7 +10,7 @@ use function substr_count; /** @psalm-immutable */ -class Raw extends CodeLocation +final class Raw extends CodeLocation { public function __construct( string $file_contents, diff --git a/src/Psalm/Internal/Algebra.php b/src/Psalm/Internal/Algebra.php index c4f768c1110..1efde065886 100644 --- a/src/Psalm/Internal/Algebra.php +++ b/src/Psalm/Internal/Algebra.php @@ -25,7 +25,7 @@ /** * @internal */ -class Algebra +final class Algebra { /** * @param array>> $all_types diff --git a/src/Psalm/Internal/Algebra/FormulaGenerator.php b/src/Psalm/Internal/Algebra/FormulaGenerator.php index c5bc9512c22..e6e42b7b4f9 100644 --- a/src/Psalm/Internal/Algebra/FormulaGenerator.php +++ b/src/Psalm/Internal/Algebra/FormulaGenerator.php @@ -23,7 +23,7 @@ /** * @internal */ -class FormulaGenerator +final class FormulaGenerator { /** * @return list diff --git a/src/Psalm/Internal/Analyzer/AlgebraAnalyzer.php b/src/Psalm/Internal/Analyzer/AlgebraAnalyzer.php index d45ed80f6cd..71f22863d2d 100644 --- a/src/Psalm/Internal/Analyzer/AlgebraAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/AlgebraAnalyzer.php @@ -22,7 +22,7 @@ /** * @internal */ -class AlgebraAnalyzer +final class AlgebraAnalyzer { /** * This looks to see if there are any clauses in one formula that contradict diff --git a/src/Psalm/Internal/Analyzer/AttributesAnalyzer.php b/src/Psalm/Internal/Analyzer/AttributesAnalyzer.php index fe5b2718bb6..9f3e94472f8 100644 --- a/src/Psalm/Internal/Analyzer/AttributesAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/AttributesAnalyzer.php @@ -35,7 +35,7 @@ /** * @internal */ -class AttributesAnalyzer +final class AttributesAnalyzer { private const TARGET_DESCRIPTIONS = [ 1 => 'class', diff --git a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php index a541e15c7b8..3842dce767d 100644 --- a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php @@ -108,7 +108,7 @@ /** * @internal */ -class ClassAnalyzer extends ClassLikeAnalyzer +final class ClassAnalyzer extends ClassLikeAnalyzer { /** * @var array diff --git a/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php b/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php index 3348d549ae2..d1fb0c95218 100644 --- a/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php +++ b/src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php @@ -7,7 +7,7 @@ /** * @internal */ -class ClassLikeNameOptions +final class ClassLikeNameOptions { public bool $inferred; diff --git a/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php b/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php index 0648f7a9e23..34cd81bc0fb 100644 --- a/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php @@ -29,7 +29,7 @@ * @internal * @extends FunctionLikeAnalyzer */ -class ClosureAnalyzer extends FunctionLikeAnalyzer +final class ClosureAnalyzer extends FunctionLikeAnalyzer { /** * @param PhpParser\Node\Expr\Closure|PhpParser\Node\Expr\ArrowFunction $function diff --git a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php index 2d4880fd55f..aabd1747028 100644 --- a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php @@ -44,7 +44,7 @@ /** * @internal */ -class CommentAnalyzer +final class CommentAnalyzer { public const TYPE_REGEX = '(\??\\\?[\(\)A-Za-z0-9_&\<\.=,\>\[\]\-\{\}:|?\\\\]*|\$[a-zA-Z_0-9_]+)'; diff --git a/src/Psalm/Internal/Analyzer/DataFlowNodeData.php b/src/Psalm/Internal/Analyzer/DataFlowNodeData.php index 59cb5fccb18..7f2e989a547 100644 --- a/src/Psalm/Internal/Analyzer/DataFlowNodeData.php +++ b/src/Psalm/Internal/Analyzer/DataFlowNodeData.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class DataFlowNodeData +final class DataFlowNodeData { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/Analyzer/FunctionAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionAnalyzer.php index 923bbbf2f63..bcf1395909a 100644 --- a/src/Psalm/Internal/Analyzer/FunctionAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionAnalyzer.php @@ -16,7 +16,7 @@ * @internal * @extends FunctionLikeAnalyzer */ -class FunctionAnalyzer extends FunctionLikeAnalyzer +final class FunctionAnalyzer extends FunctionLikeAnalyzer { public function __construct(PhpParser\Node\Stmt\Function_ $function, SourceAnalyzer $source) { diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php index d10fccb4158..bc571e03548 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php @@ -65,7 +65,7 @@ /** * @internal */ -class ReturnTypeAnalyzer +final class ReturnTypeAnalyzer { /** * @param Closure|Function_|ClassMethod|ArrowFunction $function diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php index b1fc8aafc84..21e9d22d1c4 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php +++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php @@ -25,7 +25,7 @@ * * @internal */ -class ReturnTypeCollector +final class ReturnTypeCollector { /** * Gets the return types from a list of statements diff --git a/src/Psalm/Internal/Analyzer/InterfaceAnalyzer.php b/src/Psalm/Internal/Analyzer/InterfaceAnalyzer.php index 0edb40528c4..fc798e4433e 100644 --- a/src/Psalm/Internal/Analyzer/InterfaceAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/InterfaceAnalyzer.php @@ -27,7 +27,7 @@ /** * @internal */ -class InterfaceAnalyzer extends ClassLikeAnalyzer +final class InterfaceAnalyzer extends ClassLikeAnalyzer { public function __construct( PhpParser\Node\Stmt\Interface_ $interface, diff --git a/src/Psalm/Internal/Analyzer/IssueData.php b/src/Psalm/Internal/Analyzer/IssueData.php index cafb68001cc..9e90b2d9020 100644 --- a/src/Psalm/Internal/Analyzer/IssueData.php +++ b/src/Psalm/Internal/Analyzer/IssueData.php @@ -11,7 +11,7 @@ /** * @internal */ -class IssueData +final class IssueData { public const SEVERITY_INFO = 'info'; public const SEVERITY_ERROR = 'error'; diff --git a/src/Psalm/Internal/Analyzer/MethodAnalyzer.php b/src/Psalm/Internal/Analyzer/MethodAnalyzer.php index 9ed7e955bec..3758cd06bef 100644 --- a/src/Psalm/Internal/Analyzer/MethodAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/MethodAnalyzer.php @@ -29,7 +29,7 @@ * @internal * @extends FunctionLikeAnalyzer */ -class MethodAnalyzer extends FunctionLikeAnalyzer +final class MethodAnalyzer extends FunctionLikeAnalyzer { // https://github.com/php/php-src/blob/a83923044c48982c80804ae1b45e761c271966d3/Zend/zend_enum.c#L77-L95 private const FORBIDDEN_ENUM_METHODS = [ diff --git a/src/Psalm/Internal/Analyzer/MethodComparator.php b/src/Psalm/Internal/Analyzer/MethodComparator.php index 3fbd080d7c9..1a4b01f5fbd 100644 --- a/src/Psalm/Internal/Analyzer/MethodComparator.php +++ b/src/Psalm/Internal/Analyzer/MethodComparator.php @@ -46,7 +46,7 @@ /** * @internal */ -class MethodComparator +final class MethodComparator { /** * @param string[] $suppressed_issues diff --git a/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php b/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php index 16afcb9b83b..6974a4c45e9 100644 --- a/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php @@ -24,7 +24,7 @@ /** * @internal */ -class NamespaceAnalyzer extends SourceAnalyzer +final class NamespaceAnalyzer extends SourceAnalyzer { use CanAlias; diff --git a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php index f2464a1c4ad..2999499f382 100644 --- a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php @@ -99,7 +99,7 @@ /** * @internal */ -class ProjectAnalyzer +final class ProjectAnalyzer { /** * Cached config diff --git a/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php b/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php index d32aa2cfde0..bca1b1aa895 100644 --- a/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ScopeAnalyzer.php @@ -19,7 +19,7 @@ /** * @internal */ -class ScopeAnalyzer +final class ScopeAnalyzer { public const ACTION_END = 'END'; public const ACTION_BREAK = 'BREAK'; diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/DoAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/DoAnalyzer.php index 4d74cd3808c..236b8a1f791 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/DoAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/DoAnalyzer.php @@ -30,7 +30,7 @@ /** * @internal */ -class DoAnalyzer +final class DoAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/ForAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/ForAnalyzer.php index 7d96a9c4ffd..ad1b5a601de 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/ForAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/ForAnalyzer.php @@ -21,7 +21,7 @@ /** * @internal */ -class ForAnalyzer +final class ForAnalyzer { /** * @return false|null diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php index e419a6a3747..54fd5391bcd 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php @@ -75,7 +75,7 @@ /** * @internal */ -class ForeachAnalyzer +final class ForeachAnalyzer { /** * @return false|null diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php index e75b8525b54..843bbbce0de 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php @@ -31,7 +31,7 @@ /** * @internal */ -class IfConditionalAnalyzer +final class IfConditionalAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseAnalyzer.php index ec96cb8e4e9..f33293ca9bc 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseAnalyzer.php @@ -28,7 +28,7 @@ /** * @internal */ -class ElseAnalyzer +final class ElseAnalyzer { /** * @return false|null diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php index 823ff884990..4a7769247b2 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php @@ -42,7 +42,7 @@ /** * @internal */ -class ElseIfAnalyzer +final class ElseIfAnalyzer { /** * @return false|null diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php index e005c1c6991..2168ed3f956 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php @@ -48,7 +48,7 @@ /** * @internal */ -class IfAnalyzer +final class IfAnalyzer { /** * @param array $pre_assignment_else_redefined_vars diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php index e2e45b76b31..273842a3722 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php @@ -43,7 +43,7 @@ /** * @internal */ -class IfElseAnalyzer +final class IfElseAnalyzer { /** * System of type substitution and deletion diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php index f1cbe68619b..c3a7648aafc 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php @@ -30,7 +30,7 @@ /** * @internal */ -class LoopAnalyzer +final class LoopAnalyzer { /** * Checks an array of statements in a loop diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/SwitchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/SwitchAnalyzer.php index ad676bcc99f..e5dfacd83d7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/SwitchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/SwitchAnalyzer.php @@ -23,7 +23,7 @@ /** * @internal */ -class SwitchAnalyzer +final class SwitchAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/SwitchCaseAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/SwitchCaseAnalyzer.php index 500587683a7..7e1dbdd3da0 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/SwitchCaseAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/SwitchCaseAnalyzer.php @@ -55,7 +55,7 @@ /** * @internal */ -class SwitchCaseAnalyzer +final class SwitchCaseAnalyzer { /** * @return null|false diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php index f6f928102be..9222f3109a7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php @@ -34,7 +34,7 @@ /** * @internal */ -class TryAnalyzer +final class TryAnalyzer { /** * @return false|null diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/WhileAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/WhileAnalyzer.php index 25c34434270..f992eb7a489 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/WhileAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/WhileAnalyzer.php @@ -18,7 +18,7 @@ /** * @internal */ -class WhileAnalyzer +final class WhileAnalyzer { /** * @return false|null diff --git a/src/Psalm/Internal/Analyzer/Statements/BreakAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/BreakAnalyzer.php index 2d2830d7771..330918a9559 100644 --- a/src/Psalm/Internal/Analyzer/Statements/BreakAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/BreakAnalyzer.php @@ -15,7 +15,7 @@ /** * @internal */ -class BreakAnalyzer +final class BreakAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/ContinueAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ContinueAnalyzer.php index 9f6405a1dbb..b5b0de71f9f 100644 --- a/src/Psalm/Internal/Analyzer/Statements/ContinueAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/ContinueAnalyzer.php @@ -18,7 +18,7 @@ /** * @internal */ -class ContinueAnalyzer +final class ContinueAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/EchoAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/EchoAnalyzer.php index bc84fcd54e4..f04d8c131e8 100644 --- a/src/Psalm/Internal/Analyzer/Statements/EchoAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/EchoAnalyzer.php @@ -23,7 +23,7 @@ /** * @internal */ -class EchoAnalyzer +final class EchoAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php index e19e851bf09..8c6dd5d7ccd 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php @@ -54,7 +54,7 @@ /** * @internal */ -class ArrayAnalyzer +final class ArrayAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php index abe9804e680..f96db30833b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayCreationInfo.php @@ -11,7 +11,7 @@ /** * @internal */ -class ArrayCreationInfo +final class ArrayCreationInfo { /** * @var list diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php index 06620cb6f81..16ea3e83561 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php @@ -121,7 +121,7 @@ * For example if $a is an int, if($a > 0) will be turned into an assertion to make psalm understand that in the * if block, $a is a positive-int */ -class AssertionFinder +final class AssertionFinder { public const ASSIGNMENT_TO_RIGHT = 1; public const ASSIGNMENT_TO_LEFT = -1; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php index c5f0183a329..3a47c43d894 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php @@ -55,7 +55,7 @@ /** * @internal */ -class ArrayAssignmentAnalyzer +final class ArrayAssignmentAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php index 2899b17938d..7a35ff2c069 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/AssignedProperty.php @@ -9,7 +9,7 @@ /** * @internal */ -class AssignedProperty +final class AssignedProperty { public Union $property_type; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php index c88a98012b6..88a2bf6b511 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php @@ -89,7 +89,7 @@ /** * @internal */ -class InstancePropertyAssignmentAnalyzer +final class InstancePropertyAssignmentAnalyzer { /** * @param PropertyFetch|PropertyProperty $stmt diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/StaticPropertyAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/StaticPropertyAssignmentAnalyzer.php index 7eaf810c14b..990aed4dfdb 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/StaticPropertyAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/StaticPropertyAssignmentAnalyzer.php @@ -35,7 +35,7 @@ /** * @internal */ -class StaticPropertyAssignmentAnalyzer +final class StaticPropertyAssignmentAnalyzer { /** * @return false|null diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php index 6c8c3624518..fa721397922 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php @@ -98,7 +98,7 @@ /** * @internal */ -class AssignmentAnalyzer +final class AssignmentAnalyzer { /** * @param PhpParser\Node\Expr|null $assign_value This has to be null to support list destructuring diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php index 93ce365571e..911827f2c4a 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php @@ -30,7 +30,7 @@ /** * @internal */ -class AndAnalyzer +final class AndAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php index bbdd5e9f16b..90e8f78b881 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php @@ -59,7 +59,7 @@ /** * @internal */ -class ArithmeticOpAnalyzer +final class ArithmeticOpAnalyzer { public static function analyze( ?StatementsSource $statements_source, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/CoalesceAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/CoalesceAnalyzer.php index 27365076dd1..364a9ec7ef5 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/CoalesceAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/CoalesceAnalyzer.php @@ -20,7 +20,7 @@ /** * @internal */ -class CoalesceAnalyzer +final class CoalesceAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php index cdea538c329..b3f7a03e5ed 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php @@ -52,7 +52,7 @@ /** * @internal */ -class ConcatAnalyzer +final class ConcatAnalyzer { private const MAX_LITERALS = 64; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/NonComparisonOpAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/NonComparisonOpAnalyzer.php index 5ea2c1143ca..9b3b804d7b2 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/NonComparisonOpAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/NonComparisonOpAnalyzer.php @@ -16,7 +16,7 @@ /** * @internal */ -class NonComparisonOpAnalyzer +final class NonComparisonOpAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php index 9f55ba32b02..eaf715bfa37 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php @@ -38,7 +38,7 @@ /** * @internal */ -class OrAnalyzer +final class OrAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOpAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOpAnalyzer.php index 92f6b92ee61..b7c3ab3969c 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOpAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOpAnalyzer.php @@ -40,7 +40,7 @@ /** * @internal */ -class BinaryOpAnalyzer +final class BinaryOpAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BitwiseNotAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BitwiseNotAnalyzer.php index dfb83b797b5..23d0256c389 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BitwiseNotAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BitwiseNotAnalyzer.php @@ -26,7 +26,7 @@ /** * @internal */ -class BitwiseNotAnalyzer +final class BitwiseNotAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BooleanNotAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BooleanNotAnalyzer.php index 5d113df1daf..09bfb35f877 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BooleanNotAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BooleanNotAnalyzer.php @@ -17,7 +17,7 @@ /** * @internal */ -class BooleanNotAnalyzer +final class BooleanNotAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php index ff015297884..80456403bc6 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php @@ -80,7 +80,7 @@ /** * @internal */ -class ArgumentAnalyzer +final class ArgumentAnalyzer { /** * @param array> $class_generic_params diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentMapPopulator.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentMapPopulator.php index 0620ebe4703..a63d17f988e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentMapPopulator.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentMapPopulator.php @@ -23,7 +23,7 @@ /** * @internal */ -class ArgumentMapPopulator +final class ArgumentMapPopulator { /** * @param MethodCall|StaticCall|FuncCall|New_ $stmt diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php index 15053f87ea0..15eb539d662 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php @@ -66,7 +66,7 @@ /** * @internal */ -class ArgumentsAnalyzer +final class ArgumentsAnalyzer { /** * @param list $args diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php index 663c5c09c8e..f252f93bde6 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php @@ -58,7 +58,7 @@ /** * @internal */ -class ArrayFunctionArgumentsAnalyzer +final class ArrayFunctionArgumentsAnalyzer { /** * @param array $args diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php index ec731bca268..7a9f34f9fdf 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php @@ -23,7 +23,7 @@ /** * @internal */ -class ClassTemplateParamCollector +final class ClassTemplateParamCollector { /** * @param lowercase-string $method_name diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php index 72e17d8a413..77a6d7d6118 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php @@ -79,7 +79,7 @@ /** * @internal */ -class FunctionCallAnalyzer extends CallAnalyzer +final class FunctionCallAnalyzer extends CallAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php index e455be4f045..0af657998bf 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallInfo.php @@ -12,7 +12,7 @@ /** * @internal */ -class FunctionCallInfo +final class FunctionCallInfo { public ?string $function_id = null; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php index 415e394f299..2d35a9c8168 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php @@ -55,7 +55,7 @@ /** * @internal */ -class FunctionCallReturnTypeFetcher +final class FunctionCallReturnTypeFetcher { /** * @param non-empty-string $function_id diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php index 38b6571a1a1..131ca47c79e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicCallContext.php @@ -10,7 +10,7 @@ /** * @internal */ -class AtomicCallContext +final class AtomicCallContext { public MethodIdentifier $method_id; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalysisResult.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalysisResult.php index 236329be41e..3993d78e0e9 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalysisResult.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalysisResult.php @@ -10,7 +10,7 @@ /** * @internal */ -class AtomicMethodCallAnalysisResult +final class AtomicMethodCallAnalysisResult { public ?Union $return_type = null; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php index 4a363c8cf80..6ca257415ee 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php @@ -64,7 +64,7 @@ * * @internal */ -class AtomicMethodCallAnalyzer extends CallAnalyzer +final class AtomicMethodCallAnalyzer extends CallAnalyzer { /** * @param TNamedObject|TTemplateParam|null $static_type diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php index e72f142b39c..d0de3e5995a 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php @@ -57,7 +57,7 @@ /** * @internal */ -class ExistingAtomicMethodCallAnalyzer extends CallAnalyzer +final class ExistingAtomicMethodCallAnalyzer extends CallAnalyzer { /** * @param TNamedObject|TTemplateParam|null $static_type diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php index 97ad79b4052..3953e4908ae 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallProhibitionAnalyzer.php @@ -17,7 +17,7 @@ /** * @internal */ -class MethodCallProhibitionAnalyzer +final class MethodCallProhibitionAnalyzer { /** * @param string[] $suppressed_issues diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallPurityAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallPurityAnalyzer.php index 0f2677fc9f5..9da3c08543c 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallPurityAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallPurityAnalyzer.php @@ -24,7 +24,7 @@ /** * @internal */ -class MethodCallPurityAnalyzer +final class MethodCallPurityAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php index 9fee5ed5ac1..a04104107b2 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php @@ -43,7 +43,7 @@ /** * @internal */ -class MethodCallReturnTypeFetcher +final class MethodCallReturnTypeFetcher { /** * @param TNamedObject|TTemplateParam|null $static_type diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php index 0249a5c6a2a..abfe8c080d1 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodVisibilityAnalyzer.php @@ -22,7 +22,7 @@ /** * @internal */ -class MethodVisibilityAnalyzer +final class MethodVisibilityAnalyzer { /** * @param string[] $suppressed_issues diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php index 2c8e14f4a84..efa26eba6e4 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MissingMethodCallHandler.php @@ -34,7 +34,7 @@ /** * @internal */ -class MissingMethodCallHandler +final class MissingMethodCallHandler { public static function handleMagicMethod( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php index 6dfd989c581..0635bbafb32 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php @@ -43,7 +43,7 @@ /** * @internal */ -class MethodCallAnalyzer extends CallAnalyzer +final class MethodCallAnalyzer extends CallAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php index 4466c2765b5..a4f0c47d864 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php @@ -58,7 +58,7 @@ /** * @internal */ -class NamedFunctionCallHandler +final class NamedFunctionCallHandler { /** * @param lowercase-string $function_id diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php index e55a28611e0..b32b19373cb 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php @@ -69,7 +69,7 @@ /** * @internal */ -class NewAnalyzer extends CallAnalyzer +final class NewAnalyzer extends CallAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php index b9e4d72f445..5b5cc622874 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php @@ -38,7 +38,7 @@ /** * @internal */ -class StaticCallAnalyzer extends CallAnalyzer +final class StaticCallAnalyzer extends CallAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php index 8a76455c7b0..cfc1fedaacc 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php @@ -68,7 +68,7 @@ /** * @internal */ -class AtomicStaticCallAnalyzer +final class AtomicStaticCallAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php index cf292efb25f..c87fa0f8462 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php @@ -52,7 +52,7 @@ /** * @internal */ -class ExistingAtomicStaticCallAnalyzer +final class ExistingAtomicStaticCallAnalyzer { /** * @param list $args diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php index 96514cfe234..3856f18a1ad 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php @@ -59,7 +59,7 @@ /** * @internal */ -class CastAnalyzer +final class CastAnalyzer { /** @var string[] */ private const PSEUDO_CASTABLE_CLASSES = [ diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php index 22301f63f25..15723ccb0e5 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php @@ -58,7 +58,7 @@ /** * @internal */ -class ClassConstAnalyzer +final class ClassConstAnalyzer { /** * @psalm-suppress ComplexMethod to be refactored. We should probably regroup the two big if about $stmt->class and diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CloneAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CloneAnalyzer.php index 3b7aa4d4caf..f29dbba37e1 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CloneAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CloneAnalyzer.php @@ -29,7 +29,7 @@ /** * @internal */ -class CloneAnalyzer +final class CloneAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/EmptyAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/EmptyAnalyzer.php index 70c8af6c182..8b3e6990a9e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/EmptyAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/EmptyAnalyzer.php @@ -16,7 +16,7 @@ /** * @internal */ -class EmptyAnalyzer +final class EmptyAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/EncapsulatedStringAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/EncapsulatedStringAnalyzer.php index 8d62ab63ae2..3499c6c244e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/EncapsulatedStringAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/EncapsulatedStringAnalyzer.php @@ -28,7 +28,7 @@ /** * @internal */ -class EncapsulatedStringAnalyzer +final class EncapsulatedStringAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/EvalAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/EvalAnalyzer.php index 9917affb81f..093dd94e10d 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/EvalAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/EvalAnalyzer.php @@ -21,7 +21,7 @@ /** * @internal */ -class EvalAnalyzer +final class EvalAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ExitAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ExitAnalyzer.php index 12f8e9c54f0..17d5827e742 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ExitAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ExitAnalyzer.php @@ -26,7 +26,7 @@ /** * @internal */ -class ExitAnalyzer +final class ExitAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ExpressionIdentifier.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ExpressionIdentifier.php index 4ef19fc60d5..9cf2a92f518 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ExpressionIdentifier.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ExpressionIdentifier.php @@ -19,7 +19,7 @@ /** * @internal */ -class ExpressionIdentifier +final class ExpressionIdentifier { public static function getVarId( PhpParser\Node\Expr $stmt, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php index 79ac2bf19db..a57510665e4 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php @@ -101,7 +101,7 @@ /** * @internal */ -class ArrayFetchAnalyzer +final class ArrayFetchAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php index 0c1bdcf0010..44d61115739 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php @@ -75,7 +75,7 @@ /** * @internal */ -class AtomicPropertyFetchAnalyzer +final class AtomicPropertyFetchAnalyzer { /** * @param array $invalid_fetch_types $invalid_fetch_types diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php index b078aef6ea6..cce8934324e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php @@ -30,7 +30,7 @@ /** * @internal */ -class ConstFetchAnalyzer +final class ConstFetchAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/InstancePropertyFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/InstancePropertyFetchAnalyzer.php index 8fe65b4f5cd..1502fca7282 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/InstancePropertyFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/InstancePropertyFetchAnalyzer.php @@ -35,7 +35,7 @@ /** * @internal */ -class InstancePropertyFetchAnalyzer +final class InstancePropertyFetchAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/StaticPropertyFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/StaticPropertyFetchAnalyzer.php index a3c8151550b..4402a27c048 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/StaticPropertyFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/StaticPropertyFetchAnalyzer.php @@ -39,7 +39,7 @@ /** * @internal */ -class StaticPropertyFetchAnalyzer +final class StaticPropertyFetchAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/VariableFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/VariableFetchAnalyzer.php index 511671cea8b..b690b0af42a 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/VariableFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/VariableFetchAnalyzer.php @@ -43,7 +43,7 @@ /** * @internal */ -class VariableFetchAnalyzer +final class VariableFetchAnalyzer { public const SUPER_GLOBALS = [ '$GLOBALS', diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/IncDecExpressionAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/IncDecExpressionAnalyzer.php index 41a8a44d13a..08abb627c4c 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/IncDecExpressionAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/IncDecExpressionAnalyzer.php @@ -22,7 +22,7 @@ /** * @internal */ -class IncDecExpressionAnalyzer +final class IncDecExpressionAnalyzer { /** * @param PostInc|PostDec|PreInc|PreDec $stmt diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php index 5677818a7dd..83123189023 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php @@ -49,7 +49,7 @@ /** * @internal */ -class IncludeAnalyzer +final class IncludeAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/InstanceofAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/InstanceofAnalyzer.php index 5b021871c2a..c504be5dda2 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/InstanceofAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/InstanceofAnalyzer.php @@ -19,7 +19,7 @@ /** * @internal */ -class InstanceofAnalyzer +final class InstanceofAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/IssetAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/IssetAnalyzer.php index 9e54a4b5be3..3d21d156087 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/IssetAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/IssetAnalyzer.php @@ -16,7 +16,7 @@ /** * @internal */ -class IssetAnalyzer +final class IssetAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/MagicConstAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/MagicConstAnalyzer.php index 453538ac26a..948147bb0cc 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/MagicConstAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/MagicConstAnalyzer.php @@ -23,7 +23,7 @@ /** * @internal */ -class MagicConstAnalyzer +final class MagicConstAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/MatchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/MatchAnalyzer.php index f2676e5fa96..38ab1befc28 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/MatchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/MatchAnalyzer.php @@ -46,7 +46,7 @@ /** * @internal */ -class MatchAnalyzer +final class MatchAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/NullsafeAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/NullsafeAnalyzer.php index 76aeca5f562..c6bf23c4f09 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/NullsafeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/NullsafeAnalyzer.php @@ -20,7 +20,7 @@ /** * @internal */ -class NullsafeAnalyzer +final class NullsafeAnalyzer { /** * @param PhpParser\Node\Expr\NullsafePropertyFetch|PhpParser\Node\Expr\NullsafeMethodCall $stmt diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/PrintAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/PrintAnalyzer.php index 514e1823851..25f06a23ce7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/PrintAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/PrintAnalyzer.php @@ -23,7 +23,7 @@ /** * @internal */ -class PrintAnalyzer +final class PrintAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/SimpleTypeInferer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/SimpleTypeInferer.php index 92589c86151..f12b0ebc553 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/SimpleTypeInferer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/SimpleTypeInferer.php @@ -46,7 +46,7 @@ * * @internal */ -class SimpleTypeInferer +final class SimpleTypeInferer { /** * @param ?array $existing_class_constants diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php index f50b2e7836a..814568e4fdc 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php @@ -40,7 +40,7 @@ /** * @internal */ -class TernaryAnalyzer +final class TernaryAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/UnaryPlusMinusAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/UnaryPlusMinusAnalyzer.php index 195efc1e080..e5d6becf49d 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/UnaryPlusMinusAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/UnaryPlusMinusAnalyzer.php @@ -27,7 +27,7 @@ /** * @internal */ -class UnaryPlusMinusAnalyzer +final class UnaryPlusMinusAnalyzer { /** * @param PhpParser\Node\Expr\UnaryMinus|PhpParser\Node\Expr\UnaryPlus $stmt diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php index 52b464ea1b7..c76f52b77c4 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php @@ -30,7 +30,7 @@ /** * @internal */ -class YieldAnalyzer +final class YieldAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/YieldFromAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/YieldFromAnalyzer.php index 7e460bb05b2..765f13bd2dd 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/YieldFromAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/YieldFromAnalyzer.php @@ -19,7 +19,7 @@ /** * @internal */ -class YieldFromAnalyzer +final class YieldFromAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php index 1c1feac782b..870201bc289 100644 --- a/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php @@ -67,7 +67,7 @@ /** * @internal */ -class ExpressionAnalyzer +final class ExpressionAnalyzer { /** * @param bool $assigned_to_reference This is set to true when the expression being analyzed diff --git a/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php index 8d1538fed0b..bcb7f693304 100644 --- a/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php @@ -21,7 +21,7 @@ /** * @internal */ -class GlobalAnalyzer +final class GlobalAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php index dc573299309..945dfd60d1f 100644 --- a/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php @@ -55,7 +55,7 @@ /** * @internal */ -class ReturnAnalyzer +final class ReturnAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php index ba328489097..02b411bc3d4 100644 --- a/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php @@ -21,7 +21,7 @@ /** * @internal */ -class StaticAnalyzer +final class StaticAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/ThrowAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ThrowAnalyzer.php index 7e6ff17b531..890c0637204 100644 --- a/src/Psalm/Internal/Analyzer/Statements/ThrowAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/ThrowAnalyzer.php @@ -18,7 +18,7 @@ /** * @internal */ -class ThrowAnalyzer +final class ThrowAnalyzer { /** * @param PhpParser\Node\Stmt\Throw_|PhpParser\Node\Expr\Throw_ $stmt diff --git a/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php index 5827bf969d5..51df9a31c27 100644 --- a/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/UnsetAnalyzer.php @@ -25,7 +25,7 @@ /** * @internal */ -class UnsetAnalyzer +final class UnsetAnalyzer { public static function analyze( StatementsAnalyzer $statements_analyzer, diff --git a/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php b/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php index e9d113476e9..a6fdbdf707a 100644 --- a/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php +++ b/src/Psalm/Internal/Analyzer/Statements/UnusedAssignmentRemover.php @@ -24,7 +24,7 @@ /** * @internal */ -class UnusedAssignmentRemover +final class UnusedAssignmentRemover { /** * @var array diff --git a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php index 0ec734c1f3e..183255e19ee 100644 --- a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php @@ -95,7 +95,7 @@ /** * @internal */ -class StatementsAnalyzer extends SourceAnalyzer +final class StatementsAnalyzer extends SourceAnalyzer { protected SourceAnalyzer $source; diff --git a/src/Psalm/Internal/Analyzer/TraitAnalyzer.php b/src/Psalm/Internal/Analyzer/TraitAnalyzer.php index 6c8823fdd1b..6f8d4b86c3a 100644 --- a/src/Psalm/Internal/Analyzer/TraitAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/TraitAnalyzer.php @@ -14,7 +14,7 @@ /** * @internal */ -class TraitAnalyzer extends ClassLikeAnalyzer +final class TraitAnalyzer extends ClassLikeAnalyzer { private Aliases $aliases; diff --git a/src/Psalm/Internal/Analyzer/TypeAnalyzer.php b/src/Psalm/Internal/Analyzer/TypeAnalyzer.php index 24ede558740..10267b7568f 100644 --- a/src/Psalm/Internal/Analyzer/TypeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/TypeAnalyzer.php @@ -13,7 +13,7 @@ /** * @internal */ -class TypeAnalyzer +final class TypeAnalyzer { /** * Takes two arrays of types and merges them diff --git a/src/Psalm/Internal/Cache.php b/src/Psalm/Internal/Cache.php index 5b0fb39408e..27a6a84c260 100644 --- a/src/Psalm/Internal/Cache.php +++ b/src/Psalm/Internal/Cache.php @@ -25,7 +25,7 @@ /** * @internal */ -class Cache +final class Cache { private Config $config; diff --git a/src/Psalm/Internal/Clause.php b/src/Psalm/Internal/Clause.php index bcd98fcf580..1482bbe736b 100644 --- a/src/Psalm/Internal/Clause.php +++ b/src/Psalm/Internal/Clause.php @@ -29,7 +29,7 @@ * @internal * @psalm-immutable */ -class Clause +final class Clause { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/Codebase/Analyzer.php b/src/Psalm/Internal/Codebase/Analyzer.php index 62a361379ee..e7eb49e1c15 100644 --- a/src/Psalm/Internal/Codebase/Analyzer.php +++ b/src/Psalm/Internal/Codebase/Analyzer.php @@ -97,7 +97,7 @@ * * Called in the analysis phase of Psalm's execution */ -class Analyzer +final class Analyzer { private Config $config; diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 1f540d63032..b2a97e56260 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -71,7 +71,7 @@ * * Handles information about classes, interfaces and traits */ -class ClassLikes +final class ClassLikes { private ClassLikeStorageProvider $classlike_storage_provider; diff --git a/src/Psalm/Internal/Codebase/ConstantTypeResolver.php b/src/Psalm/Internal/Codebase/ConstantTypeResolver.php index 4198f185180..2d826dc0891 100644 --- a/src/Psalm/Internal/Codebase/ConstantTypeResolver.php +++ b/src/Psalm/Internal/Codebase/ConstantTypeResolver.php @@ -55,7 +55,7 @@ /** * @internal */ -class ConstantTypeResolver +final class ConstantTypeResolver { public static function resolve( ClassLikes $classlikes, diff --git a/src/Psalm/Internal/Codebase/Functions.php b/src/Psalm/Internal/Codebase/Functions.php index 27e770ba598..2cb3ffefd88 100644 --- a/src/Psalm/Internal/Codebase/Functions.php +++ b/src/Psalm/Internal/Codebase/Functions.php @@ -37,7 +37,7 @@ /** * @internal */ -class Functions +final class Functions { private FileStorageProvider $file_storage_provider; diff --git a/src/Psalm/Internal/Codebase/InternalCallMapHandler.php b/src/Psalm/Internal/Codebase/InternalCallMapHandler.php index 85eedb0c3e7..7bf56f42fbc 100644 --- a/src/Psalm/Internal/Codebase/InternalCallMapHandler.php +++ b/src/Psalm/Internal/Codebase/InternalCallMapHandler.php @@ -35,7 +35,7 @@ * * Gets values from the call map array, which stores data about native functions and methods */ -class InternalCallMapHandler +final class InternalCallMapHandler { private const PHP_MAJOR_VERSION = 8; private const PHP_MINOR_VERSION = 3; diff --git a/src/Psalm/Internal/Codebase/Methods.php b/src/Psalm/Internal/Codebase/Methods.php index 0f961f65a22..bdcf71befc6 100644 --- a/src/Psalm/Internal/Codebase/Methods.php +++ b/src/Psalm/Internal/Codebase/Methods.php @@ -55,7 +55,7 @@ * * Handles information about class methods */ -class Methods +final class Methods { private ClassLikeStorageProvider $classlike_storage_provider; diff --git a/src/Psalm/Internal/Codebase/Populator.php b/src/Psalm/Internal/Codebase/Populator.php index 7771c2ac3ae..37688a034ea 100644 --- a/src/Psalm/Internal/Codebase/Populator.php +++ b/src/Psalm/Internal/Codebase/Populator.php @@ -44,7 +44,7 @@ * * Populates file and class information so that analysis can work properly */ -class Populator +final class Populator { private ClassLikeStorageProvider $classlike_storage_provider; diff --git a/src/Psalm/Internal/Codebase/Properties.php b/src/Psalm/Internal/Codebase/Properties.php index fe9957349a8..4547721fe1b 100644 --- a/src/Psalm/Internal/Codebase/Properties.php +++ b/src/Psalm/Internal/Codebase/Properties.php @@ -25,7 +25,7 @@ * * Handles information about class properties */ -class Properties +final class Properties { private ClassLikeStorageProvider $classlike_storage_provider; diff --git a/src/Psalm/Internal/Codebase/PropertyMap.php b/src/Psalm/Internal/Codebase/PropertyMap.php index 2c76790ae4c..384bdea4705 100644 --- a/src/Psalm/Internal/Codebase/PropertyMap.php +++ b/src/Psalm/Internal/Codebase/PropertyMap.php @@ -10,7 +10,7 @@ /** * @internal */ -class PropertyMap +final class PropertyMap { /** * @var array>|null diff --git a/src/Psalm/Internal/Codebase/ReferenceMapGenerator.php b/src/Psalm/Internal/Codebase/ReferenceMapGenerator.php index ccdf7b47c60..acacc918ed0 100644 --- a/src/Psalm/Internal/Codebase/ReferenceMapGenerator.php +++ b/src/Psalm/Internal/Codebase/ReferenceMapGenerator.php @@ -9,7 +9,7 @@ /** * @internal */ -class ReferenceMapGenerator +final class ReferenceMapGenerator { /** * @return array diff --git a/src/Psalm/Internal/Codebase/Reflection.php b/src/Psalm/Internal/Codebase/Reflection.php index a2414df54a6..d4c083641f5 100644 --- a/src/Psalm/Internal/Codebase/Reflection.php +++ b/src/Psalm/Internal/Codebase/Reflection.php @@ -39,7 +39,7 @@ * * Handles information gleaned from class and function reflection */ -class Reflection +final class Reflection { private ClassLikeStorageProvider $storage_provider; diff --git a/src/Psalm/Internal/Codebase/Scanner.php b/src/Psalm/Internal/Codebase/Scanner.php index bf13e233267..aaa5e5c6aea 100644 --- a/src/Psalm/Internal/Codebase/Scanner.php +++ b/src/Psalm/Internal/Codebase/Scanner.php @@ -85,7 +85,7 @@ * * Contains methods that aid in the scanning of Psalm's codebase */ -class Scanner +final class Scanner { private Codebase $codebase; diff --git a/src/Psalm/Internal/Codebase/TaintFlowGraph.php b/src/Psalm/Internal/Codebase/TaintFlowGraph.php index 9ed1c865115..5c5f72173eb 100644 --- a/src/Psalm/Internal/Codebase/TaintFlowGraph.php +++ b/src/Psalm/Internal/Codebase/TaintFlowGraph.php @@ -50,7 +50,7 @@ /** * @internal */ -class TaintFlowGraph extends DataFlowGraph +final class TaintFlowGraph extends DataFlowGraph { /** @var array */ private array $sources = []; diff --git a/src/Psalm/Internal/Codebase/VariableUseGraph.php b/src/Psalm/Internal/Codebase/VariableUseGraph.php index f5988b49a95..711dc6882d3 100644 --- a/src/Psalm/Internal/Codebase/VariableUseGraph.php +++ b/src/Psalm/Internal/Codebase/VariableUseGraph.php @@ -15,7 +15,7 @@ /** * @internal */ -class VariableUseGraph extends DataFlowGraph +final class VariableUseGraph extends DataFlowGraph { /** @var array> */ protected array $backward_edges = []; diff --git a/src/Psalm/Internal/DataFlow/Path.php b/src/Psalm/Internal/DataFlow/Path.php index 5286461f1f5..6e233f66e0d 100644 --- a/src/Psalm/Internal/DataFlow/Path.php +++ b/src/Psalm/Internal/DataFlow/Path.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class Path +final class Path { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/DataFlow/TaintSink.php b/src/Psalm/Internal/DataFlow/TaintSink.php index 011aa51f95d..42a75b2f4c8 100644 --- a/src/Psalm/Internal/DataFlow/TaintSink.php +++ b/src/Psalm/Internal/DataFlow/TaintSink.php @@ -7,6 +7,6 @@ /** * @internal */ -class TaintSink extends DataFlowNode +final class TaintSink extends DataFlowNode { } diff --git a/src/Psalm/Internal/DataFlow/TaintSource.php b/src/Psalm/Internal/DataFlow/TaintSource.php index 3c11c45d913..5b5f076dd1e 100644 --- a/src/Psalm/Internal/DataFlow/TaintSource.php +++ b/src/Psalm/Internal/DataFlow/TaintSource.php @@ -7,6 +7,6 @@ /** * @internal */ -class TaintSource extends DataFlowNode +final class TaintSource extends DataFlowNode { } diff --git a/src/Psalm/Internal/Diff/ClassStatementsDiffer.php b/src/Psalm/Internal/Diff/ClassStatementsDiffer.php index c4be8484cf9..f28cbae4936 100644 --- a/src/Psalm/Internal/Diff/ClassStatementsDiffer.php +++ b/src/Psalm/Internal/Diff/ClassStatementsDiffer.php @@ -16,7 +16,7 @@ /** * @internal */ -class ClassStatementsDiffer extends AstDiffer +final class ClassStatementsDiffer extends AstDiffer { /** * Calculate diff (edit script) from $a to $b. diff --git a/src/Psalm/Internal/Diff/DiffElem.php b/src/Psalm/Internal/Diff/DiffElem.php index 557d98baf5e..74a993ace22 100644 --- a/src/Psalm/Internal/Diff/DiffElem.php +++ b/src/Psalm/Internal/Diff/DiffElem.php @@ -10,7 +10,7 @@ * @internal * @psalm-immutable */ -class DiffElem +final class DiffElem { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/Diff/FileDiffer.php b/src/Psalm/Internal/Diff/FileDiffer.php index c0068b6fedd..e6812050b3d 100644 --- a/src/Psalm/Internal/Diff/FileDiffer.php +++ b/src/Psalm/Internal/Diff/FileDiffer.php @@ -23,7 +23,7 @@ * * @internal */ -class FileDiffer +final class FileDiffer { /** * @param list $a diff --git a/src/Psalm/Internal/Diff/FileStatementsDiffer.php b/src/Psalm/Internal/Diff/FileStatementsDiffer.php index 113646dc28d..c5928ae0a15 100644 --- a/src/Psalm/Internal/Diff/FileStatementsDiffer.php +++ b/src/Psalm/Internal/Diff/FileStatementsDiffer.php @@ -14,7 +14,7 @@ /** * @internal */ -class FileStatementsDiffer extends AstDiffer +final class FileStatementsDiffer extends AstDiffer { /** * Calculate diff (edit script) from $a to $b. diff --git a/src/Psalm/Internal/Diff/NamespaceStatementsDiffer.php b/src/Psalm/Internal/Diff/NamespaceStatementsDiffer.php index b441edff3ef..2203ef76bfc 100644 --- a/src/Psalm/Internal/Diff/NamespaceStatementsDiffer.php +++ b/src/Psalm/Internal/Diff/NamespaceStatementsDiffer.php @@ -14,7 +14,7 @@ /** * @internal */ -class NamespaceStatementsDiffer extends AstDiffer +final class NamespaceStatementsDiffer extends AstDiffer { /** * Calculate diff (edit script) from $a to $b. diff --git a/src/Psalm/Internal/EventDispatcher.php b/src/Psalm/Internal/EventDispatcher.php index bbdc4582abe..e09a2b03b02 100644 --- a/src/Psalm/Internal/EventDispatcher.php +++ b/src/Psalm/Internal/EventDispatcher.php @@ -50,7 +50,7 @@ /** * @internal */ -class EventDispatcher +final class EventDispatcher { /** * Static methods to be called after method checks have completed diff --git a/src/Psalm/Internal/ExecutionEnvironment/BuildInfoCollector.php b/src/Psalm/Internal/ExecutionEnvironment/BuildInfoCollector.php index 75fb6af7a65..cc820d0ec9e 100644 --- a/src/Psalm/Internal/ExecutionEnvironment/BuildInfoCollector.php +++ b/src/Psalm/Internal/ExecutionEnvironment/BuildInfoCollector.php @@ -23,7 +23,7 @@ * @author Kitamura Satoshi * @internal */ -class BuildInfoCollector +final class BuildInfoCollector { /** * Environment variables. diff --git a/src/Psalm/Internal/ExecutionEnvironment/GitInfoCollector.php b/src/Psalm/Internal/ExecutionEnvironment/GitInfoCollector.php index 46b2fe84376..5111b381d0b 100644 --- a/src/Psalm/Internal/ExecutionEnvironment/GitInfoCollector.php +++ b/src/Psalm/Internal/ExecutionEnvironment/GitInfoCollector.php @@ -23,7 +23,7 @@ * @author Kitamura Satoshi * @internal */ -class GitInfoCollector +final class GitInfoCollector { /** * Git command. diff --git a/src/Psalm/Internal/FileManipulation/ClassDocblockManipulator.php b/src/Psalm/Internal/FileManipulation/ClassDocblockManipulator.php index 5ad3347dd64..ec44a1c3575 100644 --- a/src/Psalm/Internal/FileManipulation/ClassDocblockManipulator.php +++ b/src/Psalm/Internal/FileManipulation/ClassDocblockManipulator.php @@ -19,7 +19,7 @@ /** * @internal */ -class ClassDocblockManipulator +final class ClassDocblockManipulator { /** * @var array> diff --git a/src/Psalm/Internal/FileManipulation/CodeMigration.php b/src/Psalm/Internal/FileManipulation/CodeMigration.php index 8ccd62a8ea3..9c703dea506 100644 --- a/src/Psalm/Internal/FileManipulation/CodeMigration.php +++ b/src/Psalm/Internal/FileManipulation/CodeMigration.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class CodeMigration +final class CodeMigration { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php b/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php index c879a71cd81..6d411f01839 100644 --- a/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php +++ b/src/Psalm/Internal/FileManipulation/FileManipulationBuffer.php @@ -21,7 +21,7 @@ /** * @internal */ -class FileManipulationBuffer +final class FileManipulationBuffer { /** @var array */ private static array $file_manipulations = []; diff --git a/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php b/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php index b1b4c43d8de..12ac9be6ea4 100644 --- a/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php +++ b/src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php @@ -36,7 +36,7 @@ /** * @internal */ -class FunctionDocblockManipulator +final class FunctionDocblockManipulator { /** * Manipulators ordered by line number diff --git a/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php b/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php index cfb3d178052..3f00530e5bb 100644 --- a/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php +++ b/src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php @@ -24,7 +24,7 @@ /** * @internal */ -class PropertyDocblockManipulator +final class PropertyDocblockManipulator { /** * @var array> diff --git a/src/Psalm/Internal/Fork/ForkProcessDoneMessage.php b/src/Psalm/Internal/Fork/ForkProcessDoneMessage.php index 63d4222e6ff..233c2252411 100644 --- a/src/Psalm/Internal/Fork/ForkProcessDoneMessage.php +++ b/src/Psalm/Internal/Fork/ForkProcessDoneMessage.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class ForkProcessDoneMessage implements ForkMessage +final class ForkProcessDoneMessage implements ForkMessage { use ImmutableNonCloneableTrait; public mixed $data; diff --git a/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php b/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php index df199983cc9..1c59bac6793 100644 --- a/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php +++ b/src/Psalm/Internal/Fork/ForkProcessErrorMessage.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class ForkProcessErrorMessage implements ForkMessage +final class ForkProcessErrorMessage implements ForkMessage { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/Fork/ForkTaskDoneMessage.php b/src/Psalm/Internal/Fork/ForkTaskDoneMessage.php index 4521eaf319c..7cc1c01a0ac 100644 --- a/src/Psalm/Internal/Fork/ForkTaskDoneMessage.php +++ b/src/Psalm/Internal/Fork/ForkTaskDoneMessage.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class ForkTaskDoneMessage implements ForkMessage +final class ForkTaskDoneMessage implements ForkMessage { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/Fork/Pool.php b/src/Psalm/Internal/Fork/Pool.php index fd33ed0bc49..6a4145aaac1 100644 --- a/src/Psalm/Internal/Fork/Pool.php +++ b/src/Psalm/Internal/Fork/Pool.php @@ -72,7 +72,7 @@ * * @internal */ -class Pool +final class Pool { private const EXIT_SUCCESS = 0; private const EXIT_FAILURE = 1; diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index 69fecd823f2..4350badbff6 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -25,7 +25,7 @@ /** * @internal */ -class PsalmRestarter extends XdebugHandler +final class PsalmRestarter extends XdebugHandler { private const REQUIRED_OPCACHE_SETTINGS = [ 'enable_cli' => true, diff --git a/src/Psalm/Internal/Json/Json.php b/src/Psalm/Internal/Json/Json.php index e78a492ccae..1e56730f9e2 100644 --- a/src/Psalm/Internal/Json/Json.php +++ b/src/Psalm/Internal/Json/Json.php @@ -18,7 +18,7 @@ * * @internal */ -class Json +final class Json { public const PRETTY = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; diff --git a/src/Psalm/Internal/LanguageServer/Client/TextDocument.php b/src/Psalm/Internal/LanguageServer/Client/TextDocument.php index c7f4e378656..1e65565df3c 100644 --- a/src/Psalm/Internal/LanguageServer/Client/TextDocument.php +++ b/src/Psalm/Internal/LanguageServer/Client/TextDocument.php @@ -13,7 +13,7 @@ * * @internal */ -class TextDocument +final class TextDocument { private ClientHandler $handler; diff --git a/src/Psalm/Internal/LanguageServer/Client/Workspace.php b/src/Psalm/Internal/LanguageServer/Client/Workspace.php index cbf526ea12a..e08e31192e0 100644 --- a/src/Psalm/Internal/LanguageServer/Client/Workspace.php +++ b/src/Psalm/Internal/LanguageServer/Client/Workspace.php @@ -13,7 +13,7 @@ * * @internal */ -class Workspace +final class Workspace { private ClientHandler $handler; diff --git a/src/Psalm/Internal/LanguageServer/ClientConfiguration.php b/src/Psalm/Internal/LanguageServer/ClientConfiguration.php index 20c1a0a58ba..a2ad6193eda 100644 --- a/src/Psalm/Internal/LanguageServer/ClientConfiguration.php +++ b/src/Psalm/Internal/LanguageServer/ClientConfiguration.php @@ -9,7 +9,7 @@ /** * @internal */ -class ClientConfiguration +final class ClientConfiguration { /** diff --git a/src/Psalm/Internal/LanguageServer/ClientHandler.php b/src/Psalm/Internal/LanguageServer/ClientHandler.php index 6eceb6c0e27..29d2cce6914 100644 --- a/src/Psalm/Internal/LanguageServer/ClientHandler.php +++ b/src/Psalm/Internal/LanguageServer/ClientHandler.php @@ -13,7 +13,7 @@ /** * @internal */ -class ClientHandler +final class ClientHandler { public ProtocolReader $protocolReader; diff --git a/src/Psalm/Internal/LanguageServer/IdGenerator.php b/src/Psalm/Internal/LanguageServer/IdGenerator.php index 330015db5e7..29540b62625 100644 --- a/src/Psalm/Internal/LanguageServer/IdGenerator.php +++ b/src/Psalm/Internal/LanguageServer/IdGenerator.php @@ -9,7 +9,7 @@ * * @internal */ -class IdGenerator +final class IdGenerator { public int $counter = 1; diff --git a/src/Psalm/Internal/LanguageServer/LanguageClient.php b/src/Psalm/Internal/LanguageServer/LanguageClient.php index 13c1c21b9ec..f23985592bd 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageClient.php +++ b/src/Psalm/Internal/LanguageServer/LanguageClient.php @@ -22,7 +22,7 @@ /** * @internal */ -class LanguageClient +final class LanguageClient { /** * Handles textDocument/* methods diff --git a/src/Psalm/Internal/LanguageServer/LanguageServer.php b/src/Psalm/Internal/LanguageServer/LanguageServer.php index 2c648e4fd13..e155881c860 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageServer.php +++ b/src/Psalm/Internal/LanguageServer/LanguageServer.php @@ -94,7 +94,7 @@ * @psalm-api * @internal */ -class LanguageServer extends Dispatcher +final class LanguageServer extends Dispatcher { /** * Handles textDocument/* method calls diff --git a/src/Psalm/Internal/LanguageServer/Message.php b/src/Psalm/Internal/LanguageServer/Message.php index 56b46c23350..400cf9d0dbb 100644 --- a/src/Psalm/Internal/LanguageServer/Message.php +++ b/src/Psalm/Internal/LanguageServer/Message.php @@ -13,7 +13,7 @@ /** * @internal */ -class Message +final class Message { public ?MessageBody $body = null; diff --git a/src/Psalm/Internal/LanguageServer/PHPMarkdownContent.php b/src/Psalm/Internal/LanguageServer/PHPMarkdownContent.php index 60a749a6196..a6141a98536 100644 --- a/src/Psalm/Internal/LanguageServer/PHPMarkdownContent.php +++ b/src/Psalm/Internal/LanguageServer/PHPMarkdownContent.php @@ -15,7 +15,7 @@ * @psalm-api * @internal */ -class PHPMarkdownContent extends MarkupContent implements JsonSerializable +final class PHPMarkdownContent extends MarkupContent implements JsonSerializable { public string $code; diff --git a/src/Psalm/Internal/LanguageServer/Progress.php b/src/Psalm/Internal/LanguageServer/Progress.php index b5cec3ba4c5..2e138aefb3a 100644 --- a/src/Psalm/Internal/LanguageServer/Progress.php +++ b/src/Psalm/Internal/LanguageServer/Progress.php @@ -11,7 +11,7 @@ /** * @internal */ -class Progress extends Base +final class Progress extends Base { private ?LanguageServer $server = null; diff --git a/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php b/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php index 81bd15833b7..57422b52ee8 100644 --- a/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php +++ b/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php @@ -19,7 +19,7 @@ * * @internal */ -class ProtocolStreamReader implements ProtocolReader +final class ProtocolStreamReader implements ProtocolReader { use EmitterTrait; diff --git a/src/Psalm/Internal/LanguageServer/ProtocolStreamWriter.php b/src/Psalm/Internal/LanguageServer/ProtocolStreamWriter.php index bcf2f02b129..69405637577 100644 --- a/src/Psalm/Internal/LanguageServer/ProtocolStreamWriter.php +++ b/src/Psalm/Internal/LanguageServer/ProtocolStreamWriter.php @@ -9,7 +9,7 @@ /** * @internal */ -class ProtocolStreamWriter implements ProtocolWriter +final class ProtocolStreamWriter implements ProtocolWriter { private WritableResourceStream $output; diff --git a/src/Psalm/Internal/LanguageServer/Provider/ClassLikeStorageCacheProvider.php b/src/Psalm/Internal/LanguageServer/Provider/ClassLikeStorageCacheProvider.php index bd8f4dd4242..2ef4a32c6f0 100644 --- a/src/Psalm/Internal/LanguageServer/Provider/ClassLikeStorageCacheProvider.php +++ b/src/Psalm/Internal/LanguageServer/Provider/ClassLikeStorageCacheProvider.php @@ -13,7 +13,7 @@ /** * @internal */ -class ClassLikeStorageCacheProvider extends InternalClassLikeStorageCacheProvider +final class ClassLikeStorageCacheProvider extends InternalClassLikeStorageCacheProvider { /** @var array */ private array $cache = []; diff --git a/src/Psalm/Internal/LanguageServer/Provider/FileReferenceCacheProvider.php b/src/Psalm/Internal/LanguageServer/Provider/FileReferenceCacheProvider.php index 0df860fe5b3..434013020c6 100644 --- a/src/Psalm/Internal/LanguageServer/Provider/FileReferenceCacheProvider.php +++ b/src/Psalm/Internal/LanguageServer/Provider/FileReferenceCacheProvider.php @@ -13,7 +13,7 @@ * * @internal */ -class FileReferenceCacheProvider extends InternalFileReferenceCacheProvider +final class FileReferenceCacheProvider extends InternalFileReferenceCacheProvider { private ?array $cached_file_references = null; diff --git a/src/Psalm/Internal/LanguageServer/Provider/FileStorageCacheProvider.php b/src/Psalm/Internal/LanguageServer/Provider/FileStorageCacheProvider.php index f1d9f2caf0d..d3221e26314 100644 --- a/src/Psalm/Internal/LanguageServer/Provider/FileStorageCacheProvider.php +++ b/src/Psalm/Internal/LanguageServer/Provider/FileStorageCacheProvider.php @@ -12,7 +12,7 @@ /** * @internal */ -class FileStorageCacheProvider extends InternalFileStorageCacheProvider +final class FileStorageCacheProvider extends InternalFileStorageCacheProvider { /** @var array */ private array $cache = []; diff --git a/src/Psalm/Internal/LanguageServer/Provider/ParserCacheProvider.php b/src/Psalm/Internal/LanguageServer/Provider/ParserCacheProvider.php index 28222abbcda..47861abe470 100644 --- a/src/Psalm/Internal/LanguageServer/Provider/ParserCacheProvider.php +++ b/src/Psalm/Internal/LanguageServer/Provider/ParserCacheProvider.php @@ -12,7 +12,7 @@ /** * @internal */ -class ParserCacheProvider extends InternalParserCacheProvider +final class ParserCacheProvider extends InternalParserCacheProvider { /** * @var array diff --git a/src/Psalm/Internal/LanguageServer/Provider/ProjectCacheProvider.php b/src/Psalm/Internal/LanguageServer/Provider/ProjectCacheProvider.php index 5f0a1749bbe..ed85e5f4107 100644 --- a/src/Psalm/Internal/LanguageServer/Provider/ProjectCacheProvider.php +++ b/src/Psalm/Internal/LanguageServer/Provider/ProjectCacheProvider.php @@ -9,7 +9,7 @@ /** * @internal */ -class ProjectCacheProvider extends PsalmProjectCacheProvider +final class ProjectCacheProvider extends PsalmProjectCacheProvider { private int $last_run = 0; diff --git a/src/Psalm/Internal/LanguageServer/Reference.php b/src/Psalm/Internal/LanguageServer/Reference.php index b6d5dbf183d..bedd931b589 100644 --- a/src/Psalm/Internal/LanguageServer/Reference.php +++ b/src/Psalm/Internal/LanguageServer/Reference.php @@ -9,7 +9,7 @@ /** * @internal */ -class Reference +final class Reference { public string $file_path; public string $symbol; diff --git a/src/Psalm/Internal/LanguageServer/Server/TextDocument.php b/src/Psalm/Internal/LanguageServer/Server/TextDocument.php index a098b377f44..6081a651722 100644 --- a/src/Psalm/Internal/LanguageServer/Server/TextDocument.php +++ b/src/Psalm/Internal/LanguageServer/Server/TextDocument.php @@ -36,7 +36,7 @@ * * @internal */ -class TextDocument +final class TextDocument { protected LanguageServer $server; diff --git a/src/Psalm/Internal/LanguageServer/Server/Workspace.php b/src/Psalm/Internal/LanguageServer/Server/Workspace.php index 8de0cf4f4d7..9b6ae77b828 100644 --- a/src/Psalm/Internal/LanguageServer/Server/Workspace.php +++ b/src/Psalm/Internal/LanguageServer/Server/Workspace.php @@ -23,7 +23,7 @@ * * @internal */ -class Workspace +final class Workspace { protected LanguageServer $server; diff --git a/src/Psalm/Internal/MethodIdentifier.php b/src/Psalm/Internal/MethodIdentifier.php index 105c68b616c..c41a4b8ba9e 100644 --- a/src/Psalm/Internal/MethodIdentifier.php +++ b/src/Psalm/Internal/MethodIdentifier.php @@ -17,7 +17,7 @@ * @psalm-immutable * @internal */ -class MethodIdentifier +final class MethodIdentifier { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/PhpTraverser/CustomTraverser.php b/src/Psalm/Internal/PhpTraverser/CustomTraverser.php index 0f6279770d6..f1e2673572d 100644 --- a/src/Psalm/Internal/PhpTraverser/CustomTraverser.php +++ b/src/Psalm/Internal/PhpTraverser/CustomTraverser.php @@ -16,7 +16,7 @@ /** * @internal */ -class CustomTraverser extends NodeTraverser +final class CustomTraverser extends NodeTraverser { public function __construct() { diff --git a/src/Psalm/Internal/PhpVisitor/AssignmentMapVisitor.php b/src/Psalm/Internal/PhpVisitor/AssignmentMapVisitor.php index 31ef7a87a2b..609b098bdf2 100644 --- a/src/Psalm/Internal/PhpVisitor/AssignmentMapVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/AssignmentMapVisitor.php @@ -15,7 +15,7 @@ * With this map we can calculate how many times the loop analysis must * be run before all variables have the correct types */ -class AssignmentMapVisitor extends PhpParser\NodeVisitorAbstract +final class AssignmentMapVisitor extends PhpParser\NodeVisitorAbstract { /** * @var array> diff --git a/src/Psalm/Internal/PhpVisitor/CheckTrivialExprVisitor.php b/src/Psalm/Internal/PhpVisitor/CheckTrivialExprVisitor.php index a6ea7b099f8..9c1bfa9de3f 100644 --- a/src/Psalm/Internal/PhpVisitor/CheckTrivialExprVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/CheckTrivialExprVisitor.php @@ -9,7 +9,7 @@ /** * @internal */ -class CheckTrivialExprVisitor extends PhpParser\NodeVisitorAbstract +final class CheckTrivialExprVisitor extends PhpParser\NodeVisitorAbstract { /** * @var array diff --git a/src/Psalm/Internal/PhpVisitor/CloningVisitor.php b/src/Psalm/Internal/PhpVisitor/CloningVisitor.php index f6a089b1f87..1005caee248 100644 --- a/src/Psalm/Internal/PhpVisitor/CloningVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/CloningVisitor.php @@ -14,7 +14,7 @@ * * @internal */ -class CloningVisitor extends NodeVisitorAbstract +final class CloningVisitor extends NodeVisitorAbstract { public function enterNode(Node $node): Node { diff --git a/src/Psalm/Internal/PhpVisitor/ConditionCloningVisitor.php b/src/Psalm/Internal/PhpVisitor/ConditionCloningVisitor.php index b1e4018a1b0..c0c4d3e3f5a 100644 --- a/src/Psalm/Internal/PhpVisitor/ConditionCloningVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/ConditionCloningVisitor.php @@ -12,7 +12,7 @@ /** * @internal */ -class ConditionCloningVisitor extends NodeVisitorAbstract +final class ConditionCloningVisitor extends NodeVisitorAbstract { private NodeDataProvider $type_provider; diff --git a/src/Psalm/Internal/PhpVisitor/NodeCleanerVisitor.php b/src/Psalm/Internal/PhpVisitor/NodeCleanerVisitor.php index b74f64beee7..fc60185ab27 100644 --- a/src/Psalm/Internal/PhpVisitor/NodeCleanerVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/NodeCleanerVisitor.php @@ -10,7 +10,7 @@ /** * @internal */ -class NodeCleanerVisitor extends PhpParser\NodeVisitorAbstract +final class NodeCleanerVisitor extends PhpParser\NodeVisitorAbstract { private NodeDataProvider $type_provider; diff --git a/src/Psalm/Internal/PhpVisitor/NodeCounterVisitor.php b/src/Psalm/Internal/PhpVisitor/NodeCounterVisitor.php index a4bb5253f0d..9a5f446974c 100644 --- a/src/Psalm/Internal/PhpVisitor/NodeCounterVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/NodeCounterVisitor.php @@ -9,7 +9,7 @@ /** * @internal */ -class NodeCounterVisitor extends PhpParser\NodeVisitorAbstract +final class NodeCounterVisitor extends PhpParser\NodeVisitorAbstract { public int $count = 0; diff --git a/src/Psalm/Internal/PhpVisitor/OffsetShifterVisitor.php b/src/Psalm/Internal/PhpVisitor/OffsetShifterVisitor.php index b04c31f4a45..0a2d8c51e4b 100644 --- a/src/Psalm/Internal/PhpVisitor/OffsetShifterVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/OffsetShifterVisitor.php @@ -11,7 +11,7 @@ * * @internal */ -class OffsetShifterVisitor extends PhpParser\NodeVisitorAbstract +final class OffsetShifterVisitor extends PhpParser\NodeVisitorAbstract { private int $file_offset; diff --git a/src/Psalm/Internal/PhpVisitor/ParamReplacementVisitor.php b/src/Psalm/Internal/PhpVisitor/ParamReplacementVisitor.php index ba1e5f094cf..d7cd254bed8 100644 --- a/src/Psalm/Internal/PhpVisitor/ParamReplacementVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/ParamReplacementVisitor.php @@ -16,7 +16,7 @@ /** * @internal */ -class ParamReplacementVisitor extends PhpParser\NodeVisitorAbstract +final class ParamReplacementVisitor extends PhpParser\NodeVisitorAbstract { private string $old_name; diff --git a/src/Psalm/Internal/PhpVisitor/PartialParserVisitor.php b/src/Psalm/Internal/PhpVisitor/PartialParserVisitor.php index 44607f49a2d..16176468c44 100644 --- a/src/Psalm/Internal/PhpVisitor/PartialParserVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/PartialParserVisitor.php @@ -31,7 +31,7 @@ * * @internal */ -class PartialParserVisitor extends PhpParser\NodeVisitorAbstract +final class PartialParserVisitor extends PhpParser\NodeVisitorAbstract { /** @var array */ private array $offset_map; diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/AttributeResolver.php b/src/Psalm/Internal/PhpVisitor/Reflector/AttributeResolver.php index 27f0efcf6bd..db63d7e2ddc 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/AttributeResolver.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/AttributeResolver.php @@ -22,7 +22,7 @@ /** * @internal */ -class AttributeResolver +final class AttributeResolver { public static function resolve( Codebase $codebase, diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php index 2dd27096b8b..6e9f8715852 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php @@ -50,7 +50,7 @@ /** * @internal */ -class ClassLikeDocblockParser +final class ClassLikeDocblockParser { /** * @throws DocblockParseException if there was a problem parsing the docblock diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php index aaaa127d7a6..49958adcd0b 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php @@ -93,7 +93,7 @@ /** * @internal */ -class ClassLikeNodeScanner +final class ClassLikeNodeScanner { private FileScanner $file_scanner; diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionResolver.php b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionResolver.php index 37e3f9f3053..0255eef98c7 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionResolver.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionResolver.php @@ -47,7 +47,7 @@ /** * @internal */ -class ExpressionResolver +final class ExpressionResolver { public static function getUnresolvedClassConstExpr( PhpParser\Node\Expr $stmt, diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php index e37e0af8133..bf5ac885de6 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php @@ -38,7 +38,7 @@ /** * @internal */ -class ExpressionScanner +final class ExpressionScanner { public static function scan( Codebase $codebase, diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockParser.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockParser.php index 96431f0fb23..26ce42a0ac0 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockParser.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockParser.php @@ -41,7 +41,7 @@ /** * @internal */ -class FunctionLikeDocblockParser +final class FunctionLikeDocblockParser { /** * @throws DocblockParseException if there was a problem parsing the docblock diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php index ae2cabd564c..0d9bc183cba 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php @@ -71,7 +71,7 @@ /** * @internal */ -class FunctionLikeDocblockScanner +final class FunctionLikeDocblockScanner { /** * @param array> $existing_function_template_types diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php index a4b0a655e0d..6c85b646c1c 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php @@ -68,7 +68,7 @@ /** * @internal */ -class FunctionLikeNodeScanner +final class FunctionLikeNodeScanner { private FileScanner $file_scanner; diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/TypeHintResolver.php b/src/Psalm/Internal/PhpVisitor/Reflector/TypeHintResolver.php index f66b7351ad9..786b59e72d3 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/TypeHintResolver.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/TypeHintResolver.php @@ -28,7 +28,7 @@ /** * @internal */ -class TypeHintResolver +final class TypeHintResolver { /** * @param Identifier|IntersectionType|Name|NullableType|UnionType $hint diff --git a/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php b/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php index 2037568281d..3ff897b4e5d 100644 --- a/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php @@ -53,7 +53,7 @@ /** * @internal */ -class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements FileSource +final class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements FileSource { private Aliases $aliases; diff --git a/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php b/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php index 55ca888a507..18137b22723 100644 --- a/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/ShortClosureVisitor.php @@ -11,7 +11,7 @@ /** * @internal */ -class ShortClosureVisitor extends PhpParser\NodeVisitorAbstract +final class ShortClosureVisitor extends PhpParser\NodeVisitorAbstract { /** * @var array diff --git a/src/Psalm/Internal/PhpVisitor/SimpleNameResolver.php b/src/Psalm/Internal/PhpVisitor/SimpleNameResolver.php index c5759146813..3b13e077bac 100644 --- a/src/Psalm/Internal/PhpVisitor/SimpleNameResolver.php +++ b/src/Psalm/Internal/PhpVisitor/SimpleNameResolver.php @@ -19,7 +19,7 @@ /** * @internal */ -class SimpleNameResolver extends NodeVisitorAbstract +final class SimpleNameResolver extends NodeVisitorAbstract { private NameContext $nameContext; diff --git a/src/Psalm/Internal/PhpVisitor/TraitFinder.php b/src/Psalm/Internal/PhpVisitor/TraitFinder.php index 74c78e1fedf..a79f8a5e21b 100644 --- a/src/Psalm/Internal/PhpVisitor/TraitFinder.php +++ b/src/Psalm/Internal/PhpVisitor/TraitFinder.php @@ -19,7 +19,7 @@ * * @internal */ -class TraitFinder extends PhpParser\NodeVisitorAbstract +final class TraitFinder extends PhpParser\NodeVisitorAbstract { /** @var list */ private array $matching_trait_nodes = []; diff --git a/src/Psalm/Internal/PhpVisitor/TypeMappingVisitor.php b/src/Psalm/Internal/PhpVisitor/TypeMappingVisitor.php index 3948cf70f30..1236d8c0b47 100644 --- a/src/Psalm/Internal/PhpVisitor/TypeMappingVisitor.php +++ b/src/Psalm/Internal/PhpVisitor/TypeMappingVisitor.php @@ -11,7 +11,7 @@ /** * @internal */ -class TypeMappingVisitor extends NodeVisitorAbstract +final class TypeMappingVisitor extends NodeVisitorAbstract { private NodeDataProvider $fake_type_provider; private NodeDataProvider $real_type_provider; diff --git a/src/Psalm/Internal/PhpVisitor/YieldTypeCollector.php b/src/Psalm/Internal/PhpVisitor/YieldTypeCollector.php index 012dc3db73b..ddb1360bd92 100644 --- a/src/Psalm/Internal/PhpVisitor/YieldTypeCollector.php +++ b/src/Psalm/Internal/PhpVisitor/YieldTypeCollector.php @@ -18,7 +18,7 @@ /** * @internal */ -class YieldTypeCollector extends NodeVisitorAbstract +final class YieldTypeCollector extends NodeVisitorAbstract { /** @var list */ private array $yield_types = []; diff --git a/src/Psalm/Internal/PluginManager/Command/DisableCommand.php b/src/Psalm/Internal/PluginManager/Command/DisableCommand.php index 833c603853b..9104dbaa904 100644 --- a/src/Psalm/Internal/PluginManager/Command/DisableCommand.php +++ b/src/Psalm/Internal/PluginManager/Command/DisableCommand.php @@ -23,7 +23,7 @@ /** * @internal */ -class DisableCommand extends Command +final class DisableCommand extends Command { private PluginListFactory $plugin_list_factory; diff --git a/src/Psalm/Internal/PluginManager/Command/EnableCommand.php b/src/Psalm/Internal/PluginManager/Command/EnableCommand.php index 3ade0ea31e9..6a48504ddcb 100644 --- a/src/Psalm/Internal/PluginManager/Command/EnableCommand.php +++ b/src/Psalm/Internal/PluginManager/Command/EnableCommand.php @@ -23,7 +23,7 @@ /** * @internal */ -class EnableCommand extends Command +final class EnableCommand extends Command { private PluginListFactory $plugin_list_factory; diff --git a/src/Psalm/Internal/PluginManager/Command/ShowCommand.php b/src/Psalm/Internal/PluginManager/Command/ShowCommand.php index c7d2b41e766..77a8499ec8e 100644 --- a/src/Psalm/Internal/PluginManager/Command/ShowCommand.php +++ b/src/Psalm/Internal/PluginManager/Command/ShowCommand.php @@ -24,7 +24,7 @@ /** * @internal */ -class ShowCommand extends Command +final class ShowCommand extends Command { private PluginListFactory $plugin_list_factory; diff --git a/src/Psalm/Internal/PluginManager/ComposerLock.php b/src/Psalm/Internal/PluginManager/ComposerLock.php index 428b914aab8..03c9733d95c 100644 --- a/src/Psalm/Internal/PluginManager/ComposerLock.php +++ b/src/Psalm/Internal/PluginManager/ComposerLock.php @@ -18,7 +18,7 @@ /** * @internal */ -class ComposerLock +final class ComposerLock { /** @var string[] */ private array $file_names; diff --git a/src/Psalm/Internal/PluginManager/ConfigFile.php b/src/Psalm/Internal/PluginManager/ConfigFile.php index 33cbcc5eed7..0f94cd85825 100644 --- a/src/Psalm/Internal/PluginManager/ConfigFile.php +++ b/src/Psalm/Internal/PluginManager/ConfigFile.php @@ -19,7 +19,7 @@ /** * @internal */ -class ConfigFile +final class ConfigFile { private string $path; diff --git a/src/Psalm/Internal/PluginManager/PluginList.php b/src/Psalm/Internal/PluginManager/PluginList.php index eee2faddf8a..a00aad407bb 100644 --- a/src/Psalm/Internal/PluginManager/PluginList.php +++ b/src/Psalm/Internal/PluginManager/PluginList.php @@ -16,7 +16,7 @@ /** * @internal */ -class PluginList +final class PluginList { private ?ConfigFile $config_file = null; diff --git a/src/Psalm/Internal/PluginManager/PluginListFactory.php b/src/Psalm/Internal/PluginManager/PluginListFactory.php index fafbc267532..659f72dcebc 100644 --- a/src/Psalm/Internal/PluginManager/PluginListFactory.php +++ b/src/Psalm/Internal/PluginManager/PluginListFactory.php @@ -18,7 +18,7 @@ /** * @internal */ -class PluginListFactory +final class PluginListFactory { private string $project_root; diff --git a/src/Psalm/Internal/Provider/AddRemoveTaints/HtmlFunctionTainter.php b/src/Psalm/Internal/Provider/AddRemoveTaints/HtmlFunctionTainter.php index c568cedaee4..ec9822a2114 100644 --- a/src/Psalm/Internal/Provider/AddRemoveTaints/HtmlFunctionTainter.php +++ b/src/Psalm/Internal/Provider/AddRemoveTaints/HtmlFunctionTainter.php @@ -18,7 +18,7 @@ /** * @internal */ -class HtmlFunctionTainter implements AddTaintsInterface, RemoveTaintsInterface +final class HtmlFunctionTainter implements AddTaintsInterface, RemoveTaintsInterface { /** * Called to see what taints should be added diff --git a/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php b/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php index f0e775c123f..8260b207d18 100644 --- a/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php +++ b/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php @@ -14,7 +14,7 @@ /** * @internal */ -class ClassLikeStorageProvider +final class ClassLikeStorageProvider { /** * Storing this statically is much faster (at least in PHP 7.2.1) diff --git a/src/Psalm/Internal/Provider/FakeFileProvider.php b/src/Psalm/Internal/Provider/FakeFileProvider.php index 66d607380a3..a5e18fd7bb8 100644 --- a/src/Psalm/Internal/Provider/FakeFileProvider.php +++ b/src/Psalm/Internal/Provider/FakeFileProvider.php @@ -10,7 +10,7 @@ /** * @internal */ -class FakeFileProvider extends FileProvider +final class FakeFileProvider extends FileProvider { /** * @var array diff --git a/src/Psalm/Internal/Provider/FileReferenceProvider.php b/src/Psalm/Internal/Provider/FileReferenceProvider.php index 3b703fa514c..0e74f56e687 100644 --- a/src/Psalm/Internal/Provider/FileReferenceProvider.php +++ b/src/Psalm/Internal/Provider/FileReferenceProvider.php @@ -24,7 +24,7 @@ * @psalm-import-type FileMapType from Analyzer * @internal */ -class FileReferenceProvider +final class FileReferenceProvider { private bool $loaded_from_cache = false; diff --git a/src/Psalm/Internal/Provider/FileStorageProvider.php b/src/Psalm/Internal/Provider/FileStorageProvider.php index 2c5278344ba..059f6d7fabd 100644 --- a/src/Psalm/Internal/Provider/FileStorageProvider.php +++ b/src/Psalm/Internal/Provider/FileStorageProvider.php @@ -13,7 +13,7 @@ /** * @internal */ -class FileStorageProvider +final class FileStorageProvider { /** * A list of data useful to analyse files diff --git a/src/Psalm/Internal/Provider/FunctionExistenceProvider.php b/src/Psalm/Internal/Provider/FunctionExistenceProvider.php index 8576765c4f9..f5527c98075 100644 --- a/src/Psalm/Internal/Provider/FunctionExistenceProvider.php +++ b/src/Psalm/Internal/Provider/FunctionExistenceProvider.php @@ -15,7 +15,7 @@ /** * @internal */ -class FunctionExistenceProvider +final class FunctionExistenceProvider { /** * @var array< diff --git a/src/Psalm/Internal/Provider/FunctionParamsProvider.php b/src/Psalm/Internal/Provider/FunctionParamsProvider.php index b808fb4a5aa..976b8033f90 100644 --- a/src/Psalm/Internal/Provider/FunctionParamsProvider.php +++ b/src/Psalm/Internal/Provider/FunctionParamsProvider.php @@ -18,7 +18,7 @@ /** * @internal */ -class FunctionParamsProvider +final class FunctionParamsProvider { /** * @var array< diff --git a/src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php b/src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php index 10d5c31eafb..de3a11462b6 100644 --- a/src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php @@ -57,7 +57,7 @@ /** * @internal */ -class FunctionReturnTypeProvider +final class FunctionReturnTypeProvider { /** * @var array< diff --git a/src/Psalm/Internal/Provider/MethodExistenceProvider.php b/src/Psalm/Internal/Provider/MethodExistenceProvider.php index 6c1a3778c80..657fddd0de5 100644 --- a/src/Psalm/Internal/Provider/MethodExistenceProvider.php +++ b/src/Psalm/Internal/Provider/MethodExistenceProvider.php @@ -15,7 +15,7 @@ /** * @internal */ -class MethodExistenceProvider +final class MethodExistenceProvider { /** * @var array< diff --git a/src/Psalm/Internal/Provider/MethodParamsProvider.php b/src/Psalm/Internal/Provider/MethodParamsProvider.php index 0aea0a37b8c..58e225b787a 100644 --- a/src/Psalm/Internal/Provider/MethodParamsProvider.php +++ b/src/Psalm/Internal/Provider/MethodParamsProvider.php @@ -21,7 +21,7 @@ /** * @internal */ -class MethodParamsProvider +final class MethodParamsProvider { /** * @var array< diff --git a/src/Psalm/Internal/Provider/MethodReturnTypeProvider.php b/src/Psalm/Internal/Provider/MethodReturnTypeProvider.php index 5b49684c6e6..575b257caa3 100644 --- a/src/Psalm/Internal/Provider/MethodReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/MethodReturnTypeProvider.php @@ -24,7 +24,7 @@ /** * @internal */ -class MethodReturnTypeProvider +final class MethodReturnTypeProvider { /** * @var array< diff --git a/src/Psalm/Internal/Provider/MethodVisibilityProvider.php b/src/Psalm/Internal/Provider/MethodVisibilityProvider.php index 2987e3a3112..fcda0291d9c 100644 --- a/src/Psalm/Internal/Provider/MethodVisibilityProvider.php +++ b/src/Psalm/Internal/Provider/MethodVisibilityProvider.php @@ -17,7 +17,7 @@ /** * @internal */ -class MethodVisibilityProvider +final class MethodVisibilityProvider { /** * @var array< diff --git a/src/Psalm/Internal/Provider/NodeDataProvider.php b/src/Psalm/Internal/Provider/NodeDataProvider.php index 18bbaff64c9..efed6126b11 100644 --- a/src/Psalm/Internal/Provider/NodeDataProvider.php +++ b/src/Psalm/Internal/Provider/NodeDataProvider.php @@ -22,7 +22,7 @@ /** * @internal */ -class NodeDataProvider implements NodeTypeProvider +final class NodeDataProvider implements NodeTypeProvider { /** @var SplObjectStorage */ private SplObjectStorage $node_types; diff --git a/src/Psalm/Internal/Provider/PropertyExistenceProvider.php b/src/Psalm/Internal/Provider/PropertyExistenceProvider.php index 7093ee7b6ce..d10e6f2479d 100644 --- a/src/Psalm/Internal/Provider/PropertyExistenceProvider.php +++ b/src/Psalm/Internal/Provider/PropertyExistenceProvider.php @@ -17,7 +17,7 @@ /** * @internal */ -class PropertyExistenceProvider +final class PropertyExistenceProvider { /** * @var array< diff --git a/src/Psalm/Internal/Provider/PropertyTypeProvider.php b/src/Psalm/Internal/Provider/PropertyTypeProvider.php index bd2033aee6a..71b9231a7f9 100644 --- a/src/Psalm/Internal/Provider/PropertyTypeProvider.php +++ b/src/Psalm/Internal/Provider/PropertyTypeProvider.php @@ -18,7 +18,7 @@ /** * @internal */ -class PropertyTypeProvider +final class PropertyTypeProvider { /** * @var array< diff --git a/src/Psalm/Internal/Provider/PropertyTypeProvider/DomDocumentPropertyTypeProvider.php b/src/Psalm/Internal/Provider/PropertyTypeProvider/DomDocumentPropertyTypeProvider.php index d529abe1850..a76061780b8 100644 --- a/src/Psalm/Internal/Provider/PropertyTypeProvider/DomDocumentPropertyTypeProvider.php +++ b/src/Psalm/Internal/Provider/PropertyTypeProvider/DomDocumentPropertyTypeProvider.php @@ -15,7 +15,7 @@ /** * @internal */ -class DomDocumentPropertyTypeProvider implements PropertyTypeProviderInterface +final class DomDocumentPropertyTypeProvider implements PropertyTypeProviderInterface { private static ?Union $cache = null; public static function getPropertyType(PropertyTypeProviderEvent $event): ?Union diff --git a/src/Psalm/Internal/Provider/PropertyVisibilityProvider.php b/src/Psalm/Internal/Provider/PropertyVisibilityProvider.php index 48bdc8b7246..1af11782fa5 100644 --- a/src/Psalm/Internal/Provider/PropertyVisibilityProvider.php +++ b/src/Psalm/Internal/Provider/PropertyVisibilityProvider.php @@ -16,7 +16,7 @@ /** * @internal */ -class PropertyVisibilityProvider +final class PropertyVisibilityProvider { /** * @var array< diff --git a/src/Psalm/Internal/Provider/Providers.php b/src/Psalm/Internal/Provider/Providers.php index 2514755ad42..673a6ab2e2b 100644 --- a/src/Psalm/Internal/Provider/Providers.php +++ b/src/Psalm/Internal/Provider/Providers.php @@ -18,7 +18,7 @@ /** * @internal */ -class Providers +final class Providers { public FileProvider $file_provider; diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayChunkReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayChunkReturnTypeProvider.php index 5e949bec3e1..4e236619a13 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayChunkReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayChunkReturnTypeProvider.php @@ -16,7 +16,7 @@ /** * @internal */ -class ArrayChunkReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayChunkReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayColumnReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayColumnReturnTypeProvider.php index de255157edf..4f731d1ea0a 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayColumnReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayColumnReturnTypeProvider.php @@ -23,7 +23,7 @@ /** * @internal */ -class ArrayColumnReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayColumnReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayCombineReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayCombineReturnTypeProvider.php index 63f3fc49c3a..9464a67b281 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayCombineReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayCombineReturnTypeProvider.php @@ -20,7 +20,7 @@ /** * @internal */ -class ArrayCombineReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayCombineReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillKeysReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillKeysReturnTypeProvider.php index 764f059d97c..dc333149178 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillKeysReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillKeysReturnTypeProvider.php @@ -17,7 +17,7 @@ /** * @internal */ -class ArrayFillKeysReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayFillKeysReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillReturnTypeProvider.php index 84843be5f95..f8230115991 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillReturnTypeProvider.php @@ -16,7 +16,7 @@ /** * @internal */ -class ArrayFillReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayFillReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFilterReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFilterReturnTypeProvider.php index 1da5cdf9ba7..2d1734a0d7d 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFilterReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFilterReturnTypeProvider.php @@ -38,7 +38,7 @@ /** * @internal */ -class ArrayFilterReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayFilterReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php index 92fad16f881..a6ae833b414 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php @@ -50,7 +50,7 @@ /** * @internal */ -class ArrayMapReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayMapReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMergeReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMergeReturnTypeProvider.php index ed5c330ba28..4efeda3d5f2 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMergeReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMergeReturnTypeProvider.php @@ -27,7 +27,7 @@ /** * @internal */ -class ArrayMergeReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayMergeReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPadReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPadReturnTypeProvider.php index f818945d779..ff616f908a9 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPadReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPadReturnTypeProvider.php @@ -17,7 +17,7 @@ /** * @internal */ -class ArrayPadReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayPadReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPointerAdjustmentReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPointerAdjustmentReturnTypeProvider.php index 5502b3d5532..5a62a189743 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPointerAdjustmentReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPointerAdjustmentReturnTypeProvider.php @@ -24,7 +24,7 @@ /** * @internal */ -class ArrayPointerAdjustmentReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayPointerAdjustmentReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * These functions are already handled by the CoreGenericFunctions stub diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPopReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPopReturnTypeProvider.php index b09ca56d769..1769af6c536 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPopReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPopReturnTypeProvider.php @@ -17,7 +17,7 @@ /** * @internal */ -class ArrayPopReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayPopReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayRandReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayRandReturnTypeProvider.php index 8a4701a5182..f2a4f5e3eda 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayRandReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayRandReturnTypeProvider.php @@ -15,7 +15,7 @@ /** * @internal */ -class ArrayRandReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayRandReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReduceReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReduceReturnTypeProvider.php index 5a20cd6c6b3..c316e7debb1 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReduceReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReduceReturnTypeProvider.php @@ -32,7 +32,7 @@ /** * @internal */ -class ArrayReduceReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayReduceReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReverseReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReverseReturnTypeProvider.php index 315011a0da0..6e24a9134e4 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReverseReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReverseReturnTypeProvider.php @@ -17,7 +17,7 @@ /** * @internal */ -class ArrayReverseReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArrayReverseReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArraySliceReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArraySliceReturnTypeProvider.php index 9ff5ddc776d..93c9de8c71a 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArraySliceReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArraySliceReturnTypeProvider.php @@ -20,7 +20,7 @@ /** * @internal */ -class ArraySliceReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArraySliceReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArraySpliceReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArraySpliceReturnTypeProvider.php index f20783f7977..5602839995a 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ArraySpliceReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ArraySpliceReturnTypeProvider.php @@ -15,7 +15,7 @@ /** * @internal */ -class ArraySpliceReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ArraySpliceReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/BasenameReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/BasenameReturnTypeProvider.php index 72d54927170..8e11092326e 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/BasenameReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/BasenameReturnTypeProvider.php @@ -16,7 +16,7 @@ /** * @internal */ -class BasenameReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class BasenameReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ClosureFromCallableReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ClosureFromCallableReturnTypeProvider.php index 1cb721a4e14..6c8f748b2be 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ClosureFromCallableReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ClosureFromCallableReturnTypeProvider.php @@ -16,7 +16,7 @@ /** * @internal */ -class ClosureFromCallableReturnTypeProvider implements MethodReturnTypeProviderInterface +final class ClosureFromCallableReturnTypeProvider implements MethodReturnTypeProviderInterface { public static function getClassLikeNames(): array { diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/DateReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/DateReturnTypeProvider.php index 13bc381defd..956bffb61e2 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/DateReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/DateReturnTypeProvider.php @@ -19,7 +19,7 @@ /** * @internal */ -class DateReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class DateReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php index b2eecd428c7..f461604248d 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php @@ -15,7 +15,7 @@ /** * @internal */ -class DateTimeModifyReturnTypeProvider implements MethodReturnTypeProviderInterface +final class DateTimeModifyReturnTypeProvider implements MethodReturnTypeProviderInterface { public static function getClassLikeNames(): array { diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/DirnameReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/DirnameReturnTypeProvider.php index 6d96bf81e35..f6c63c47ac4 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/DirnameReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/DirnameReturnTypeProvider.php @@ -19,7 +19,7 @@ /** * @internal */ -class DirnameReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class DirnameReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/DomNodeAppendChild.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/DomNodeAppendChild.php index 6f7d27a3682..a7dd0b41941 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/DomNodeAppendChild.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/DomNodeAppendChild.php @@ -13,7 +13,7 @@ /** * @internal */ -class DomNodeAppendChild implements MethodReturnTypeProviderInterface +final class DomNodeAppendChild implements MethodReturnTypeProviderInterface { public static function getClassLikeNames(): array { diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/FilterVarReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/FilterVarReturnTypeProvider.php index dde31958fdf..40598d4a1e4 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/FilterVarReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/FilterVarReturnTypeProvider.php @@ -33,7 +33,7 @@ /** * @internal */ -class FilterVarReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class FilterVarReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/FirstArgStringReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/FirstArgStringReturnTypeProvider.php index c241867f1bd..3b043fe4cd3 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/FirstArgStringReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/FirstArgStringReturnTypeProvider.php @@ -15,7 +15,7 @@ /** * @internal */ -class FirstArgStringReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class FirstArgStringReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/GetClassMethodsReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/GetClassMethodsReturnTypeProvider.php index 999df6758b5..f842fcdfb2a 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/GetClassMethodsReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/GetClassMethodsReturnTypeProvider.php @@ -13,7 +13,7 @@ /** * @internal */ -class GetClassMethodsReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class GetClassMethodsReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/GetObjectVarsReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/GetObjectVarsReturnTypeProvider.php index 20375ad9126..9fe1648d3b0 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/GetObjectVarsReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/GetObjectVarsReturnTypeProvider.php @@ -29,7 +29,7 @@ /** * @internal */ -class GetObjectVarsReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class GetObjectVarsReturnTypeProvider implements FunctionReturnTypeProviderInterface { public static function getFunctionIds(): array { diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/HexdecReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/HexdecReturnTypeProvider.php index 72045f396c3..ead0b9651d4 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/HexdecReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/HexdecReturnTypeProvider.php @@ -13,7 +13,7 @@ /** * @internal */ -class HexdecReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class HexdecReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ImagickPixelColorReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ImagickPixelColorReturnTypeProvider.php index cd203064043..57f36d31f5e 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ImagickPixelColorReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ImagickPixelColorReturnTypeProvider.php @@ -18,7 +18,7 @@ /** * @internal */ -class ImagickPixelColorReturnTypeProvider implements MethodReturnTypeProviderInterface +final class ImagickPixelColorReturnTypeProvider implements MethodReturnTypeProviderInterface { public static function getClassLikeNames(): array { diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/InArrayReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/InArrayReturnTypeProvider.php index a0b45d53b11..077da7464c3 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/InArrayReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/InArrayReturnTypeProvider.php @@ -15,7 +15,7 @@ /** * @internal */ -class InArrayReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class InArrayReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/IteratorToArrayReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/IteratorToArrayReturnTypeProvider.php index dfb33ee153b..a3464e63ba6 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/IteratorToArrayReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/IteratorToArrayReturnTypeProvider.php @@ -24,7 +24,7 @@ /** * @internal */ -class IteratorToArrayReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class IteratorToArrayReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/MbInternalEncodingReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/MbInternalEncodingReturnTypeProvider.php index 053efea8e1c..3c918678deb 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/MbInternalEncodingReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/MbInternalEncodingReturnTypeProvider.php @@ -21,7 +21,7 @@ /** * @internal */ -class MbInternalEncodingReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class MbInternalEncodingReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/MinMaxReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/MinMaxReturnTypeProvider.php index 2f4b7fffe87..db7000bc721 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/MinMaxReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/MinMaxReturnTypeProvider.php @@ -27,7 +27,7 @@ /** * @internal */ -class MinMaxReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class MinMaxReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/MktimeReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/MktimeReturnTypeProvider.php index 213216321e2..5552f4bacd9 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/MktimeReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/MktimeReturnTypeProvider.php @@ -15,7 +15,7 @@ /** * @internal */ -class MktimeReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class MktimeReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/ParseUrlReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/ParseUrlReturnTypeProvider.php index 8e5778745fa..d2b04719594 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/ParseUrlReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/ParseUrlReturnTypeProvider.php @@ -31,7 +31,7 @@ /** * @internal */ -class ParseUrlReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class ParseUrlReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementReturnTypeProvider.php index a0c4ce460b2..5e95fdb824f 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementReturnTypeProvider.php @@ -19,7 +19,7 @@ /** * @internal */ -class PdoStatementReturnTypeProvider implements MethodReturnTypeProviderInterface +final class PdoStatementReturnTypeProvider implements MethodReturnTypeProviderInterface { public static function getClassLikeNames(): array { diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementSetFetchMode.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementSetFetchMode.php index 9a207b9b9e4..1d3fe3d929f 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementSetFetchMode.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementSetFetchMode.php @@ -14,7 +14,7 @@ /** * @internal */ -class PdoStatementSetFetchMode implements MethodParamsProviderInterface +final class PdoStatementSetFetchMode implements MethodParamsProviderInterface { public static function getClassLikeNames(): array { diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/PowReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/PowReturnTypeProvider.php index 6c453f80904..8c36e0b7abc 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/PowReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/PowReturnTypeProvider.php @@ -18,7 +18,7 @@ /** * @internal */ -class PowReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class PowReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/RandReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/RandReturnTypeProvider.php index ea6184e70fd..98ef8759223 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/RandReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/RandReturnTypeProvider.php @@ -16,7 +16,7 @@ /** * @internal */ -class RandReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class RandReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/RoundReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/RoundReturnTypeProvider.php index eb8ee561f54..32779b41f7e 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/RoundReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/RoundReturnTypeProvider.php @@ -18,7 +18,7 @@ /** * @internal */ -class RoundReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class RoundReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/SprintfReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/SprintfReturnTypeProvider.php index 7ad3ad0c387..f74d619fc10 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/SprintfReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/SprintfReturnTypeProvider.php @@ -33,7 +33,7 @@ /** * @internal */ -class SprintfReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class SprintfReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/StrReplaceReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/StrReplaceReturnTypeProvider.php index fea9657345f..35ee134aceb 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/StrReplaceReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/StrReplaceReturnTypeProvider.php @@ -16,7 +16,7 @@ /** * @internal */ -class StrReplaceReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class StrReplaceReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/StrTrReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/StrTrReturnTypeProvider.php index 9ac66cf5d29..4308244f8f0 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/StrTrReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/StrTrReturnTypeProvider.php @@ -17,7 +17,7 @@ /** * @internal */ -class StrTrReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class StrTrReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/TriggerErrorReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/TriggerErrorReturnTypeProvider.php index dfb8a173545..c0a812a40a7 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/TriggerErrorReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/TriggerErrorReturnTypeProvider.php @@ -25,7 +25,7 @@ /** * @internal */ -class TriggerErrorReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class TriggerErrorReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/VersionCompareReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/VersionCompareReturnTypeProvider.php index 91e8e97361f..2fe7566be6b 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/VersionCompareReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/VersionCompareReturnTypeProvider.php @@ -19,7 +19,7 @@ /** * @internal */ -class VersionCompareReturnTypeProvider implements FunctionReturnTypeProviderInterface +final class VersionCompareReturnTypeProvider implements FunctionReturnTypeProviderInterface { /** * @return array diff --git a/src/Psalm/Internal/Provider/StatementsProvider.php b/src/Psalm/Internal/Provider/StatementsProvider.php index c051d56b8b1..90a2a0a143f 100644 --- a/src/Psalm/Internal/Provider/StatementsProvider.php +++ b/src/Psalm/Internal/Provider/StatementsProvider.php @@ -41,7 +41,7 @@ /** * @internal */ -class StatementsProvider +final class StatementsProvider { private FileProvider $file_provider; diff --git a/src/Psalm/Internal/ReferenceConstraint.php b/src/Psalm/Internal/ReferenceConstraint.php index c3c28e8b50c..d318bdaa6f6 100644 --- a/src/Psalm/Internal/ReferenceConstraint.php +++ b/src/Psalm/Internal/ReferenceConstraint.php @@ -12,7 +12,7 @@ /** * @internal */ -class ReferenceConstraint +final class ReferenceConstraint { public ?Union $type = null; diff --git a/src/Psalm/Internal/Scanner/ClassLikeDocblockComment.php b/src/Psalm/Internal/Scanner/ClassLikeDocblockComment.php index 7a9d5cdb1b5..bae810c42d1 100644 --- a/src/Psalm/Internal/Scanner/ClassLikeDocblockComment.php +++ b/src/Psalm/Internal/Scanner/ClassLikeDocblockComment.php @@ -9,7 +9,7 @@ /** * @internal */ -class ClassLikeDocblockComment +final class ClassLikeDocblockComment { /** * Whether or not the class is deprecated diff --git a/src/Psalm/Internal/Scanner/DocblockParser.php b/src/Psalm/Internal/Scanner/DocblockParser.php index e8ebd9ece11..aea5ef4ea69 100644 --- a/src/Psalm/Internal/Scanner/DocblockParser.php +++ b/src/Psalm/Internal/Scanner/DocblockParser.php @@ -33,7 +33,7 @@ * * @internal */ -class DocblockParser +final class DocblockParser { /** * $offsetStart is the absolute position of the docblock in the file. It'll be used to add to the position of some diff --git a/src/Psalm/Internal/Scanner/FunctionDocblockComment.php b/src/Psalm/Internal/Scanner/FunctionDocblockComment.php index 66d5c1258da..82d8d96f4a2 100644 --- a/src/Psalm/Internal/Scanner/FunctionDocblockComment.php +++ b/src/Psalm/Internal/Scanner/FunctionDocblockComment.php @@ -7,7 +7,7 @@ /** * @internal */ -class FunctionDocblockComment +final class FunctionDocblockComment { public ?string $return_type = null; diff --git a/src/Psalm/Internal/Scanner/ParsedDocblock.php b/src/Psalm/Internal/Scanner/ParsedDocblock.php index 7afcb3dbe52..e495e749fd5 100644 --- a/src/Psalm/Internal/Scanner/ParsedDocblock.php +++ b/src/Psalm/Internal/Scanner/ParsedDocblock.php @@ -10,7 +10,7 @@ /** * @internal */ -class ParsedDocblock +final class ParsedDocblock { public string $description; diff --git a/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php b/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php index afef226ad04..e1518a8a0e6 100644 --- a/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php +++ b/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php @@ -25,7 +25,7 @@ /** * @internal */ -class PhpStormMetaScanner +final class PhpStormMetaScanner { /** * @param list $args diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php index 430c9e6c5e6..656a2c9f359 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayOffsetFetch.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class ArrayOffsetFetch extends UnresolvedConstantComponent +final class ArrayOffsetFetch extends UnresolvedConstantComponent { public UnresolvedConstantComponent $array; diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArraySpread.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArraySpread.php index 284b4c2068b..f0ca5d0b6ca 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArraySpread.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArraySpread.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class ArraySpread extends UnresolvedConstantComponent +final class ArraySpread extends UnresolvedConstantComponent { public UnresolvedConstantComponent $array; diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayValue.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayValue.php index e265b2ce06b..7bc11b7d284 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayValue.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ArrayValue.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class ArrayValue extends UnresolvedConstantComponent +final class ArrayValue extends UnresolvedConstantComponent { /** @var array */ public array $entries; diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ClassConstant.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ClassConstant.php index 0455893e3eb..6b4f4ec9eb1 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ClassConstant.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ClassConstant.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class ClassConstant extends UnresolvedConstantComponent +final class ClassConstant extends UnresolvedConstantComponent { public string $fqcln; diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/Constant.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/Constant.php index 0a543002c1a..b3d59fc8834 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/Constant.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/Constant.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class Constant extends UnresolvedConstantComponent +final class Constant extends UnresolvedConstantComponent { public string $name; diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/EnumNameFetch.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/EnumNameFetch.php index 0112af54617..0dea14889f7 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/EnumNameFetch.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/EnumNameFetch.php @@ -8,6 +8,6 @@ * @psalm-immutable * @internal */ -class EnumNameFetch extends EnumPropertyFetch +final class EnumNameFetch extends EnumPropertyFetch { } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/EnumValueFetch.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/EnumValueFetch.php index a2763f9bc84..26efbf10ec0 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/EnumValueFetch.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/EnumValueFetch.php @@ -8,6 +8,6 @@ * @psalm-immutable * @internal */ -class EnumValueFetch extends EnumPropertyFetch +final class EnumValueFetch extends EnumPropertyFetch { } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/KeyValuePair.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/KeyValuePair.php index 88ad48a15b1..17198114647 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/KeyValuePair.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/KeyValuePair.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class KeyValuePair extends UnresolvedConstantComponent +final class KeyValuePair extends UnresolvedConstantComponent { public ?UnresolvedConstantComponent $key = null; diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/ScalarValue.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/ScalarValue.php index cfe221982e0..7f6b7589158 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/ScalarValue.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/ScalarValue.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class ScalarValue extends UnresolvedConstantComponent +final class ScalarValue extends UnresolvedConstantComponent { public string|int|float|bool|null $value = null; diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php index 42a5237bd7a..d2bd967d51a 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedAdditionOp.php @@ -8,6 +8,6 @@ * @psalm-immutable * @internal */ -class UnresolvedAdditionOp extends UnresolvedBinaryOp +final class UnresolvedAdditionOp extends UnresolvedBinaryOp { } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseAnd.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseAnd.php index 02020219447..c5664765620 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseAnd.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseAnd.php @@ -8,6 +8,6 @@ * @psalm-immutable * @internal */ -class UnresolvedBitwiseAnd extends UnresolvedBinaryOp +final class UnresolvedBitwiseAnd extends UnresolvedBinaryOp { } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseOr.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseOr.php index 99fbacfd58c..9c95a8fc8eb 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseOr.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseOr.php @@ -8,6 +8,6 @@ * @psalm-immutable * @internal */ -class UnresolvedBitwiseOr extends UnresolvedBinaryOp +final class UnresolvedBitwiseOr extends UnresolvedBinaryOp { } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseXor.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseXor.php index 158b32c28c2..e51aace3dd5 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseXor.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedBitwiseXor.php @@ -8,6 +8,6 @@ * @psalm-immutable * @internal */ -class UnresolvedBitwiseXor extends UnresolvedBinaryOp +final class UnresolvedBitwiseXor extends UnresolvedBinaryOp { } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedConcatOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedConcatOp.php index 820c63616ba..2d03634f684 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedConcatOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedConcatOp.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class UnresolvedConcatOp extends UnresolvedBinaryOp +final class UnresolvedConcatOp extends UnresolvedBinaryOp { use ImmutableNonCloneableTrait; } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedDivisionOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedDivisionOp.php index 3f6c6ea24fc..7a65a86fc7d 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedDivisionOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedDivisionOp.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class UnresolvedDivisionOp extends UnresolvedBinaryOp +final class UnresolvedDivisionOp extends UnresolvedBinaryOp { use ImmutableNonCloneableTrait; } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedMultiplicationOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedMultiplicationOp.php index f424c27667f..18a8fc4d8a3 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedMultiplicationOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedMultiplicationOp.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class UnresolvedMultiplicationOp extends UnresolvedBinaryOp +final class UnresolvedMultiplicationOp extends UnresolvedBinaryOp { use ImmutableNonCloneableTrait; } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedSubtractionOp.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedSubtractionOp.php index 63212c062a4..8edf68d05fc 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedSubtractionOp.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedSubtractionOp.php @@ -10,7 +10,7 @@ * @psalm-immutable * @internal */ -class UnresolvedSubtractionOp extends UnresolvedBinaryOp +final class UnresolvedSubtractionOp extends UnresolvedBinaryOp { use ImmutableNonCloneableTrait; } diff --git a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedTernary.php b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedTernary.php index ece1f1557a3..f34383287c4 100644 --- a/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedTernary.php +++ b/src/Psalm/Internal/Scanner/UnresolvedConstant/UnresolvedTernary.php @@ -11,7 +11,7 @@ * @psalm-immutable * @internal */ -class UnresolvedTernary extends UnresolvedConstantComponent +final class UnresolvedTernary extends UnresolvedConstantComponent { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/Scanner/VarDocblockComment.php b/src/Psalm/Internal/Scanner/VarDocblockComment.php index e8639d442c2..c8869a578db 100644 --- a/src/Psalm/Internal/Scanner/VarDocblockComment.php +++ b/src/Psalm/Internal/Scanner/VarDocblockComment.php @@ -9,7 +9,7 @@ /** * @internal */ -class VarDocblockComment +final class VarDocblockComment { public ?Union $type = null; diff --git a/src/Psalm/Internal/Scope/CaseScope.php b/src/Psalm/Internal/Scope/CaseScope.php index a3fdf948e3c..bb93b265589 100644 --- a/src/Psalm/Internal/Scope/CaseScope.php +++ b/src/Psalm/Internal/Scope/CaseScope.php @@ -10,7 +10,7 @@ /** * @internal */ -class CaseScope +final class CaseScope { public Context $parent_context; diff --git a/src/Psalm/Internal/Scope/FinallyScope.php b/src/Psalm/Internal/Scope/FinallyScope.php index 6ca129151e8..d02d2bf01ef 100644 --- a/src/Psalm/Internal/Scope/FinallyScope.php +++ b/src/Psalm/Internal/Scope/FinallyScope.php @@ -9,7 +9,7 @@ /** * @internal */ -class FinallyScope +final class FinallyScope { /** * @var array diff --git a/src/Psalm/Internal/Scope/IfConditionalScope.php b/src/Psalm/Internal/Scope/IfConditionalScope.php index 5431c222c15..386d8daf034 100644 --- a/src/Psalm/Internal/Scope/IfConditionalScope.php +++ b/src/Psalm/Internal/Scope/IfConditionalScope.php @@ -10,7 +10,7 @@ /** * @internal */ -class IfConditionalScope +final class IfConditionalScope { public Context $if_context; diff --git a/src/Psalm/Internal/Scope/IfScope.php b/src/Psalm/Internal/Scope/IfScope.php index b44489e468d..955aaffdf03 100644 --- a/src/Psalm/Internal/Scope/IfScope.php +++ b/src/Psalm/Internal/Scope/IfScope.php @@ -12,7 +12,7 @@ /** * @internal */ -class IfScope +final class IfScope { /** * @var array|null diff --git a/src/Psalm/Internal/Scope/LoopScope.php b/src/Psalm/Internal/Scope/LoopScope.php index fe6e955ec4c..dbd45a88217 100644 --- a/src/Psalm/Internal/Scope/LoopScope.php +++ b/src/Psalm/Internal/Scope/LoopScope.php @@ -10,7 +10,7 @@ /** * @internal */ -class LoopScope +final class LoopScope { public int $iteration_count = 0; diff --git a/src/Psalm/Internal/Scope/SwitchScope.php b/src/Psalm/Internal/Scope/SwitchScope.php index 48f4caa7722..37d216da92a 100644 --- a/src/Psalm/Internal/Scope/SwitchScope.php +++ b/src/Psalm/Internal/Scope/SwitchScope.php @@ -11,7 +11,7 @@ /** * @internal */ -class SwitchScope +final class SwitchScope { /** * @var array|null diff --git a/src/Psalm/Internal/Stubs/Generator/ClassLikeStubGenerator.php b/src/Psalm/Internal/Stubs/Generator/ClassLikeStubGenerator.php index 98a31a3f5ad..dfbbc10c5e1 100644 --- a/src/Psalm/Internal/Stubs/Generator/ClassLikeStubGenerator.php +++ b/src/Psalm/Internal/Stubs/Generator/ClassLikeStubGenerator.php @@ -28,7 +28,7 @@ /** * @internal */ -class ClassLikeStubGenerator +final class ClassLikeStubGenerator { /** * @return PhpParser\Node\Stmt\Class_|PhpParser\Node\Stmt\Interface_|PhpParser\Node\Stmt\Trait_ diff --git a/src/Psalm/Internal/Stubs/Generator/StubsGenerator.php b/src/Psalm/Internal/Stubs/Generator/StubsGenerator.php index 960542850d6..528c2e92ed8 100644 --- a/src/Psalm/Internal/Stubs/Generator/StubsGenerator.php +++ b/src/Psalm/Internal/Stubs/Generator/StubsGenerator.php @@ -51,7 +51,7 @@ /** * @internal */ -class StubsGenerator +final class StubsGenerator { public static function getAll( Codebase $codebase, diff --git a/src/Psalm/Internal/Type/ArrayType.php b/src/Psalm/Internal/Type/ArrayType.php index c9e1d17acf7..f115fcc9879 100644 --- a/src/Psalm/Internal/Type/ArrayType.php +++ b/src/Psalm/Internal/Type/ArrayType.php @@ -15,7 +15,7 @@ /** * @internal */ -class ArrayType +final class ArrayType { public Union $key; diff --git a/src/Psalm/Internal/Type/AssertionReconciler.php b/src/Psalm/Internal/Type/AssertionReconciler.php index d2696f57f04..1cc7af0733c 100644 --- a/src/Psalm/Internal/Type/AssertionReconciler.php +++ b/src/Psalm/Internal/Type/AssertionReconciler.php @@ -70,7 +70,7 @@ /** * @internal */ -class AssertionReconciler extends Reconciler +final class AssertionReconciler extends Reconciler { /** * Reconciles types diff --git a/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php b/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php index 80c51b7acb5..8a39b72c976 100644 --- a/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php @@ -18,7 +18,7 @@ /** * @internal */ -class ArrayTypeComparator +final class ArrayTypeComparator { /** * @param TArray|TKeyedArray|TClassStringMap $input_type_part diff --git a/src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php b/src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php index e894a1d7189..11974afe85c 100644 --- a/src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php @@ -49,7 +49,7 @@ /** * @internal */ -class AtomicTypeComparator +final class AtomicTypeComparator { /** * Does the input param atomic type match the given param atomic type diff --git a/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php b/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php index 880c3ae3f80..82aa62d9108 100644 --- a/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php @@ -37,7 +37,7 @@ /** * @internal */ -class CallableTypeComparator +final class CallableTypeComparator { /** * @param TCallable|TClosure $input_type_part diff --git a/src/Psalm/Internal/Type/Comparator/ClassLikeStringComparator.php b/src/Psalm/Internal/Type/Comparator/ClassLikeStringComparator.php index e252680b31a..e63dd39a0f6 100644 --- a/src/Psalm/Internal/Type/Comparator/ClassLikeStringComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ClassLikeStringComparator.php @@ -16,7 +16,7 @@ /** * @internal */ -class ClassLikeStringComparator +final class ClassLikeStringComparator { /** * @param TClassString|TLiteralClassString $input_type_part diff --git a/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php b/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php index cbc10ecd28d..aea8be1da1a 100644 --- a/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php @@ -14,7 +14,7 @@ /** * @internal */ -class GenericTypeComparator +final class GenericTypeComparator { /** * @param TGenericObject|TIterable $container_type_part diff --git a/src/Psalm/Internal/Type/Comparator/IntegerRangeComparator.php b/src/Psalm/Internal/Type/Comparator/IntegerRangeComparator.php index a5493aad5db..ea0ff25f0a8 100644 --- a/src/Psalm/Internal/Type/Comparator/IntegerRangeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/IntegerRangeComparator.php @@ -18,7 +18,7 @@ /** * @internal */ -class IntegerRangeComparator +final class IntegerRangeComparator { /** * This method is used to check if an integer range can be contained in another diff --git a/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php b/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php index f52f415929b..f9786880a27 100644 --- a/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php +++ b/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php @@ -21,7 +21,7 @@ /** * @internal */ -class KeyedArrayComparator +final class KeyedArrayComparator { /** * @param TKeyedArray|TObjectWithProperties $input_type_part diff --git a/src/Psalm/Internal/Type/Comparator/ObjectComparator.php b/src/Psalm/Internal/Type/Comparator/ObjectComparator.php index 920fe6f6d6c..5689350663b 100644 --- a/src/Psalm/Internal/Type/Comparator/ObjectComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ObjectComparator.php @@ -25,7 +25,7 @@ /** * @internal */ -class ObjectComparator +final class ObjectComparator { /** * @param TNamedObject|TTemplateParam|TIterable $input_type_part diff --git a/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php b/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php index 20a93dd94d1..fdef3c46fc7 100644 --- a/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php @@ -47,7 +47,7 @@ /** * @internal */ -class ScalarTypeComparator +final class ScalarTypeComparator { public static function isContainedBy( Codebase $codebase, diff --git a/src/Psalm/Internal/Type/Comparator/TypeComparisonResult.php b/src/Psalm/Internal/Type/Comparator/TypeComparisonResult.php index d701b5c6928..989cae51cb6 100644 --- a/src/Psalm/Internal/Type/Comparator/TypeComparisonResult.php +++ b/src/Psalm/Internal/Type/Comparator/TypeComparisonResult.php @@ -10,7 +10,7 @@ /** * @internal */ -class TypeComparisonResult +final class TypeComparisonResult { /** * This is used to trigger `InvalidScalarArgument` in situations where we know PHP diff --git a/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php b/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php index 9a4bae8bce1..b62662f7b44 100644 --- a/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php @@ -31,7 +31,7 @@ /** * @internal */ -class UnionTypeComparator +final class UnionTypeComparator { /** * Does the input param type match the given param type diff --git a/src/Psalm/Internal/Type/NegatedAssertionReconciler.php b/src/Psalm/Internal/Type/NegatedAssertionReconciler.php index 9e64678007f..b916caa8e73 100644 --- a/src/Psalm/Internal/Type/NegatedAssertionReconciler.php +++ b/src/Psalm/Internal/Type/NegatedAssertionReconciler.php @@ -42,7 +42,7 @@ /** * @internal */ -class NegatedAssertionReconciler extends Reconciler +final class NegatedAssertionReconciler extends Reconciler { /** * @param string[] $suppressed_issues diff --git a/src/Psalm/Internal/Type/ParseTree/CallableParamTree.php b/src/Psalm/Internal/Type/ParseTree/CallableParamTree.php index 75ba6625cb8..2c3c8557222 100644 --- a/src/Psalm/Internal/Type/ParseTree/CallableParamTree.php +++ b/src/Psalm/Internal/Type/ParseTree/CallableParamTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class CallableParamTree extends ParseTree +final class CallableParamTree extends ParseTree { public bool $variadic = false; diff --git a/src/Psalm/Internal/Type/ParseTree/CallableTree.php b/src/Psalm/Internal/Type/ParseTree/CallableTree.php index 2484af89a84..6196c72d760 100644 --- a/src/Psalm/Internal/Type/ParseTree/CallableTree.php +++ b/src/Psalm/Internal/Type/ParseTree/CallableTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class CallableTree extends ParseTree +final class CallableTree extends ParseTree { public string $value; diff --git a/src/Psalm/Internal/Type/ParseTree/CallableWithReturnTypeTree.php b/src/Psalm/Internal/Type/ParseTree/CallableWithReturnTypeTree.php index ec0112ad8e8..3117db1adef 100644 --- a/src/Psalm/Internal/Type/ParseTree/CallableWithReturnTypeTree.php +++ b/src/Psalm/Internal/Type/ParseTree/CallableWithReturnTypeTree.php @@ -9,6 +9,6 @@ /** * @internal */ -class CallableWithReturnTypeTree extends ParseTree +final class CallableWithReturnTypeTree extends ParseTree { } diff --git a/src/Psalm/Internal/Type/ParseTree/ConditionalTree.php b/src/Psalm/Internal/Type/ParseTree/ConditionalTree.php index fd5e04d0ead..6cac672cdb2 100644 --- a/src/Psalm/Internal/Type/ParseTree/ConditionalTree.php +++ b/src/Psalm/Internal/Type/ParseTree/ConditionalTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class ConditionalTree extends ParseTree +final class ConditionalTree extends ParseTree { public TemplateIsTree $condition; diff --git a/src/Psalm/Internal/Type/ParseTree/EncapsulationTree.php b/src/Psalm/Internal/Type/ParseTree/EncapsulationTree.php index f0d9acf94c8..3ff96485d33 100644 --- a/src/Psalm/Internal/Type/ParseTree/EncapsulationTree.php +++ b/src/Psalm/Internal/Type/ParseTree/EncapsulationTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class EncapsulationTree extends ParseTree +final class EncapsulationTree extends ParseTree { public bool $terminated = false; } diff --git a/src/Psalm/Internal/Type/ParseTree/FieldEllipsis.php b/src/Psalm/Internal/Type/ParseTree/FieldEllipsis.php index 101b1c69385..ec05cd2f4ad 100644 --- a/src/Psalm/Internal/Type/ParseTree/FieldEllipsis.php +++ b/src/Psalm/Internal/Type/ParseTree/FieldEllipsis.php @@ -9,6 +9,6 @@ /** * @internal */ -class FieldEllipsis extends ParseTree +final class FieldEllipsis extends ParseTree { } diff --git a/src/Psalm/Internal/Type/ParseTree/GenericTree.php b/src/Psalm/Internal/Type/ParseTree/GenericTree.php index f029ecb0f4a..966e28fb23f 100644 --- a/src/Psalm/Internal/Type/ParseTree/GenericTree.php +++ b/src/Psalm/Internal/Type/ParseTree/GenericTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class GenericTree extends ParseTree +final class GenericTree extends ParseTree { public string $value; diff --git a/src/Psalm/Internal/Type/ParseTree/IndexedAccessTree.php b/src/Psalm/Internal/Type/ParseTree/IndexedAccessTree.php index 5e58f4e88ca..39891f6f23e 100644 --- a/src/Psalm/Internal/Type/ParseTree/IndexedAccessTree.php +++ b/src/Psalm/Internal/Type/ParseTree/IndexedAccessTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class IndexedAccessTree extends ParseTree +final class IndexedAccessTree extends ParseTree { public string $value; diff --git a/src/Psalm/Internal/Type/ParseTree/IntersectionTree.php b/src/Psalm/Internal/Type/ParseTree/IntersectionTree.php index b1afd6381ab..924dbea0b00 100644 --- a/src/Psalm/Internal/Type/ParseTree/IntersectionTree.php +++ b/src/Psalm/Internal/Type/ParseTree/IntersectionTree.php @@ -9,6 +9,6 @@ /** * @internal */ -class IntersectionTree extends ParseTree +final class IntersectionTree extends ParseTree { } diff --git a/src/Psalm/Internal/Type/ParseTree/KeyedArrayPropertyTree.php b/src/Psalm/Internal/Type/ParseTree/KeyedArrayPropertyTree.php index 8505c37866f..1c4793306f0 100644 --- a/src/Psalm/Internal/Type/ParseTree/KeyedArrayPropertyTree.php +++ b/src/Psalm/Internal/Type/ParseTree/KeyedArrayPropertyTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class KeyedArrayPropertyTree extends ParseTree +final class KeyedArrayPropertyTree extends ParseTree { public string $value; diff --git a/src/Psalm/Internal/Type/ParseTree/KeyedArrayTree.php b/src/Psalm/Internal/Type/ParseTree/KeyedArrayTree.php index 91805252e18..9a8e2a69b67 100644 --- a/src/Psalm/Internal/Type/ParseTree/KeyedArrayTree.php +++ b/src/Psalm/Internal/Type/ParseTree/KeyedArrayTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class KeyedArrayTree extends ParseTree +final class KeyedArrayTree extends ParseTree { public string $value; diff --git a/src/Psalm/Internal/Type/ParseTree/MethodParamTree.php b/src/Psalm/Internal/Type/ParseTree/MethodParamTree.php index 81e9731d53f..833f33109fa 100644 --- a/src/Psalm/Internal/Type/ParseTree/MethodParamTree.php +++ b/src/Psalm/Internal/Type/ParseTree/MethodParamTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class MethodParamTree extends ParseTree +final class MethodParamTree extends ParseTree { public bool $variadic; diff --git a/src/Psalm/Internal/Type/ParseTree/MethodTree.php b/src/Psalm/Internal/Type/ParseTree/MethodTree.php index dedc0b01ec0..595e3cdfcd7 100644 --- a/src/Psalm/Internal/Type/ParseTree/MethodTree.php +++ b/src/Psalm/Internal/Type/ParseTree/MethodTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class MethodTree extends ParseTree +final class MethodTree extends ParseTree { public string $value; diff --git a/src/Psalm/Internal/Type/ParseTree/MethodWithReturnTypeTree.php b/src/Psalm/Internal/Type/ParseTree/MethodWithReturnTypeTree.php index e9b606ce077..81f2894d98a 100644 --- a/src/Psalm/Internal/Type/ParseTree/MethodWithReturnTypeTree.php +++ b/src/Psalm/Internal/Type/ParseTree/MethodWithReturnTypeTree.php @@ -9,6 +9,6 @@ /** * @internal */ -class MethodWithReturnTypeTree extends ParseTree +final class MethodWithReturnTypeTree extends ParseTree { } diff --git a/src/Psalm/Internal/Type/ParseTree/NullableTree.php b/src/Psalm/Internal/Type/ParseTree/NullableTree.php index 6a53b35a42e..4fe0b0c6bb8 100644 --- a/src/Psalm/Internal/Type/ParseTree/NullableTree.php +++ b/src/Psalm/Internal/Type/ParseTree/NullableTree.php @@ -9,6 +9,6 @@ /** * @internal */ -class NullableTree extends ParseTree +final class NullableTree extends ParseTree { } diff --git a/src/Psalm/Internal/Type/ParseTree/Root.php b/src/Psalm/Internal/Type/ParseTree/Root.php index 4cf6cdfcf9a..076c0dcbca1 100644 --- a/src/Psalm/Internal/Type/ParseTree/Root.php +++ b/src/Psalm/Internal/Type/ParseTree/Root.php @@ -9,6 +9,6 @@ /** * @internal */ -class Root extends ParseTree +final class Root extends ParseTree { } diff --git a/src/Psalm/Internal/Type/ParseTree/TemplateAsTree.php b/src/Psalm/Internal/Type/ParseTree/TemplateAsTree.php index 915f3097a9a..b7d79634880 100644 --- a/src/Psalm/Internal/Type/ParseTree/TemplateAsTree.php +++ b/src/Psalm/Internal/Type/ParseTree/TemplateAsTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class TemplateAsTree extends ParseTree +final class TemplateAsTree extends ParseTree { public string $param_name; diff --git a/src/Psalm/Internal/Type/ParseTree/TemplateIsTree.php b/src/Psalm/Internal/Type/ParseTree/TemplateIsTree.php index ccbc40539cb..1bff424cacf 100644 --- a/src/Psalm/Internal/Type/ParseTree/TemplateIsTree.php +++ b/src/Psalm/Internal/Type/ParseTree/TemplateIsTree.php @@ -9,7 +9,7 @@ /** * @internal */ -class TemplateIsTree extends ParseTree +final class TemplateIsTree extends ParseTree { public string $param_name; diff --git a/src/Psalm/Internal/Type/ParseTree/UnionTree.php b/src/Psalm/Internal/Type/ParseTree/UnionTree.php index 099b5a3ad77..18e4bac6054 100644 --- a/src/Psalm/Internal/Type/ParseTree/UnionTree.php +++ b/src/Psalm/Internal/Type/ParseTree/UnionTree.php @@ -9,6 +9,6 @@ /** * @internal */ -class UnionTree extends ParseTree +final class UnionTree extends ParseTree { } diff --git a/src/Psalm/Internal/Type/ParseTree/Value.php b/src/Psalm/Internal/Type/ParseTree/Value.php index f6c775cc4bc..4367469d151 100644 --- a/src/Psalm/Internal/Type/ParseTree/Value.php +++ b/src/Psalm/Internal/Type/ParseTree/Value.php @@ -9,7 +9,7 @@ /** * @internal */ -class Value extends ParseTree +final class Value extends ParseTree { public string $value; diff --git a/src/Psalm/Internal/Type/ParseTreeCreator.php b/src/Psalm/Internal/Type/ParseTreeCreator.php index f862c8774e9..515838b95e8 100644 --- a/src/Psalm/Internal/Type/ParseTreeCreator.php +++ b/src/Psalm/Internal/Type/ParseTreeCreator.php @@ -36,7 +36,7 @@ /** * @internal */ -class ParseTreeCreator +final class ParseTreeCreator { private ParseTree $parse_tree; diff --git a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php index d8fb79f7044..04125509fd3 100644 --- a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php @@ -97,7 +97,7 @@ * * @internal */ -class SimpleAssertionReconciler extends Reconciler +final class SimpleAssertionReconciler extends Reconciler { /** * @param string[] $suppressed_issues diff --git a/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php index e8502df6f6c..bc966c70d47 100644 --- a/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php @@ -70,7 +70,7 @@ /** * @internal */ -class SimpleNegatedAssertionReconciler extends Reconciler +final class SimpleNegatedAssertionReconciler extends Reconciler { /** * @param string[] $suppressed_issues diff --git a/src/Psalm/Internal/Type/TemplateBound.php b/src/Psalm/Internal/Type/TemplateBound.php index 94febcedbc4..b67c79cc211 100644 --- a/src/Psalm/Internal/Type/TemplateBound.php +++ b/src/Psalm/Internal/Type/TemplateBound.php @@ -9,7 +9,7 @@ /** * @internal */ -class TemplateBound +final class TemplateBound { public Union $type; diff --git a/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php b/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php index e25548f49f2..3a872cefec1 100644 --- a/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php +++ b/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php @@ -41,7 +41,7 @@ /** * @internal */ -class TemplateInferredTypeReplacer +final class TemplateInferredTypeReplacer { /** * This replaces template types in unions with the inferred types they should be diff --git a/src/Psalm/Internal/Type/TemplateResult.php b/src/Psalm/Internal/Type/TemplateResult.php index e8e7ef9610e..1ad9dc2399f 100644 --- a/src/Psalm/Internal/Type/TemplateResult.php +++ b/src/Psalm/Internal/Type/TemplateResult.php @@ -26,7 +26,7 @@ * * @internal */ -class TemplateResult +final class TemplateResult { /** * @var array> diff --git a/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php b/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php index 32badeeff58..cc6281b151b 100644 --- a/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php +++ b/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php @@ -54,7 +54,7 @@ /** * @internal */ -class TemplateStandinTypeReplacer +final class TemplateStandinTypeReplacer { /** * This method fills in the values in $template_result based on how the various atomic types diff --git a/src/Psalm/Internal/Type/TypeAlias/ClassTypeAlias.php b/src/Psalm/Internal/Type/TypeAlias/ClassTypeAlias.php index 591fbeaf043..945fbc0f103 100644 --- a/src/Psalm/Internal/Type/TypeAlias/ClassTypeAlias.php +++ b/src/Psalm/Internal/Type/TypeAlias/ClassTypeAlias.php @@ -10,7 +10,7 @@ /** * @internal */ -class ClassTypeAlias implements TypeAlias +final class ClassTypeAlias implements TypeAlias { /** * @var list diff --git a/src/Psalm/Internal/Type/TypeAlias/InlineTypeAlias.php b/src/Psalm/Internal/Type/TypeAlias/InlineTypeAlias.php index 856574b12a3..35d6893ee96 100644 --- a/src/Psalm/Internal/Type/TypeAlias/InlineTypeAlias.php +++ b/src/Psalm/Internal/Type/TypeAlias/InlineTypeAlias.php @@ -11,7 +11,7 @@ * @psalm-immutable * @internal */ -class InlineTypeAlias implements TypeAlias +final class InlineTypeAlias implements TypeAlias { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/Type/TypeAlias/LinkableTypeAlias.php b/src/Psalm/Internal/Type/TypeAlias/LinkableTypeAlias.php index 80324d58b13..c8bfacbf0d4 100644 --- a/src/Psalm/Internal/Type/TypeAlias/LinkableTypeAlias.php +++ b/src/Psalm/Internal/Type/TypeAlias/LinkableTypeAlias.php @@ -11,7 +11,7 @@ * @psalm-immutable * @internal */ -class LinkableTypeAlias implements TypeAlias +final class LinkableTypeAlias implements TypeAlias { use ImmutableNonCloneableTrait; diff --git a/src/Psalm/Internal/Type/TypeCombination.php b/src/Psalm/Internal/Type/TypeCombination.php index f57182db5fb..0bc11918e7a 100644 --- a/src/Psalm/Internal/Type/TypeCombination.php +++ b/src/Psalm/Internal/Type/TypeCombination.php @@ -24,7 +24,7 @@ /** * @internal */ -class TypeCombination +final class TypeCombination { /** @var array */ public array $value_types = []; diff --git a/src/Psalm/Internal/Type/TypeCombiner.php b/src/Psalm/Internal/Type/TypeCombiner.php index cd5b2c62a6d..7bad564408c 100644 --- a/src/Psalm/Internal/Type/TypeCombiner.php +++ b/src/Psalm/Internal/Type/TypeCombiner.php @@ -74,7 +74,7 @@ /** * @internal */ -class TypeCombiner +final class TypeCombiner { /** * Combines types together diff --git a/src/Psalm/Internal/Type/TypeExpander.php b/src/Psalm/Internal/Type/TypeExpander.php index fb777f348b8..d4037652e8b 100644 --- a/src/Psalm/Internal/Type/TypeExpander.php +++ b/src/Psalm/Internal/Type/TypeExpander.php @@ -52,7 +52,7 @@ /** * @internal */ -class TypeExpander +final class TypeExpander { /** * @psalm-suppress InaccessibleProperty We just created the type diff --git a/src/Psalm/Internal/Type/TypeParser.php b/src/Psalm/Internal/Type/TypeParser.php index db5735e1528..eda058b9b55 100644 --- a/src/Psalm/Internal/Type/TypeParser.php +++ b/src/Psalm/Internal/Type/TypeParser.php @@ -103,7 +103,7 @@ * @psalm-suppress InaccessibleProperty Allowed during construction * @internal */ -class TypeParser +final class TypeParser { /** * Parses a string type representation diff --git a/src/Psalm/Internal/Type/TypeTokenizer.php b/src/Psalm/Internal/Type/TypeTokenizer.php index 3f62bffef73..a772bc7503e 100644 --- a/src/Psalm/Internal/Type/TypeTokenizer.php +++ b/src/Psalm/Internal/Type/TypeTokenizer.php @@ -24,7 +24,7 @@ /** * @internal */ -class TypeTokenizer +final class TypeTokenizer { /** * @var array diff --git a/src/Psalm/Internal/TypeVisitor/CanContainObjectTypeVisitor.php b/src/Psalm/Internal/TypeVisitor/CanContainObjectTypeVisitor.php index db574b8366b..833f6d3e4bf 100644 --- a/src/Psalm/Internal/TypeVisitor/CanContainObjectTypeVisitor.php +++ b/src/Psalm/Internal/TypeVisitor/CanContainObjectTypeVisitor.php @@ -12,7 +12,7 @@ use Psalm\Type\Union; /** @internal */ -class CanContainObjectTypeVisitor extends TypeVisitor +final class CanContainObjectTypeVisitor extends TypeVisitor { private bool $contains_object_type = false; diff --git a/src/Psalm/Internal/TypeVisitor/ClasslikeReplacer.php b/src/Psalm/Internal/TypeVisitor/ClasslikeReplacer.php index 4a34af2ec61..e46d68c45e2 100644 --- a/src/Psalm/Internal/TypeVisitor/ClasslikeReplacer.php +++ b/src/Psalm/Internal/TypeVisitor/ClasslikeReplacer.php @@ -16,7 +16,7 @@ /** * @internal */ -class ClasslikeReplacer extends MutableTypeVisitor +final class ClasslikeReplacer extends MutableTypeVisitor { private string $old; private string $new; diff --git a/src/Psalm/Internal/TypeVisitor/ContainsClassLikeVisitor.php b/src/Psalm/Internal/TypeVisitor/ContainsClassLikeVisitor.php index 0eebf5619a3..4fc9df15929 100644 --- a/src/Psalm/Internal/TypeVisitor/ContainsClassLikeVisitor.php +++ b/src/Psalm/Internal/TypeVisitor/ContainsClassLikeVisitor.php @@ -15,7 +15,7 @@ /** * @internal */ -class ContainsClassLikeVisitor extends TypeVisitor +final class ContainsClassLikeVisitor extends TypeVisitor { /** * @var lowercase-string diff --git a/src/Psalm/Internal/TypeVisitor/ContainsLiteralVisitor.php b/src/Psalm/Internal/TypeVisitor/ContainsLiteralVisitor.php index bdcf5709bdf..dfea8289159 100644 --- a/src/Psalm/Internal/TypeVisitor/ContainsLiteralVisitor.php +++ b/src/Psalm/Internal/TypeVisitor/ContainsLiteralVisitor.php @@ -16,7 +16,7 @@ /** * @internal */ -class ContainsLiteralVisitor extends TypeVisitor +final class ContainsLiteralVisitor extends TypeVisitor { private bool $contains_literal = false; diff --git a/src/Psalm/Internal/TypeVisitor/ContainsStaticVisitor.php b/src/Psalm/Internal/TypeVisitor/ContainsStaticVisitor.php index 7da6ef7256f..f76e96d0484 100644 --- a/src/Psalm/Internal/TypeVisitor/ContainsStaticVisitor.php +++ b/src/Psalm/Internal/TypeVisitor/ContainsStaticVisitor.php @@ -11,7 +11,7 @@ /** * @internal */ -class ContainsStaticVisitor extends TypeVisitor +final class ContainsStaticVisitor extends TypeVisitor { private bool $contains_static = false; diff --git a/src/Psalm/Internal/TypeVisitor/FromDocblockSetter.php b/src/Psalm/Internal/TypeVisitor/FromDocblockSetter.php index 59a0da3d636..b7e8720bedd 100644 --- a/src/Psalm/Internal/TypeVisitor/FromDocblockSetter.php +++ b/src/Psalm/Internal/TypeVisitor/FromDocblockSetter.php @@ -14,7 +14,7 @@ /** * @internal */ -class FromDocblockSetter extends MutableTypeVisitor +final class FromDocblockSetter extends MutableTypeVisitor { private bool $from_docblock; public function __construct(bool $from_docblock) diff --git a/src/Psalm/Internal/TypeVisitor/TemplateTypeCollector.php b/src/Psalm/Internal/TypeVisitor/TemplateTypeCollector.php index 47fb548f3e3..c363aaee609 100644 --- a/src/Psalm/Internal/TypeVisitor/TemplateTypeCollector.php +++ b/src/Psalm/Internal/TypeVisitor/TemplateTypeCollector.php @@ -15,7 +15,7 @@ /** * @internal */ -class TemplateTypeCollector extends TypeVisitor +final class TemplateTypeCollector extends TypeVisitor { /** * @var list diff --git a/src/Psalm/Internal/TypeVisitor/TypeChecker.php b/src/Psalm/Internal/TypeVisitor/TypeChecker.php index 3cefdd73264..f05faa9a05c 100644 --- a/src/Psalm/Internal/TypeVisitor/TypeChecker.php +++ b/src/Psalm/Internal/TypeVisitor/TypeChecker.php @@ -44,7 +44,7 @@ /** * @internal */ -class TypeChecker extends TypeVisitor +final class TypeChecker extends TypeVisitor { private StatementsSource $source; diff --git a/src/Psalm/Internal/TypeVisitor/TypeLocalizer.php b/src/Psalm/Internal/TypeVisitor/TypeLocalizer.php index 7b0907c165b..17a710d8821 100644 --- a/src/Psalm/Internal/TypeVisitor/TypeLocalizer.php +++ b/src/Psalm/Internal/TypeVisitor/TypeLocalizer.php @@ -19,7 +19,7 @@ /** * @internal */ -class TypeLocalizer extends MutableTypeVisitor +final class TypeLocalizer extends MutableTypeVisitor { /** * @var array> diff --git a/src/Psalm/Internal/TypeVisitor/TypeScanner.php b/src/Psalm/Internal/TypeVisitor/TypeScanner.php index 0596bb1b9f2..e610f249d0b 100644 --- a/src/Psalm/Internal/TypeVisitor/TypeScanner.php +++ b/src/Psalm/Internal/TypeVisitor/TypeScanner.php @@ -17,7 +17,7 @@ /** * @internal */ -class TypeScanner extends TypeVisitor +final class TypeScanner extends TypeVisitor { private Scanner $scanner; diff --git a/src/Psalm/Issue/InvalidInterfaceImplementation.php b/src/Psalm/Issue/InvalidInterfaceImplementation.php index 4993a72e4e9..cac93fb1e18 100644 --- a/src/Psalm/Issue/InvalidInterfaceImplementation.php +++ b/src/Psalm/Issue/InvalidInterfaceImplementation.php @@ -4,7 +4,7 @@ namespace Psalm\Issue; -class InvalidInterfaceImplementation extends ClassIssue +final class InvalidInterfaceImplementation extends ClassIssue { const ERROR_LEVEL = -1; const SHORTCODE = 317; diff --git a/src/Psalm/Issue/PrivateFinalMethod.php b/src/Psalm/Issue/PrivateFinalMethod.php index 8884c29ad0a..9577efeca8b 100644 --- a/src/Psalm/Issue/PrivateFinalMethod.php +++ b/src/Psalm/Issue/PrivateFinalMethod.php @@ -4,7 +4,7 @@ namespace Psalm\Issue; -class PrivateFinalMethod extends MethodIssue +final class PrivateFinalMethod extends MethodIssue { public const ERROR_LEVEL = 2; public const SHORTCODE = 320; diff --git a/src/Psalm/Issue/RiskyCast.php b/src/Psalm/Issue/RiskyCast.php index ea267cafdc0..70f44365381 100644 --- a/src/Psalm/Issue/RiskyCast.php +++ b/src/Psalm/Issue/RiskyCast.php @@ -4,7 +4,7 @@ namespace Psalm\Issue; -class RiskyCast extends CodeIssue +final class RiskyCast extends CodeIssue { public const ERROR_LEVEL = 3; public const SHORTCODE = 313; diff --git a/src/Psalm/Issue/UnusedBaselineEntry.php b/src/Psalm/Issue/UnusedBaselineEntry.php index 7397a33d3f3..bcf91136bc3 100644 --- a/src/Psalm/Issue/UnusedBaselineEntry.php +++ b/src/Psalm/Issue/UnusedBaselineEntry.php @@ -4,7 +4,7 @@ namespace Psalm\Issue; -class UnusedBaselineEntry extends ClassIssue +final class UnusedBaselineEntry extends ClassIssue { public const ERROR_LEVEL = -1; public const SHORTCODE = 316; diff --git a/src/Psalm/Report/CountReport.php b/src/Psalm/Report/CountReport.php index b044d851651..a0ec59602ba 100644 --- a/src/Psalm/Report/CountReport.php +++ b/src/Psalm/Report/CountReport.php @@ -9,7 +9,7 @@ use function array_key_exists; use function uksort; -class CountReport extends Report +final class CountReport extends Report { public function create(): string { diff --git a/src/Psalm/Type/Atomic/TNonEmptyArray.php b/src/Psalm/Type/Atomic/TNonEmptyArray.php index a33c37f195e..c4b9a9c28ab 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyArray.php +++ b/src/Psalm/Type/Atomic/TNonEmptyArray.php @@ -12,7 +12,7 @@ * * @psalm-immutable */ -class TNonEmptyArray extends TArray +final class TNonEmptyArray extends TArray { /** * @var positive-int|null From 5088dc0293538a7a985156b7f005e08c30c0d812 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 12:22:50 +0200 Subject: [PATCH 26/38] Minor fix --- src/Psalm/Internal/LanguageServer/Server/Workspace.php | 2 +- src/Psalm/Internal/PluginManager/PluginListFactory.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/LanguageServer/Server/Workspace.php b/src/Psalm/Internal/LanguageServer/Server/Workspace.php index 9b6ae77b828..2ce097eb0eb 100644 --- a/src/Psalm/Internal/LanguageServer/Server/Workspace.php +++ b/src/Psalm/Internal/LanguageServer/Server/Workspace.php @@ -106,7 +106,7 @@ public function didChangeWatchedFiles(array $changes): void /** * A notification sent from the client to the server to signal the change of configuration settings. * - * @psalm-suppress PossiblyUnusedMethod, PossiblyUnusedParam + * @psalm-suppress PossiblyUnusedMethod, UnusedParam */ public function didChangeConfiguration(mixed $settings): void { diff --git a/src/Psalm/Internal/PluginManager/PluginListFactory.php b/src/Psalm/Internal/PluginManager/PluginListFactory.php index 659f72dcebc..fafbc267532 100644 --- a/src/Psalm/Internal/PluginManager/PluginListFactory.php +++ b/src/Psalm/Internal/PluginManager/PluginListFactory.php @@ -18,7 +18,7 @@ /** * @internal */ -final class PluginListFactory +class PluginListFactory { private string $project_root; From 3e6294e97bbda51ee2812a6cee31f9cefd9a40d3 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 12:51:16 +0200 Subject: [PATCH 27/38] Simplify --- .../Expression/Call/ArgumentAnalyzer.php | 115 +++++++++--------- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php index 80456403bc6..060ed42d1a7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php @@ -1344,6 +1344,16 @@ private static function coerceValueAfterGatekeeperArgument( return; } + $var_id = ExpressionIdentifier::getVarId( + $input_expr, + $statements_analyzer->getFQCLN(), + $statements_analyzer, + ); + + if (!$var_id) { + return; + } + if (!$input_type_changed && $param_type->from_docblock && !$input_type->hasMixed()) { $types = $input_type->getAtomicTypes(); foreach ($param_type->getAtomicTypes() as $param_atomic_type) { @@ -1382,74 +1392,67 @@ private static function coerceValueAfterGatekeeperArgument( $input_type = new Union($types); } - $var_id = ExpressionIdentifier::getVarId( - $input_expr, - $statements_analyzer->getFQCLN(), - $statements_analyzer, - ); - if ($var_id) { - $was_cloned = false; - - if ($input_type->isNullable() && !$param_type->isNullable()) { - $input_type = $input_type->getBuilder(); - $was_cloned = true; - $input_type->removeType('null'); - $input_type = $input_type->freeze(); - } + $was_cloned = false; - if ($input_type->getId() === $param_type->getId()) { - if ($input_type->from_docblock) { - $input_type = $input_type->setFromDocblock(false); - } - } elseif ($input_type->hasMixed() && $signature_param_type) { - $was_cloned = true; - $parent_nodes = $input_type->parent_nodes; - $by_ref = $input_type->by_ref; - $input_type = $signature_param_type->setProperties([ - 'ignore_nullable_issues' => $signature_param_type->isNullable(), - 'parent_nodes' => $parent_nodes, - 'by_ref' => $by_ref, - ]); - } + if ($input_type->isNullable() && !$param_type->isNullable()) { + $input_type = $input_type->getBuilder(); + $was_cloned = true; + $input_type->removeType('null'); + $input_type = $input_type->freeze(); + } - if ($context->inside_conditional && !isset($context->assigned_var_ids[$var_id])) { - $context->assigned_var_ids[$var_id] = 0; + if ($input_type->getId() === $param_type->getId()) { + if ($input_type->from_docblock) { + $input_type = $input_type->setFromDocblock(false); } + } elseif ($input_type->hasMixed() && $signature_param_type) { + $was_cloned = true; + $parent_nodes = $input_type->parent_nodes; + $by_ref = $input_type->by_ref; + $input_type = $signature_param_type->setProperties([ + 'ignore_nullable_issues' => $signature_param_type->isNullable(), + 'parent_nodes' => $parent_nodes, + 'by_ref' => $by_ref, + ]); + } - if ($was_cloned) { - $context->removeVarFromConflictingClauses($var_id, null, $statements_analyzer); - } + if ($context->inside_conditional && !isset($context->assigned_var_ids[$var_id])) { + $context->assigned_var_ids[$var_id] = 0; + } - if ($unpack) { - if ($unpacked_atomic_array instanceof TArray) { - $unpacked_atomic_array = $unpacked_atomic_array->setTypeParams([ - $unpacked_atomic_array->type_params[0], - $input_type, - ]); + if ($was_cloned) { + $context->removeVarFromConflictingClauses($var_id, null, $statements_analyzer); + } - $context->vars_in_scope[$var_id] = new Union([$unpacked_atomic_array]); - } elseif ($unpacked_atomic_array instanceof TKeyedArray - && $unpacked_atomic_array->is_list - ) { - if ($unpacked_atomic_array->isNonEmpty()) { - $unpacked_atomic_array = Type::getNonEmptyListAtomic($input_type); - } else { - $unpacked_atomic_array = Type::getListAtomic($input_type); - } + if ($unpack) { + if ($unpacked_atomic_array instanceof TArray) { + $unpacked_atomic_array = $unpacked_atomic_array->setTypeParams([ + $unpacked_atomic_array->type_params[0], + $input_type, + ]); - $context->vars_in_scope[$var_id] = new Union([$unpacked_atomic_array]); + $context->vars_in_scope[$var_id] = new Union([$unpacked_atomic_array]); + } elseif ($unpacked_atomic_array instanceof TKeyedArray + && $unpacked_atomic_array->is_list + ) { + if ($unpacked_atomic_array->isNonEmpty()) { + $unpacked_atomic_array = Type::getNonEmptyListAtomic($input_type); } else { - $context->vars_in_scope[$var_id] = new Union([ - new TArray([ - Type::getInt(), - $input_type, - ]), - ]); + $unpacked_atomic_array = Type::getListAtomic($input_type); } + + $context->vars_in_scope[$var_id] = new Union([$unpacked_atomic_array]); } else { - $context->vars_in_scope[$var_id] = $input_type; + $context->vars_in_scope[$var_id] = new Union([ + new TArray([ + Type::getInt(), + $input_type, + ]), + ]); } + } else { + $context->vars_in_scope[$var_id] = $input_type; } } From fe4928cf8dc32c1d70f80d588e38e5204e985abd Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 13:04:53 +0200 Subject: [PATCH 28/38] Add suppression and note --- .../Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php index 6c85b646c1c..24aabab4cbc 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php @@ -244,6 +244,7 @@ public function start(PhpParser\Node\FunctionLike $stmt, bool $fake_method = fal if ($stmt instanceof PhpParser\Node\Stmt\Function_ || $stmt instanceof PhpParser\Node\Stmt\ClassMethod ) { + /** @psalm-suppress RedundantCondition See https://github.com/vimeo/psalm/issues/10296 */ if ($stmt instanceof PhpParser\Node\Stmt\ClassMethod && $storage instanceof MethodStorage && $classlike_storage From 394e38599d666c397e162439e5672fb790914274 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 13:12:06 +0200 Subject: [PATCH 29/38] Strict types everywhere --- UPGRADING.md | 2 ++ bin/generate_issues_list_doc.php | 2 ++ bin/generate_levels_doc.php | 2 ++ bin/generate_testsuites.php | 2 ++ bin/improve_class_alias.php | 2 ++ bin/max_used_shortcode.php | 2 ++ phpcs.xml | 2 -- src/Psalm/Internal/Analyzer/Statements/DeclareAnalyzer.php | 2 ++ src/Psalm/Internal/Codebase/ClassLikes.php | 2 ++ src/Psalm/Internal/Codebase/ImpureFunctionsList.php | 2 ++ .../Internal/LanguageServer/Client/Progress/LegacyProgress.php | 2 ++ src/Psalm/Internal/LanguageServer/Client/Progress/Progress.php | 2 ++ .../LanguageServer/Client/Progress/ProgressInterface.php | 2 ++ src/Psalm/Internal/LanguageServer/PathMapper.php | 2 ++ src/Psalm/Issue/DuplicateProperty.php | 2 ++ src/Psalm/Issue/InvalidInterfaceImplementation.php | 2 +- src/Psalm/Issue/PrivateFinalMethod.php | 2 +- src/Psalm/Issue/RiskyCast.php | 2 +- src/Psalm/Issue/TaintedSleep.php | 2 ++ src/Psalm/Issue/TaintedXpath.php | 2 ++ src/Psalm/Issue/UnusedBaselineEntry.php | 2 +- src/Psalm/Storage/EnumCaseStorage.php | 2 ++ tests/AlgebraTest.php | 2 ++ tests/AnnotationTest.php | 2 ++ tests/ArgTest.php | 2 ++ tests/ArrayAccessTest.php | 2 ++ tests/ArrayAssignmentTest.php | 2 ++ tests/ArrayFunctionCallTest.php | 2 ++ tests/AssertAnnotationTest.php | 2 ++ tests/AssignmentTest.php | 2 ++ tests/AsyncTestCase.php | 2 ++ tests/AttributeTest.php | 2 ++ tests/BadFormatTest.php | 2 ++ tests/BinaryOperationTest.php | 2 ++ tests/ByIssueLevelAndTypeReportTest.php | 2 ++ tests/CallableTest.php | 2 ++ tests/CastTest.php | 2 ++ tests/CheckTypeTest.php | 2 ++ tests/ClassLikeDocblockParserTest.php | 2 ++ tests/ClassLikeStringTest.php | 2 ++ tests/ClassLoadOrderTest.php | 2 ++ tests/ClassScopeTest.php | 2 ++ tests/ClassTest.php | 2 ++ tests/ClosureTest.php | 2 ++ tests/CodebaseTest.php | 2 ++ tests/CommentAnalyzerTest.php | 2 ++ tests/ComposerLockTest.php | 2 ++ tests/Config/ConfigFileTest.php | 2 ++ tests/Config/ConfigTest.php | 2 ++ tests/Config/CreatorTest.php | 2 ++ tests/Config/Plugin/AfterAnalysisPlugin.php | 2 ++ tests/Config/Plugin/FilePlugin.php | 2 ++ tests/Config/Plugin/FileTypeSelfRegisteringPlugin.php | 2 ++ tests/Config/Plugin/FunctionPlugin.php | 2 ++ tests/Config/Plugin/Hook/AfterAnalysis.php | 2 ++ .../Plugin/Hook/CustomArrayMapFunctionStorageProvider.php | 2 ++ tests/Config/Plugin/Hook/FileProvider.php | 2 ++ tests/Config/Plugin/Hook/FooMethodProvider.php | 2 ++ tests/Config/Plugin/Hook/FooPropertyProvider.php | 2 ++ tests/Config/Plugin/Hook/MagicFunctionProvider.php | 2 ++ tests/Config/Plugin/MethodPlugin.php | 2 ++ tests/Config/Plugin/PropertyPlugin.php | 2 ++ tests/Config/Plugin/StoragePlugin.php | 2 ++ tests/Config/PluginListTest.php | 2 ++ tests/Config/PluginTest.php | 2 ++ tests/ConstValuesTest.php | 2 ++ tests/ConstantTest.php | 2 ++ tests/CoreStubsTest.php | 2 ++ tests/DateTimeTest.php | 2 ++ tests/DeprecatedAnnotationTest.php | 2 ++ tests/DocCommentTest.php | 2 ++ tests/DocblockInheritanceTest.php | 2 ++ tests/DocumentationTest.php | 2 ++ tests/EndToEnd/DestructiveAutoloaderTest.php | 2 ++ tests/EndToEnd/PsalmEndToEndTest.php | 2 ++ tests/EndToEnd/PsalmRunnerTrait.php | 2 ++ tests/EndToEnd/SuicidalAutoloaderTest.php | 2 ++ tests/EnumTest.php | 2 ++ tests/ErrorBaselineTest.php | 2 ++ tests/ExpressionTest.php | 2 ++ tests/ExtendsFinalClassTest.php | 2 ++ tests/ExtensionRequirementTest.php | 2 ++ tests/FileDiffTest.php | 2 ++ tests/FileManipulation/ClassConstantMoveTest.php | 2 ++ tests/FileManipulation/ClassMoveTest.php | 2 ++ tests/FileManipulation/FileManipulationTestCase.php | 2 ++ tests/FileManipulation/ImmutableAnnotationAdditionTest.php | 2 ++ tests/FileManipulation/MethodMoveTest.php | 2 ++ tests/FileManipulation/MissingPropertyTypeTest.php | 2 ++ tests/FileManipulation/MissingReturnTypeTest.php | 2 ++ tests/FileManipulation/NamespaceMoveTest.php | 2 ++ tests/FileManipulation/ParamNameMismatchTest.php | 2 ++ tests/FileManipulation/ParamTypeManipulationTest.php | 2 ++ tests/FileManipulation/PropertyMoveTest.php | 2 ++ tests/FileManipulation/PureAnnotationAdditionTest.php | 2 ++ tests/FileManipulation/RedundantCastManipulationTest.php | 2 ++ tests/FileManipulation/ReturnTypeManipulationTest.php | 2 ++ tests/FileManipulation/ThrowsBlockAdditionTest.php | 2 ++ tests/FileManipulation/UndefinedVariableManipulationTest.php | 2 ++ .../UnnecessaryVarAnnotationManipulationTest.php | 2 ++ tests/FileManipulation/UnusedCodeManipulationTest.php | 2 ++ tests/FileManipulation/UnusedVariableManipulationTest.php | 2 ++ tests/FileReferenceTest.php | 2 ++ tests/FileUpdates/AnalyzedMethodTest.php | 2 ++ tests/FileUpdates/CachedStorageTest.php | 2 ++ tests/FileUpdates/ErrorAfterUpdateTest.php | 2 ++ tests/FileUpdates/ErrorFixTest.php | 2 ++ tests/FileUpdates/TemporaryUpdateTest.php | 2 ++ tests/ForbiddenCodeTest.php | 2 ++ tests/FunctionCallTest.php | 2 ++ tests/FunctionLikeDocblockParserTest.php | 2 ++ tests/GeneratorTest.php | 2 ++ tests/IfThisIsTest.php | 2 ++ tests/ImmutableAnnotationTest.php | 2 ++ tests/ImplementationRequirementTest.php | 2 ++ tests/IncludeTest.php | 2 ++ tests/IntRangeTest.php | 2 ++ tests/InterfaceTest.php | 2 ++ tests/Internal/CallMapTest.php | 2 ++ tests/Internal/CliUtilsTest.php | 2 ++ tests/Internal/Codebase/InternalCallMapHandlerTest.php | 2 ++ .../Provider/ClassLikeStorageInstanceCacheProvider.php | 2 ++ tests/Internal/Provider/FakeFileReferenceCacheProvider.php | 2 ++ tests/Internal/Provider/FakeParserCacheProvider.php | 2 ++ tests/Internal/Provider/FileStorageInstanceCacheProvider.php | 2 ++ tests/Internal/Provider/ParserInstanceCacheProvider.php | 2 ++ tests/Internal/Provider/ProjectCacheProvider.php | 2 ++ tests/Internal/Scanner/FileScannerTest.php | 2 ++ tests/InternalAnnotationTest.php | 2 ++ tests/IssueBufferTest.php | 2 ++ tests/IssueSuppressionTest.php | 2 ++ tests/JsonOutputTest.php | 2 ++ tests/LanguageServer/CompletionTest.php | 2 ++ tests/LanguageServer/DiagnosticTest.php | 2 ++ tests/LanguageServer/FileMapTest.php | 2 ++ tests/LanguageServer/Message.php | 2 ++ tests/LanguageServer/PathMapperTest.php | 2 ++ tests/LanguageServer/SymbolLookupTest.php | 2 ++ tests/ListTest.php | 2 ++ tests/Loop/DoTest.php | 2 ++ tests/Loop/ForTest.php | 2 ++ tests/Loop/ForeachTest.php | 2 ++ tests/Loop/WhileTest.php | 2 ++ tests/MagicMethodAnnotationTest.php | 2 ++ tests/MagicPropertyTest.php | 2 ++ tests/MatchTest.php | 2 ++ tests/MethodCallTest.php | 2 ++ tests/MethodMutationTest.php | 2 ++ tests/MethodSignatureTest.php | 2 ++ tests/MixinAnnotationTest.php | 2 ++ tests/NamespaceTest.php | 2 ++ tests/NativeIntersectionsTest.php | 2 ++ tests/NativeUnionsTest.php | 2 ++ tests/Php40Test.php | 2 ++ tests/Php55Test.php | 2 ++ tests/Php56Test.php | 2 ++ tests/Php70Test.php | 2 ++ tests/Php71Test.php | 2 ++ tests/Progress/EchoProgress.php | 2 ++ tests/ProjectCheckerTest.php | 2 ++ tests/PropertiesOfTest.php | 2 ++ tests/PropertyTypeInvarianceTest.php | 2 ++ tests/PropertyTypeTest.php | 2 ++ tests/PsalmPluginTest.php | 2 ++ tests/PureAnnotationTest.php | 2 ++ tests/PureCallableTest.php | 2 ++ tests/ReadonlyPropertyTest.php | 2 ++ tests/ReferenceConstraintTest.php | 2 ++ tests/ReferenceTest.php | 2 ++ tests/ReportOutputTest.php | 2 ++ tests/ReturnTypeProvider/ArrayColumnTest.php | 2 ++ tests/ReturnTypeProvider/ArraySliceTest.php | 2 ++ tests/ReturnTypeProvider/BasenameTest.php | 2 ++ tests/ReturnTypeProvider/DirnameTest.php | 2 ++ tests/ReturnTypeProvider/ExceptionCodeTest.php | 2 ++ tests/ReturnTypeProvider/InArrayTest.php | 2 ++ tests/ReturnTypeProvider/MinMaxReturnTypeProviderTest.php | 2 ++ tests/ReturnTypeProvider/PowReturnTypeProviderTest.php | 2 ++ tests/ReturnTypeProvider/SprintfTest.php | 2 ++ tests/ReturnTypeTest.php | 2 ++ tests/StubTest.php | 2 ++ tests/SuperGlobalsTest.php | 2 ++ tests/SwitchTypeTest.php | 2 ++ tests/TaintTest.php | 2 ++ tests/Template/ClassStringMapTest.php | 2 ++ tests/Template/ClassTemplateCovarianceTest.php | 2 ++ tests/Template/ClassTemplateExtendsTest.php | 2 ++ tests/Template/ClassTemplateTest.php | 2 ++ tests/Template/ConditionalReturnTypeTest.php | 2 ++ tests/Template/FunctionClassStringTemplateTest.php | 2 ++ tests/Template/FunctionTemplateAssertTest.php | 2 ++ tests/Template/FunctionTemplateTest.php | 2 ++ tests/Template/NestedTemplateTest.php | 2 ++ tests/Template/PropertiesOfTemplateTest.php | 2 ++ tests/Template/TraitTemplateTest.php | 2 ++ tests/TestCase.php | 2 ++ tests/TestConfig.php | 2 ++ tests/TestEnvironmentTest.php | 2 ++ tests/ThisOutTest.php | 2 ++ tests/ThrowsAnnotationTest.php | 2 ++ tests/ThrowsInGlobalScopeTest.php | 2 ++ tests/ToStringTest.php | 2 ++ tests/TraceTest.php | 2 ++ tests/TraitTest.php | 2 ++ tests/Traits/InvalidCodeAnalysisTestTrait.php | 2 ++ tests/Traits/ValidCodeAnalysisTestTrait.php | 2 ++ tests/TryCatchTest.php | 2 ++ tests/TypeAnnotationTest.php | 2 ++ tests/TypeCombinationTest.php | 2 ++ tests/TypeComparatorTest.php | 2 ++ tests/TypeParseTest.php | 2 ++ tests/TypeReconciliation/ArrayKeyExistsTest.php | 2 ++ tests/TypeReconciliation/AssignmentInConditionalTest.php | 2 ++ tests/TypeReconciliation/ConditionalTest.php | 2 ++ tests/TypeReconciliation/EmptyTest.php | 2 ++ tests/TypeReconciliation/InArrayTest.php | 2 ++ tests/TypeReconciliation/IssetTest.php | 2 ++ tests/TypeReconciliation/ReconcilerTest.php | 2 ++ tests/TypeReconciliation/RedundantConditionTest.php | 2 ++ tests/TypeReconciliation/ScopeTest.php | 2 ++ tests/TypeReconciliation/TypeAlgebraTest.php | 2 ++ tests/TypeReconciliation/TypeTest.php | 2 ++ tests/TypeReconciliation/ValueTest.php | 2 ++ tests/UnresolvableIncludeTest.php | 2 ++ tests/UnusedCodeTest.php | 2 ++ tests/UnusedVariableTest.php | 2 ++ tests/VariadicTest.php | 2 ++ tests/somefile.php | 3 +++ 228 files changed, 451 insertions(+), 6 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index 936f35747dd..62cbdfc964c 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -42,6 +42,8 @@ - [BC] Property `Psalm\Storage\EnumCaseStorage::$value` changed from `int|string|null` to `TLiteralInt|TLiteralString|null` +- [BC] `Psalm\CodeLocation\Raw`, `Psalm\CodeLocation\ParseErrorLocation`, `Psalm\CodeLocation\DocblockTypeLocation`, `Psalm\Report\CountReport`, `Psalm\Type\Atomic\TNonEmptyArray` are now all final. + # Upgrading from Psalm 4 to Psalm 5 ## Changed diff --git a/bin/generate_issues_list_doc.php b/bin/generate_issues_list_doc.php index 8a3e179ca2d..0b324af3504 100755 --- a/bin/generate_issues_list_doc.php +++ b/bin/generate_issues_list_doc.php @@ -1,6 +1,8 @@ #!/usr/bin/env php ' . PHP_EOL); exit(1); diff --git a/bin/improve_class_alias.php b/bin/improve_class_alias.php index 6b6f34ff299..014fc4144e9 100644 --- a/bin/improve_class_alias.php +++ b/bin/improve_class_alias.php @@ -1,5 +1,7 @@ - - - bin/* - src/Psalm/Internal/* - tests/* diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 3c8161aabe4..d04ba234885 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -251,6 +251,16 @@ $stub + + + methods[$declaring_method_name]->stubbed]]> + + + + + methods[$implementing_method_id->method_name]->abstract]]> + + $property_name diff --git a/src/Psalm/Aliases.php b/src/Psalm/Aliases.php index 5ec3f3fb3e7..daa39b90a30 100644 --- a/src/Psalm/Aliases.php +++ b/src/Psalm/Aliases.php @@ -9,44 +9,40 @@ final class Aliases /** * @var array */ - public $uses; + public array $uses; /** * @var array */ - public $uses_flipped; + public array $uses_flipped; /** * @var array */ - public $functions; + public array $functions; /** * @var array */ - public $functions_flipped; + public array $functions_flipped; /** * @var array */ - public $constants; + public array $constants; /** * @var array */ - public $constants_flipped; + public array $constants_flipped; - /** @var string|null */ - public $namespace; + public ?string $namespace = null; - /** @var ?int */ - public $namespace_first_stmt_start; + public ?int $namespace_first_stmt_start = null; - /** @var ?int */ - public $uses_start; + public ?int $uses_start = null; - /** @var ?int */ - public $uses_end; + public ?int $uses_end = null; /** * @param array $uses diff --git a/src/Psalm/CodeLocation.php b/src/Psalm/CodeLocation.php index 063a6f498f8..9c35acfb340 100644 --- a/src/Psalm/CodeLocation.php +++ b/src/Psalm/CodeLocation.php @@ -35,34 +35,25 @@ class CodeLocation { use ImmutableNonCloneableTrait; - /** @var string */ - public $file_path; + public string $file_path; - /** @var string */ - public $file_name; + public string $file_name; - /** @var int */ - public $raw_line_number; + public int $raw_line_number; private int $end_line_number = -1; - /** @var int */ - public $raw_file_start; + public int $raw_file_start; - /** @var int */ - public $raw_file_end; + public int $raw_file_end; - /** @var int */ - protected $file_start; + protected int $file_start; - /** @var int */ - protected $file_end; + protected int $file_end; - /** @var bool */ - protected $single_line; + protected bool $single_line; - /** @var int */ - protected $preview_start; + protected int $preview_start; private int $preview_end = -1; @@ -78,20 +69,17 @@ class CodeLocation private ?string $text = null; - /** @var int|null */ - public $docblock_start; + public ?int $docblock_start = null; private ?int $docblock_start_line_number = null; - /** @var int|null */ - protected $docblock_line_number; + protected ?int $docblock_line_number = null; private ?int $regex_type = null; private bool $have_recalculated = false; - /** @var null|CodeLocation */ - public $previous_location; + public ?CodeLocation $previous_location = null; public const VAR_TYPE = 0; public const FUNCTION_RETURN_TYPE = 1; diff --git a/src/Psalm/Codebase.php b/src/Psalm/Codebase.php index ca852b76435..1e2e47498b7 100644 --- a/src/Psalm/Codebase.php +++ b/src/Psalm/Codebase.php @@ -100,10 +100,7 @@ final class Codebase { - /** - * @var Config - */ - public $config; + public Config $config; /** * A map of fully-qualified use declarations to the files @@ -111,211 +108,138 @@ final class Codebase * * @var array> */ - public $use_referencing_locations = []; + public array $use_referencing_locations = []; - /** - * @var FileStorageProvider - */ - public $file_storage_provider; + public FileStorageProvider $file_storage_provider; - /** - * @var ClassLikeStorageProvider - */ - public $classlike_storage_provider; + public ClassLikeStorageProvider $classlike_storage_provider; - /** - * @var bool - */ - public $collect_references = false; + public bool $collect_references = false; - /** - * @var bool - */ - public $collect_locations = false; + public bool $collect_locations = false; /** * @var null|'always'|'auto' */ - public $find_unused_code; + public ?string $find_unused_code = null; - /** - * @var FileProvider - */ - public $file_provider; + public FileProvider $file_provider; - /** - * @var FileReferenceProvider - */ - public $file_reference_provider; + public FileReferenceProvider $file_reference_provider; - /** - * @var StatementsProvider - */ - public $statements_provider; + public StatementsProvider $statements_provider; private Progress $progress; /** * @var array */ - private static $stubbed_constants = []; + private static array $stubbed_constants = []; /** * Whether to register autoloaded information - * - * @var bool */ - public $register_autoload_files = false; + public bool $register_autoload_files = false; /** * Whether to log functions just at the file level or globally (for stubs) - * - * @var bool */ - public $register_stub_files = false; + public bool $register_stub_files = false; - /** - * @var bool - */ - public $find_unused_variables = false; + public bool $find_unused_variables = false; - /** - * @var Scanner - */ - public $scanner; + public Scanner $scanner; - /** - * @var Analyzer - */ - public $analyzer; + public Analyzer $analyzer; - /** - * @var Functions - */ - public $functions; + public Functions $functions; - /** - * @var ClassLikes - */ - public $classlikes; + public ClassLikes $classlikes; - /** - * @var Methods - */ - public $methods; + public Methods $methods; - /** - * @var Properties - */ - public $properties; + public Properties $properties; - /** - * @var Populator - */ - public $populator; + public Populator $populator; - /** - * @var ?TaintFlowGraph - */ - public $taint_flow_graph; + public ?TaintFlowGraph $taint_flow_graph = null; - /** - * @var bool - */ - public $server_mode = false; + public bool $server_mode = false; - /** - * @var bool - */ - public $store_node_types = false; + public bool $store_node_types = false; /** * Whether or not to infer types from usage. Computationally expensive, so turned off by default - * - * @var bool */ - public $infer_types_from_usage = false; + public bool $infer_types_from_usage = false; - /** - * @var bool - */ - public $alter_code = false; + public bool $alter_code = false; - /** - * @var bool - */ - public $diff_methods = false; + public bool $diff_methods = false; /** * @var array */ - public $methods_to_move = []; + public array $methods_to_move = []; /** * @var array */ - public $methods_to_rename = []; + public array $methods_to_rename = []; /** * @var array */ - public $properties_to_move = []; + public array $properties_to_move = []; /** * @var array */ - public $properties_to_rename = []; + public array $properties_to_rename = []; /** * @var array */ - public $class_constants_to_move = []; + public array $class_constants_to_move = []; /** * @var array */ - public $class_constants_to_rename = []; + public array $class_constants_to_rename = []; /** * @var array */ - public $classes_to_move = []; + public array $classes_to_move = []; /** * @var array */ - public $call_transforms = []; + public array $call_transforms = []; /** * @var array */ - public $property_transforms = []; + public array $property_transforms = []; /** * @var array */ - public $class_constant_transforms = []; + public array $class_constant_transforms = []; /** * @var array */ - public $class_transforms = []; + public array $class_transforms = []; - /** - * @var bool - */ - public $allow_backwards_incompatible_changes = true; + public bool $allow_backwards_incompatible_changes = true; - /** @var int */ - public $analysis_php_version_id = PHP_VERSION_ID; + public int $analysis_php_version_id = PHP_VERSION_ID; /** @var 'cli'|'config'|'composer'|'tests'|'runtime' */ - public $php_version_source = 'runtime'; + public string $php_version_source = 'runtime'; - /** - * @var bool - */ - public $track_unused_suppressions = false; + public bool $track_unused_suppressions = false; /** @internal */ public function __construct( diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index d977722fd21..d86d787c73b 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -138,7 +138,7 @@ class Config /** * @var array */ - public static $ERROR_LEVELS = [ + public static array $ERROR_LEVELS = [ self::REPORT_INFO, self::REPORT_ERROR, self::REPORT_SUPPRESS, @@ -172,7 +172,7 @@ class Config * * @var array */ - protected $universal_object_crates; + protected array $universal_object_crates; /** * @var static|null @@ -181,74 +181,53 @@ class Config /** * Whether or not to use types as defined in docblocks - * - * @var bool */ - public $use_docblock_types = true; + public bool $use_docblock_types = true; /** * Whether or not to use types as defined in property docblocks. * This is distinct from the above because you may want to use * property docblocks, but not function docblocks. - * - * @var bool */ - public $use_docblock_property_types = false; + public bool $use_docblock_property_types = false; /** * Whether using property annotations in docblocks should implicitly seal properties - * - * @var bool */ - public $docblock_property_types_seal_properties = true; + public bool $docblock_property_types_seal_properties = true; /** * Whether or not to throw an exception on first error - * - * @var bool */ - public $throw_exception = false; + public bool $throw_exception = false; /** * The directory to store PHP Parser (and other) caches * * @internal - * @var string|null */ - public $cache_directory; + public ?string $cache_directory = null; private bool $cache_directory_initialized = false; /** * The directory to store all Psalm project caches - * - * @var string|null */ - public $global_cache_directory; + public ?string $global_cache_directory = null; /** * Path to the autoader - * - * @var string|null */ - public $autoloader; + public ?string $autoloader = null; - /** - * @var ProjectFileFilter|null - */ - protected $project_files; + protected ?ProjectFileFilter $project_files = null; - /** - * @var ProjectFileFilter|null - */ - protected $extra_files; + protected ?ProjectFileFilter $extra_files = null; /** * The base directory of this config file - * - * @var string */ - public $base_dir; + public string $base_dir; /** * The PHP version to assume as declared in the config file @@ -300,230 +279,124 @@ class Config */ private array $stub_files = []; - /** - * @var bool - */ - public $hide_external_errors = false; + public bool $hide_external_errors = false; - /** - * @var bool - */ - public $hide_all_errors_except_passed_files = false; + public bool $hide_all_errors_except_passed_files = false; - /** @var bool */ - public $allow_includes = true; + public bool $allow_includes = true; /** @var 1|2|3|4|5|6|7|8 */ - public $level = 1; + public int $level = 1; - /** - * @var ?bool - */ - public $show_mixed_issues; + public ?bool $show_mixed_issues = null; - /** @var bool */ - public $strict_binary_operands = false; + public bool $strict_binary_operands = false; - /** - * @var bool - */ - public $remember_property_assignments_after_call = true; + public bool $remember_property_assignments_after_call = true; - /** @var bool */ - public $use_igbinary = false; + public bool $use_igbinary = false; /** @var 'lz4'|'deflate'|'off' */ - public $compressor = 'off'; + public string $compressor = 'off'; - /** - * @var bool - */ - public $allow_string_standin_for_class = false; + public bool $allow_string_standin_for_class = false; - /** - * @var bool - */ - public $disable_suppress_all = false; + public bool $disable_suppress_all = false; - /** - * @var bool - */ - public $use_phpdoc_method_without_magic_or_parent = false; + public bool $use_phpdoc_method_without_magic_or_parent = false; - /** - * @var bool - */ - public $use_phpdoc_property_without_magic_or_parent = false; + public bool $use_phpdoc_property_without_magic_or_parent = false; - /** - * @var bool - */ - public $skip_checks_on_unresolvable_includes = false; + public bool $skip_checks_on_unresolvable_includes = false; - /** - * @var bool - */ - public $seal_all_methods = false; + public bool $seal_all_methods = false; - /** - * @var bool - */ - public $seal_all_properties = false; + public bool $seal_all_properties = false; - /** - * @var bool - */ - public $memoize_method_calls = false; + public bool $memoize_method_calls = false; - /** - * @var bool - */ - public $hoist_constants = false; + public bool $hoist_constants = false; - /** - * @var bool - */ - public $add_param_default_to_docblock_type = false; + public bool $add_param_default_to_docblock_type = false; - /** - * @var bool - */ - public $disable_var_parsing = false; + public bool $disable_var_parsing = false; - /** - * @var bool - */ - public $check_for_throws_docblock = false; + public bool $check_for_throws_docblock = false; - /** - * @var bool - */ - public $check_for_throws_in_global_scope = false; + public bool $check_for_throws_in_global_scope = false; - /** - * @var bool - */ - public $ignore_internal_falsable_issues = false; + public bool $ignore_internal_falsable_issues = false; - /** - * @var bool - */ - public $ignore_internal_nullable_issues = false; + public bool $ignore_internal_nullable_issues = false; /** * @var array */ - public $ignored_exceptions = []; + public array $ignored_exceptions = []; /** * @var array */ - public $ignored_exceptions_in_global_scope = []; + public array $ignored_exceptions_in_global_scope = []; /** * @var array */ - public $ignored_exceptions_and_descendants = []; + public array $ignored_exceptions_and_descendants = []; /** * @var array */ - public $ignored_exceptions_and_descendants_in_global_scope = []; + public array $ignored_exceptions_and_descendants_in_global_scope = []; - /** - * @var bool - */ - public $infer_property_types_from_constructor = true; + public bool $infer_property_types_from_constructor = true; - /** - * @var bool - */ - public $ensure_array_string_offsets_exist = false; + public bool $ensure_array_string_offsets_exist = false; - /** - * @var bool - */ - public $ensure_array_int_offsets_exist = false; + public bool $ensure_array_int_offsets_exist = false; /** * @var array */ - public $forbidden_functions = []; + public array $forbidden_functions = []; - /** - * @var bool - */ - public $find_unused_code = true; + public bool $find_unused_code = true; - /** - * @var bool - */ - public $find_unused_variables = false; + public bool $find_unused_variables = false; - /** - * @var bool - */ - public $find_unused_psalm_suppress = false; + public bool $find_unused_psalm_suppress = false; public bool $find_unused_baseline_entry = true; - /** - * @var bool - */ - public $run_taint_analysis = false; + public bool $run_taint_analysis = false; - /** @var bool */ - public $use_phpstorm_meta_path = true; + public bool $use_phpstorm_meta_path = true; - /** - * @var bool - */ - public $resolve_from_config_file = true; + public bool $resolve_from_config_file = true; - /** - * @var bool - */ - public $restrict_return_types = false; + public bool $restrict_return_types = false; - /** - * @var bool - */ - public $limit_method_complexity = false; + public bool $limit_method_complexity = false; - /** - * @var int - */ - public $max_graph_size = 200; + public int $max_graph_size = 200; - /** - * @var int - */ - public $max_avg_path_length = 70; + public int $max_avg_path_length = 70; - /** - * @var int - */ - public $max_shaped_array_size = 100; + public int $max_shaped_array_size = 100; /** * @var string[] */ - public $plugin_paths = []; + public array $plugin_paths = []; /** * @var array */ private array $plugin_classes = []; - /** - * @var bool - */ - public $allow_internal_named_arg_calls = true; + public bool $allow_internal_named_arg_calls = true; - /** - * @var bool - */ - public $allow_named_arg_calls = true; + public bool $allow_named_arg_calls = true; /** @var array */ private array $predefined_constants = []; @@ -533,69 +406,51 @@ class Config private ?ClassLoader $composer_class_loader = null; - /** - * @var string - */ - public $hash = ''; + public string $hash = ''; - /** @var string|null */ - public $error_baseline; + public ?string $error_baseline = null; - /** - * @var bool - */ - public $include_php_versions_in_error_baseline = false; + public bool $include_php_versions_in_error_baseline = false; /** - * @var string * @internal */ - public $shepherd_endpoint = 'https://shepherd.dev/hooks/psalm'; + public string $shepherd_endpoint = 'https://shepherd.dev/hooks/psalm'; /** * @var array */ - public $globals = []; + public array $globals = []; - /** - * @var int - */ - public $max_string_length = 1_000; + public int $max_string_length = 1_000; private ?IncludeCollector $include_collector = null; - /** - * @var TaintAnalysisFileFilter|null - */ - protected $taint_analysis_ignored_files; + protected ?TaintAnalysisFileFilter $taint_analysis_ignored_files = null; /** * @var bool whether to emit a backtrace of emitted issues to stderr */ - public $debug_emitted_issues = false; + public bool $debug_emitted_issues = false; private bool $report_info = true; - /** - * @var EventDispatcher - */ - public $eventDispatcher; + public EventDispatcher $eventDispatcher; /** @var list */ - public $config_issues = []; + public array $config_issues = []; /** * @var 'default'|'never'|'always' */ - public $trigger_error_exits = 'default'; + public string $trigger_error_exits = 'default'; /** * @var string[] */ - public $internal_stubs = []; + public array $internal_stubs = []; - /** @var ?int */ - public $threads; + public ?int $threads = null; /** * A list of php extensions supported by Psalm. @@ -608,7 +463,7 @@ class Config * @psalm-readonly-allow-private-mutation * @var array */ - public $php_extensions = [ + public array $php_extensions = [ "apcu" => null, "decimal" => null, "dom" => null, @@ -635,7 +490,7 @@ class Config * @var list * @readonly */ - public $php_extensions_supported_by_psalm_callmaps = [ + public array $php_extensions_supported_by_psalm_callmaps = [ 'apache', 'bcmath', 'bzip2', @@ -700,7 +555,7 @@ class Config * * @var array */ - public $php_extensions_not_supported = []; + public array $php_extensions_not_supported = []; /** * @var array diff --git a/src/Psalm/Config/FileFilter.php b/src/Psalm/Config/FileFilter.php index b0410026369..4eb8c1a32f2 100644 --- a/src/Psalm/Config/FileFilter.php +++ b/src/Psalm/Config/FileFilter.php @@ -48,62 +48,59 @@ class FileFilter /** * @var array */ - protected $directories = []; + protected array $directories = []; /** * @var array */ - protected $files = []; + protected array $files = []; /** * @var array */ - protected $fq_classlike_names = []; + protected array $fq_classlike_names = []; /** * @var array */ - protected $fq_classlike_patterns = []; + protected array $fq_classlike_patterns = []; /** * @var array */ - protected $method_ids = []; + protected array $method_ids = []; /** * @var array */ - protected $property_ids = []; + protected array $property_ids = []; /** * @var array */ - protected $class_constant_ids = []; + protected array $class_constant_ids = []; /** * @var array */ - protected $var_names = []; + protected array $var_names = []; /** * @var array */ - protected $files_lowercase = []; + protected array $files_lowercase = []; - /** - * @var bool - */ - protected $inclusive; + protected bool $inclusive; /** * @var array */ - protected $ignore_type_stats = []; + protected array $ignore_type_stats = []; /** * @var array */ - protected $declare_strict_types = []; + protected array $declare_strict_types = []; public function __construct(bool $inclusive) { diff --git a/src/Psalm/Context.php b/src/Psalm/Context.php index 23824f67fae..084e0650b31 100644 --- a/src/Psalm/Context.php +++ b/src/Psalm/Context.php @@ -40,19 +40,19 @@ final class Context /** * @var array */ - public $vars_in_scope = []; + public array $vars_in_scope = []; /** * @var array */ - public $vars_possibly_in_scope = []; + public array $vars_possibly_in_scope = []; /** * Keeps track of how many times a var_in_scope has been referenced. May not be set for all $vars_in_scope. * * @var array> */ - public $referenced_counts = []; + public array $referenced_counts = []; /** * Maps references to referenced variables for the current scope. @@ -65,21 +65,21 @@ final class Context * * @var array */ - public $references_in_scope = []; + public array $references_in_scope = []; /** * Set of references to variables in another scope. These references will be marked as used if they are assigned to. * * @var array */ - public $references_to_external_scope = []; + public array $references_to_external_scope = []; /** * A set of globals that are referenced somewhere. * * @var array */ - public $referenced_globals = []; + public array $referenced_globals = []; /** * A set of references that might still be in scope from a scope likely to cause confusion. This applies @@ -88,244 +88,190 @@ final class Context * * @var array */ - public $references_possibly_from_confusing_scope = []; + public array $references_possibly_from_confusing_scope = []; /** * Whether or not we're inside the conditional of an if/where etc. * * This changes whether or not the context is cloned - * - * @var bool */ - public $inside_conditional = false; + public bool $inside_conditional = false; /** * Whether or not we're inside an isset call * * Inside issets Psalm is more lenient about certain things - * - * @var bool */ - public $inside_isset = false; + public bool $inside_isset = false; /** * Whether or not we're inside an unset call, where * we don't care about possibly undefined variables - * - * @var bool */ - public $inside_unset = false; + public bool $inside_unset = false; /** * Whether or not we're inside an class_exists call, where * we don't care about possibly undefined classes - * - * @var bool */ - public $inside_class_exists = false; + public bool $inside_class_exists = false; /** * Whether or not we're inside a function/method call - * - * @var bool */ - public $inside_call = false; + public bool $inside_call = false; /** * Whether or not we're inside any other situation that treats a variable as used - * - * @var bool */ - public $inside_general_use = false; + public bool $inside_general_use = false; /** * Whether or not we're inside a return expression - * - * @var bool */ - public $inside_return = false; + public bool $inside_return = false; /** * Whether or not we're inside a throw - * - * @var bool */ - public $inside_throw = false; + public bool $inside_throw = false; /** * Whether or not we're inside an assignment - * - * @var bool */ - public $inside_assignment = false; + public bool $inside_assignment = false; /** * Whether or not we're inside a try block. - * - * @var bool */ - public $inside_try = false; + public bool $inside_try = false; - /** - * @var null|CodeLocation - */ - public $include_location; + public ?CodeLocation $include_location = null; /** * @var string|null * The name of the current class. Null if outside a class. */ - public $self; + public ?string $self = null; - /** - * @var string|null - */ - public $parent; + public ?string $parent = null; - /** - * @var bool - */ - public $check_classes = true; + public bool $check_classes = true; - /** - * @var bool - */ - public $check_variables = true; + public bool $check_variables = true; - /** - * @var bool - */ - public $check_methods = true; + public bool $check_methods = true; - /** - * @var bool - */ - public $check_consts = true; + public bool $check_consts = true; - /** - * @var bool - */ - public $check_functions = true; + public bool $check_functions = true; /** * A list of classes checked with class_exists * * @var array */ - public $phantom_classes = []; + public array $phantom_classes = []; /** * A list of files checked with file_exists * * @var array */ - public $phantom_files = []; + public array $phantom_files = []; /** * A list of clauses in Conjunctive Normal Form * * @var list */ - public $clauses = []; + public array $clauses = []; /** * A list of hashed clauses that have already been factored in * * @var list */ - public $reconciled_expression_clauses = []; + public array $reconciled_expression_clauses = []; /** * Whether or not to do a deep analysis and collect mutations to this context - * - * @var bool */ - public $collect_mutations = false; + public bool $collect_mutations = false; /** * Whether or not to do a deep analysis and collect initializations from private or final methods - * - * @var bool */ - public $collect_initializations = false; + public bool $collect_initializations = false; /** * Whether or not to do a deep analysis and collect initializations from public non-final methods - * - * @var bool */ - public $collect_nonprivate_initializations = false; + public bool $collect_nonprivate_initializations = false; /** * Stored to prevent re-analysing methods when checking for initialised properties * * @var array|null */ - public $initialized_methods; + public ?array $initialized_methods = null; /** * @var array */ - public $constants = []; + public array $constants = []; /** * Whether or not to track exceptions - * - * @var bool */ - public $collect_exceptions = false; + public bool $collect_exceptions = false; /** * A list of variables that have been referenced in conditionals * * @var array */ - public $cond_referenced_var_ids = []; + public array $cond_referenced_var_ids = []; /** * A list of variables that have been passed by reference (where we know their type) * * @var array */ - public $byref_constraints = []; + public array $byref_constraints = []; /** * A list of vars that have been assigned to * * @var array */ - public $assigned_var_ids = []; + public array $assigned_var_ids = []; /** * A list of vars that have been may have been assigned to * * @var array */ - public $possibly_assigned_var_ids = []; + public array $possibly_assigned_var_ids = []; /** * A list of classes or interfaces that may have been thrown * * @var array> */ - public $possibly_thrown_exceptions = []; + public array $possibly_thrown_exceptions = []; - /** - * @var bool - */ - public $is_global = false; + public bool $is_global = false; /** * @var array */ - public $protected_var_ids = []; + public array $protected_var_ids = []; /** * If we've branched from the main scope, a byte offset for where that branch happened - * - * @var int|null */ - public $branch_point; + public ?int $branch_point = null; /** * What does break mean in this context? @@ -335,94 +281,55 @@ final class Context * * @var list<'loop'|'switch'> */ - public $break_types = []; + public array $break_types = []; - /** - * @var bool - */ - public $inside_loop = false; + public bool $inside_loop = false; - /** - * @var LoopScope|null - */ - public $loop_scope; + public ?LoopScope $loop_scope = null; - /** - * @var CaseScope|null - */ - public $case_scope; + public ?CaseScope $case_scope = null; - /** - * @var FinallyScope|null - */ - public $finally_scope; + public ?FinallyScope $finally_scope = null; - /** - * @var Context|null - */ - public $if_body_context; + public ?Context $if_body_context = null; - /** - * @var bool - */ - public $strict_types = false; + public bool $strict_types = false; - /** - * @var string|null - */ - public $calling_function_id; + public ?string $calling_function_id = null; /** * @var lowercase-string|null */ - public $calling_method_id; + public ?string $calling_method_id = null; - /** - * @var bool - */ - public $inside_negation = false; + public bool $inside_negation = false; - /** - * @var bool - */ - public $ignore_variable_property = false; + public bool $ignore_variable_property = false; - /** - * @var bool - */ - public $ignore_variable_method = false; + public bool $ignore_variable_method = false; - /** - * @var bool - */ - public $pure = false; + public bool $pure = false; /** * @var bool * Set by @psalm-immutable */ - public $mutation_free = false; + public bool $mutation_free = false; /** * @var bool * Set by @psalm-external-mutation-free */ - public $external_mutation_free = false; + public bool $external_mutation_free = false; - /** - * @var bool - */ - public $error_suppressing = false; + public bool $error_suppressing = false; - /** - * @var bool - */ - public $has_returned = false; + public bool $has_returned = false; /** * @var array */ - public $parent_remove_vars = []; + public array $parent_remove_vars = []; /** @internal */ public function __construct(?string $self = null) diff --git a/src/Psalm/Exception/UnresolvableConstantException.php b/src/Psalm/Exception/UnresolvableConstantException.php index 94029bd012a..175fe7b033e 100644 --- a/src/Psalm/Exception/UnresolvableConstantException.php +++ b/src/Psalm/Exception/UnresolvableConstantException.php @@ -8,15 +8,9 @@ final class UnresolvableConstantException extends Exception { - /** - * @var string - */ - public $class_name; + public string $class_name; - /** - * @var string - */ - public $const_name; + public string $const_name; public function __construct(string $class_name, string $const_name) { diff --git a/src/Psalm/FileManipulation.php b/src/Psalm/FileManipulation.php index 35b8c808c26..56acda2c230 100644 --- a/src/Psalm/FileManipulation.php +++ b/src/Psalm/FileManipulation.php @@ -12,20 +12,15 @@ final class FileManipulation { - /** @var int */ - public $start; + public int $start; - /** @var int */ - public $end; + public int $end; - /** @var string */ - public $insertion_text; + public string $insertion_text; - /** @var bool */ - public $preserve_indentation; + public bool $preserve_indentation; - /** @var bool */ - public $remove_trailing_newline; + public bool $remove_trailing_newline; public function __construct( int $start, diff --git a/src/Psalm/Issue/ArgumentIssue.php b/src/Psalm/Issue/ArgumentIssue.php index 79fdf8b8309..7ebedbab8ad 100644 --- a/src/Psalm/Issue/ArgumentIssue.php +++ b/src/Psalm/Issue/ArgumentIssue.php @@ -10,10 +10,7 @@ abstract class ArgumentIssue extends CodeIssue { - /** - * @var ?string - */ - public $function_id; + public ?string $function_id = null; public function __construct( string $message, diff --git a/src/Psalm/Issue/ClassConstantIssue.php b/src/Psalm/Issue/ClassConstantIssue.php index d47b40a1930..cb6dac913cd 100644 --- a/src/Psalm/Issue/ClassConstantIssue.php +++ b/src/Psalm/Issue/ClassConstantIssue.php @@ -8,10 +8,7 @@ abstract class ClassConstantIssue extends CodeIssue { - /** - * @var string - */ - public $const_id; + public string $const_id; public function __construct( string $message, diff --git a/src/Psalm/Issue/ClassIssue.php b/src/Psalm/Issue/ClassIssue.php index 9e3f1476615..959f625cf42 100644 --- a/src/Psalm/Issue/ClassIssue.php +++ b/src/Psalm/Issue/ClassIssue.php @@ -8,10 +8,7 @@ abstract class ClassIssue extends CodeIssue { - /** - * @var string - */ - public $fq_classlike_name; + public string $fq_classlike_name; public function __construct( string $message, diff --git a/src/Psalm/Issue/CodeIssue.php b/src/Psalm/Issue/CodeIssue.php index d82c9978def..e4b7791caa1 100644 --- a/src/Psalm/Issue/CodeIssue.php +++ b/src/Psalm/Issue/CodeIssue.php @@ -18,21 +18,16 @@ abstract class CodeIssue public const SHORTCODE = 0; /** - * @var CodeLocation * @readonly */ - public $code_location; + public CodeLocation $code_location; /** - * @var string * @readonly */ - public $message; + public string $message; - /** - * @var ?string - */ - public $dupe_key; + public ?string $dupe_key = null; public function __construct( string $message, diff --git a/src/Psalm/Issue/FunctionIssue.php b/src/Psalm/Issue/FunctionIssue.php index 8ea22b53ead..9d3b5ee05d8 100644 --- a/src/Psalm/Issue/FunctionIssue.php +++ b/src/Psalm/Issue/FunctionIssue.php @@ -10,10 +10,7 @@ abstract class FunctionIssue extends CodeIssue { - /** - * @var string - */ - public $function_id; + public string $function_id; public function __construct( string $message, diff --git a/src/Psalm/Issue/MethodIssue.php b/src/Psalm/Issue/MethodIssue.php index ad3b84f5e2b..2d4cd8c5c15 100644 --- a/src/Psalm/Issue/MethodIssue.php +++ b/src/Psalm/Issue/MethodIssue.php @@ -10,10 +10,7 @@ abstract class MethodIssue extends CodeIssue { - /** - * @var string - */ - public $method_id; + public string $method_id; public function __construct( string $message, diff --git a/src/Psalm/Issue/MixedIssueTrait.php b/src/Psalm/Issue/MixedIssueTrait.php index 3cd5079fcf8..10dda63d98a 100644 --- a/src/Psalm/Issue/MixedIssueTrait.php +++ b/src/Psalm/Issue/MixedIssueTrait.php @@ -9,10 +9,9 @@ trait MixedIssueTrait { /** - * @var ?CodeLocation * @readonly */ - public $origin_location; + public ?CodeLocation $origin_location = null; public function __construct( string $message, diff --git a/src/Psalm/Issue/PropertyIssue.php b/src/Psalm/Issue/PropertyIssue.php index 4cf1d4cf883..6be211689e7 100644 --- a/src/Psalm/Issue/PropertyIssue.php +++ b/src/Psalm/Issue/PropertyIssue.php @@ -8,10 +8,7 @@ abstract class PropertyIssue extends CodeIssue { - /** - * @var string - */ - public $property_id; + public string $property_id; public function __construct( string $message, diff --git a/src/Psalm/Issue/TaintedInput.php b/src/Psalm/Issue/TaintedInput.php index 8c1f9137cbd..f394c24ac95 100644 --- a/src/Psalm/Issue/TaintedInput.php +++ b/src/Psalm/Issue/TaintedInput.php @@ -14,16 +14,15 @@ abstract class TaintedInput extends CodeIssue public const SHORTCODE = 205; /** - * @var string * @readonly */ - public $journey_text; + public string $journey_text; /** * @var list * @readonly */ - public $journey = []; + public array $journey = []; /** * @param list $journey diff --git a/src/Psalm/Issue/VariableIssue.php b/src/Psalm/Issue/VariableIssue.php index 36a64df0f44..a24644f7f20 100644 --- a/src/Psalm/Issue/VariableIssue.php +++ b/src/Psalm/Issue/VariableIssue.php @@ -10,10 +10,7 @@ abstract class VariableIssue extends CodeIssue { - /** - * @var string - */ - public $var_name; + public string $var_name; public function __construct( string $message, diff --git a/src/Psalm/IssueBuffer.php b/src/Psalm/IssueBuffer.php index 21514018e6d..fc04545fbea 100644 --- a/src/Psalm/IssueBuffer.php +++ b/src/Psalm/IssueBuffer.php @@ -87,43 +87,39 @@ final class IssueBuffer /** * @var array> */ - protected static $issues_data = []; + protected static array $issues_data = []; /** * @var array */ - protected static $console_issues = []; + protected static array $console_issues = []; /** * @var array */ - protected static $fixable_issue_counts = []; + protected static array $fixable_issue_counts = []; - /** - * @var int - */ - protected static $error_count = 0; + protected static int $error_count = 0; /** * @var array */ - protected static $emitted = []; + protected static array $emitted = []; - /** @var int */ - protected static $recording_level = 0; + protected static int $recording_level = 0; /** @var array> */ - protected static $recorded_issues = []; + protected static array $recorded_issues = []; /** * @var array> */ - protected static $unused_suppressions = []; + protected static array $unused_suppressions = []; /** * @var array> */ - protected static $used_suppressions = []; + protected static array $used_suppressions = []; /** @var array */ private static array $server = []; diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterMethodCallAnalysisEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterMethodCallAnalysisEvent.php index 25a77e0b486..829f0dc15bc 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterMethodCallAnalysisEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterMethodCallAnalysisEvent.php @@ -15,10 +15,7 @@ final class AfterMethodCallAnalysisEvent { - /** - * @var MethodCall|StaticCall - */ - private $expr; + private MethodCall|StaticCall $expr; private string $method_id; private string $appearing_method_id; private string $declaring_method_id; diff --git a/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php b/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php index f2089fa5356..e6a96aba9b3 100644 --- a/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/MethodReturnTypeProviderEvent.php @@ -20,10 +20,7 @@ final class MethodReturnTypeProviderEvent private string $method_name_lowercase; private Context $context; private CodeLocation $code_location; - /** - * @var PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall - */ - private $stmt; + private PhpParser\Node\Expr\MethodCall|PhpParser\Node\Expr\StaticCall $stmt; /** @var non-empty-list|null */ private ?array $template_type_parameters; private ?string $called_fq_classlike_name; diff --git a/src/Psalm/Progress/LongProgress.php b/src/Psalm/Progress/LongProgress.php index 79f43ddb50c..8cf23fa1fc6 100644 --- a/src/Psalm/Progress/LongProgress.php +++ b/src/Psalm/Progress/LongProgress.php @@ -17,17 +17,13 @@ class LongProgress extends Progress { public const NUMBER_OF_COLUMNS = 60; - /** @var int|null */ - protected $number_of_tasks; + protected ?int $number_of_tasks = null; - /** @var int */ - protected $progress = 0; + protected int $progress = 0; - /** @var bool */ - protected $print_errors = false; + protected bool $print_errors = false; - /** @var bool */ - protected $print_infos = false; + protected bool $print_infos = false; public function __construct(bool $print_errors = true, bool $print_infos = true) { diff --git a/src/Psalm/Report.php b/src/Psalm/Report.php index a606d718de1..c2a86945672 100644 --- a/src/Psalm/Report.php +++ b/src/Psalm/Report.php @@ -36,31 +36,24 @@ abstract class Report /** * @var array */ - protected $issues_data; + protected array $issues_data; /** @var array */ - protected $fixable_issue_counts; + protected array $fixable_issue_counts; - /** @var bool */ - protected $use_color; + protected bool $use_color; - /** @var bool */ - protected $show_snippet; + protected bool $show_snippet; - /** @var bool */ - protected $show_info; + protected bool $show_info; - /** @var bool */ - protected $pretty; + protected bool $pretty; - /** @var bool */ - protected $in_ci; + protected bool $in_ci; - /** @var int */ - protected $mixed_expression_count; + protected int $mixed_expression_count; - /** @var int */ - protected $total_expression_count; + protected int $total_expression_count; /** * @param array $issues_data diff --git a/src/Psalm/Report/ReportOptions.php b/src/Psalm/Report/ReportOptions.php index 67668449ba3..38b9b190f7e 100644 --- a/src/Psalm/Report/ReportOptions.php +++ b/src/Psalm/Report/ReportOptions.php @@ -8,41 +8,22 @@ final class ReportOptions { - /** - * @var bool - */ - public $use_color = true; + public bool $use_color = true; - /** - * @var bool - */ - public $show_snippet = true; + public bool $show_snippet = true; - /** - * @var bool - */ - public $show_info = true; + public bool $show_info = true; /** * @var Report::TYPE_* */ public $format = Report::TYPE_CONSOLE; - /** - * @var bool - */ - public $pretty = false; + public bool $pretty = false; - /** - * @var ?string - */ - public $output_path; + public ?string $output_path = null; - /** - * @var bool - */ - public $show_suggestions = true; + public bool $show_suggestions = true; - /** @var bool */ - public $in_ci = false; + public bool $in_ci = false; } diff --git a/src/Psalm/SourceControl/Git/CommitInfo.php b/src/Psalm/SourceControl/Git/CommitInfo.php index 464d1b26b72..d10bbb41c0b 100644 --- a/src/Psalm/SourceControl/Git/CommitInfo.php +++ b/src/Psalm/SourceControl/Git/CommitInfo.php @@ -13,52 +13,38 @@ final class CommitInfo { /** * Commit ID. - * - * @var null|string */ - protected $id; + protected ?string $id = null; /** * Author name. - * - * @var null|string */ - protected $author_name; + protected ?string $author_name = null; /** * Author email. - * - * @var null|string */ - protected $author_email; + protected ?string $author_email = null; /** * Committer name. - * - * @var null|string */ - protected $committer_name; + protected ?string $committer_name = null; /** * Committer email. - * - * @var null|string */ - protected $committer_email; + protected ?string $committer_email = null; /** * Commit message. - * - * @var null|string */ - protected $message; + protected ?string $message = null; /** * Commit message. - * - * @var null|int */ - protected $date; + protected ?int $date = null; public function toArray(): array { diff --git a/src/Psalm/SourceControl/Git/GitInfo.php b/src/Psalm/SourceControl/Git/GitInfo.php index 77c7d6ae73c..dd7927255fa 100644 --- a/src/Psalm/SourceControl/Git/GitInfo.php +++ b/src/Psalm/SourceControl/Git/GitInfo.php @@ -33,24 +33,20 @@ final class GitInfo extends SourceControlInfo { /** * Branch name. - * - * @var string */ - protected $branch; + protected string $branch; /** * Head. - * - * @var CommitInfo */ - protected $head; + protected CommitInfo $head; /** * Remote. * * @var RemoteInfo[] */ - protected $remotes; + protected array $remotes; /** * Constructor. diff --git a/src/Psalm/SourceControl/Git/RemoteInfo.php b/src/Psalm/SourceControl/Git/RemoteInfo.php index d747b311004..91bf9a9b44a 100644 --- a/src/Psalm/SourceControl/Git/RemoteInfo.php +++ b/src/Psalm/SourceControl/Git/RemoteInfo.php @@ -13,17 +13,13 @@ final class RemoteInfo { /** * Remote name. - * - * @var null|string */ - protected $name; + protected ?string $name = null; /** * Remote URL. - * - * @var null|string */ - protected $url; + protected ?string $url = null; public function toArray(): array { diff --git a/src/Psalm/Storage/Assertion/DoesNotHaveAtLeastCount.php b/src/Psalm/Storage/Assertion/DoesNotHaveAtLeastCount.php index e49d4865d60..83076312120 100644 --- a/src/Psalm/Storage/Assertion/DoesNotHaveAtLeastCount.php +++ b/src/Psalm/Storage/Assertion/DoesNotHaveAtLeastCount.php @@ -12,7 +12,7 @@ final class DoesNotHaveAtLeastCount extends Assertion { /** @var positive-int */ - public $count; + public int $count; /** @param positive-int $count */ public function __construct(int $count) diff --git a/src/Psalm/Storage/Assertion/DoesNotHaveExactCount.php b/src/Psalm/Storage/Assertion/DoesNotHaveExactCount.php index 632b6a11d07..cc96639ddf0 100644 --- a/src/Psalm/Storage/Assertion/DoesNotHaveExactCount.php +++ b/src/Psalm/Storage/Assertion/DoesNotHaveExactCount.php @@ -12,7 +12,7 @@ final class DoesNotHaveExactCount extends Assertion { /** @var positive-int */ - public $count; + public int $count; /** @param positive-int $count */ public function __construct(int $count) diff --git a/src/Psalm/Storage/Assertion/HasAtLeastCount.php b/src/Psalm/Storage/Assertion/HasAtLeastCount.php index d15be0219f3..0c2555b9994 100644 --- a/src/Psalm/Storage/Assertion/HasAtLeastCount.php +++ b/src/Psalm/Storage/Assertion/HasAtLeastCount.php @@ -12,7 +12,7 @@ final class HasAtLeastCount extends Assertion { /** @var positive-int */ - public $count; + public int $count; /** @param positive-int $count */ public function __construct(int $count) diff --git a/src/Psalm/Storage/Assertion/HasExactCount.php b/src/Psalm/Storage/Assertion/HasExactCount.php index 3f45ede8db7..8f468b1eda4 100644 --- a/src/Psalm/Storage/Assertion/HasExactCount.php +++ b/src/Psalm/Storage/Assertion/HasExactCount.php @@ -12,7 +12,7 @@ final class HasExactCount extends Assertion { /** @var positive-int */ - public $count; + public int $count; /** @param positive-int $count */ public function __construct(int $count) diff --git a/src/Psalm/Storage/AttributeArg.php b/src/Psalm/Storage/AttributeArg.php index 2d7c98265d9..72fd6080222 100644 --- a/src/Psalm/Storage/AttributeArg.php +++ b/src/Psalm/Storage/AttributeArg.php @@ -15,21 +15,16 @@ final class AttributeArg { use ImmutableNonCloneableTrait; /** - * @var ?string * @psalm-suppress PossiblyUnusedProperty It's part of the public API for now */ - public $name; + public ?string $name = null; - /** - * @var Union|UnresolvedConstantComponent - */ - public $type; + public Union|UnresolvedConstantComponent $type; /** - * @var CodeLocation * @psalm-suppress PossiblyUnusedProperty It's part of the public API for now */ - public $location; + public CodeLocation $location; public function __construct( ?string $name, diff --git a/src/Psalm/Storage/AttributeStorage.php b/src/Psalm/Storage/AttributeStorage.php index 3ecab7899ac..8cbc499a637 100644 --- a/src/Psalm/Storage/AttributeStorage.php +++ b/src/Psalm/Storage/AttributeStorage.php @@ -12,27 +12,22 @@ final class AttributeStorage { use ImmutableNonCloneableTrait; - /** - * @var string - */ - public $fq_class_name; + public string $fq_class_name; /** * @var list */ - public $args; + public array $args; /** - * @var CodeLocation * @psalm-suppress PossiblyUnusedProperty part of public API */ - public $location; + public CodeLocation $location; /** - * @var CodeLocation * @psalm-suppress PossiblyUnusedProperty part of public API */ - public $name_location; + public CodeLocation $name_location; /** * @param list $args diff --git a/src/Psalm/Storage/ClassLikeStorage.php b/src/Psalm/Storage/ClassLikeStorage.php index 5d622b16f7e..8fabc2e3edd 100644 --- a/src/Psalm/Storage/ClassLikeStorage.php +++ b/src/Psalm/Storage/ClassLikeStorage.php @@ -25,168 +25,117 @@ final class ClassLikeStorage implements HasAttributesInterface /** * @var array */ - public $constants = []; + public array $constants = []; /** * Aliases to help Psalm understand constant refs - * - * @var ?Aliases */ - public $aliases; + public ?Aliases $aliases = null; - /** - * @var bool - */ - public $populated = false; + public bool $populated = false; - /** - * @var bool - */ - public $stubbed = false; + public bool $stubbed = false; - /** - * @var bool - */ - public $deprecated = false; + public bool $deprecated = false; /** * @var list */ - public $internal = []; + public array $internal = []; /** * @var TTemplateParam[] */ - public $templatedMixins = []; + public array $templatedMixins = []; /** * @var list */ - public $namedMixins = []; + public array $namedMixins = []; - /** - * @var ?string - */ - public $mixin_declaring_fqcln; + public ?string $mixin_declaring_fqcln = null; - /** - * @var ?bool - */ - public $sealed_properties = null; + public ?bool $sealed_properties = null; - /** - * @var ?bool - */ - public $sealed_methods = null; + public ?bool $sealed_methods = null; - /** - * @var bool - */ - public $override_property_visibility = false; + public bool $override_property_visibility = false; - /** - * @var bool - */ - public $override_method_visibility = false; + public bool $override_method_visibility = false; /** * @var array */ - public $suppressed_issues = []; + public array $suppressed_issues = []; - /** - * @var string - */ - public $name; + public string $name; /** * Is this class user-defined - * - * @var bool */ - public $user_defined = false; + public bool $user_defined = false; /** * Interfaces this class implements directly * * @var array */ - public $direct_class_interfaces = []; + public array $direct_class_interfaces = []; /** * Interfaces this class implements explicitly and implicitly * * @var array */ - public $class_implements = []; + public array $class_implements = []; /** * Parent interfaces listed explicitly * * @var array */ - public $direct_interface_parents = []; + public array $direct_interface_parents = []; /** * Parent interfaces * * @var array */ - public $parent_interfaces = []; + public array $parent_interfaces = []; /** * There can only be one direct parent class - * - * @var ?string */ - public $parent_class; + public ?string $parent_class = null; /** * Parent classes * * @var array */ - public $parent_classes = []; + public array $parent_classes = []; - /** - * @var CodeLocation|null - */ - public $location; + public ?CodeLocation $location = null; - /** - * @var CodeLocation|null - */ - public $stmt_location; + public ?CodeLocation $stmt_location = null; - /** - * @var CodeLocation|null - */ - public $namespace_name_location; + public ?CodeLocation $namespace_name_location = null; - /** - * @var bool - */ - public $abstract = false; + public bool $abstract = false; - /** - * @var bool - */ - public $final = false; + public bool $final = false; - /** - * @var bool - */ - public $final_from_docblock = false; + public bool $final_from_docblock = false; /** * @var array */ - public $used_traits = []; + public array $used_traits = []; /** * @var array */ - public $trait_alias_map = []; + public array $trait_alias_map = []; /** * @var array @@ -196,57 +145,39 @@ final class ClassLikeStorage implements HasAttributesInterface /** * @var array */ - public $trait_final_map = []; + public array $trait_final_map = []; /** * @var array */ - public $trait_visibility_map = []; + public array $trait_visibility_map = []; - /** - * @var bool - */ - public $is_trait = false; + public bool $is_trait = false; - /** - * @var bool - */ - public $is_interface = false; + public bool $is_interface = false; - /** - * @var bool - */ - public $is_enum = false; + public bool $is_enum = false; - /** - * @var bool - */ - public $external_mutation_free = false; + public bool $external_mutation_free = false; - /** - * @var bool - */ - public $mutation_free = false; + public bool $mutation_free = false; - /** - * @var bool - */ - public $specialize_instance = false; + public bool $specialize_instance = false; /** * @var array */ - public $methods = []; + public array $methods = []; /** * @var array */ - public $pseudo_methods = []; + public array $pseudo_methods = []; /** * @var array */ - public $pseudo_static_methods = []; + public array $pseudo_static_methods = []; /** * Maps pseudo method names to the original declaring method identifier @@ -256,17 +187,17 @@ final class ClassLikeStorage implements HasAttributesInterface * * @var array */ - public $declaring_pseudo_method_ids = []; + public array $declaring_pseudo_method_ids = []; /** * @var array */ - public $declaring_method_ids = []; + public array $declaring_method_ids = []; /** * @var array */ - public $appearing_method_ids = []; + public array $appearing_method_ids = []; /** * Map from lowercase method name to list of declarations in order from parent, to grandparent, to @@ -275,62 +206,59 @@ final class ClassLikeStorage implements HasAttributesInterface * * @var array> */ - public $overridden_method_ids = []; + public array $overridden_method_ids = []; /** * @var array */ - public $documenting_method_ids = []; + public array $documenting_method_ids = []; /** * @var array */ - public $inheritable_method_ids = []; + public array $inheritable_method_ids = []; /** * @var array> */ - public $potential_declaring_method_ids = []; + public array $potential_declaring_method_ids = []; /** * @var array */ - public $properties = []; + public array $properties = []; /** * @var array */ - public $pseudo_property_set_types = []; + public array $pseudo_property_set_types = []; /** * @var array */ - public $pseudo_property_get_types = []; + public array $pseudo_property_get_types = []; /** * @var array */ - public $declaring_property_ids = []; + public array $declaring_property_ids = []; /** * @var array */ - public $appearing_property_ids = []; + public array $appearing_property_ids = []; - /** - * @var ?Union - */ - public $inheritors = null; + public ?Union $inheritors = null; /** * @var array */ - public $inheritable_property_ids = []; + public array $inheritable_property_ids = []; /** * @var array> */ - public $overridden_property_ids = []; + public array $overridden_property_ids = []; /** * An array holding the class template "as" types. @@ -343,12 +271,12 @@ final class ClassLikeStorage implements HasAttributesInterface * * @var array>|null */ - public $template_types; + public ?array $template_types = null; /** * @var array|null */ - public $template_covariants; + public ?array $template_covariants = null; /** * A map of which generic classlikes are extended or implemented by this class or interface. @@ -358,7 +286,7 @@ final class ClassLikeStorage implements HasAttributesInterface * @internal * @var array>|null */ - public $template_extended_offsets; + public ?array $template_extended_offsets = null; /** * A map of which generic classlikes are extended or implemented by this class or interface. @@ -374,108 +302,87 @@ final class ClassLikeStorage implements HasAttributesInterface * * @var array>|null */ - public $template_extended_params; + public ?array $template_extended_params = null; /** * @var array|null */ - public $template_type_extends_count; + public ?array $template_type_extends_count = null; /** * @var array|null */ - public $template_type_implements_count; + public ?array $template_type_implements_count = null; - /** - * @var ?Union - */ - public $yield; + public ?Union $yield = null; - /** @var ?string */ - public $declaring_yield_fqcn; + public ?string $declaring_yield_fqcn = null; /** * @var array|null */ - public $template_type_uses_count; + public ?array $template_type_uses_count = null; /** * @var array */ - public $initialized_properties = []; + public array $initialized_properties = []; /** * @var array */ - public $invalid_dependencies = []; + public array $invalid_dependencies = []; /** * @var array */ - public $dependent_classlikes = []; + public array $dependent_classlikes = []; /** * A hash of the source file's name, contents, and this file's modified on date - * - * @var string */ - public $hash = ''; + public string $hash = ''; - /** - * @var bool - */ - public $has_visitor_issues = false; + public bool $has_visitor_issues = false; /** * @var list */ - public $docblock_issues = []; + public array $docblock_issues = []; /** * @var array */ - public $type_aliases = []; + public array $type_aliases = []; - /** - * @var bool - */ - public $preserve_constructor_signature = false; + public bool $preserve_constructor_signature = false; - /** - * @var bool - */ - public $enforce_template_inheritance = false; + public bool $enforce_template_inheritance = false; - /** - * @var null|string - */ - public $extension_requirement; + public ?string $extension_requirement = null; /** * @var array */ - public $implementation_requirements = []; + public array $implementation_requirements = []; /** * @var list */ - public $attributes = []; + public array $attributes = []; /** * @var array */ - public $enum_cases = []; + public array $enum_cases = []; /** * @var 'int'|'string'|null */ - public $enum_type; + public ?string $enum_type = null; - /** - * @var ?string - */ - public $description; + public ?string $description = null; public bool $public_api = false; diff --git a/src/Psalm/Storage/CustomMetadataTrait.php b/src/Psalm/Storage/CustomMetadataTrait.php index cbb80570429..e2679ee01c9 100644 --- a/src/Psalm/Storage/CustomMetadataTrait.php +++ b/src/Psalm/Storage/CustomMetadataTrait.php @@ -10,5 +10,5 @@ trait CustomMetadataTrait { /** @var array */ - public $custom_metadata = []; + public array $custom_metadata = []; } diff --git a/src/Psalm/Storage/EnumCaseStorage.php b/src/Psalm/Storage/EnumCaseStorage.php index 7b99d1a6320..12cf8b1098e 100644 --- a/src/Psalm/Storage/EnumCaseStorage.php +++ b/src/Psalm/Storage/EnumCaseStorage.php @@ -10,18 +10,11 @@ final class EnumCaseStorage { - /** - * @var TLiteralString|TLiteralInt|null - */ - public $value; + public TLiteralString|TLiteralInt|null $value = null; - /** @var CodeLocation */ - public $stmt_location; + public CodeLocation $stmt_location; - /** - * @var bool - */ - public $deprecated = false; + public bool $deprecated = false; public function __construct( TLiteralString|TLiteralInt|null $value, diff --git a/src/Psalm/Storage/FileStorage.php b/src/Psalm/Storage/FileStorage.php index 1c505d2fc2c..ce309152bba 100644 --- a/src/Psalm/Storage/FileStorage.php +++ b/src/Psalm/Storage/FileStorage.php @@ -16,87 +16,76 @@ final class FileStorage /** * @var array */ - public $classlikes_in_file = []; + public array $classlikes_in_file = []; /** * @var array */ - public $referenced_classlikes = []; + public array $referenced_classlikes = []; /** * @var array */ - public $required_classes = []; + public array $required_classes = []; /** * @var array */ - public $required_interfaces = []; + public array $required_interfaces = []; - /** @var string */ - public $file_path; + public string $file_path; /** * @var array */ - public $functions = []; + public array $functions = []; /** @var array */ - public $declaring_function_ids = []; + public array $declaring_function_ids = []; /** * @var array */ - public $constants = []; + public array $constants = []; /** @var array */ - public $declaring_constants = []; + public array $declaring_constants = []; /** @var array */ - public $required_file_paths = []; + public array $required_file_paths = []; /** @var array */ - public $required_by_file_paths = []; + public array $required_by_file_paths = []; - /** @var bool */ - public $populated = false; + public bool $populated = false; - /** @var bool */ - public $deep_scan = false; + public bool $deep_scan = false; - /** @var bool */ - public $has_extra_statements = false; + public bool $has_extra_statements = false; - /** - * @var string - */ - public $hash = ''; + public string $hash = ''; - /** - * @var bool - */ - public $has_visitor_issues = false; + public bool $has_visitor_issues = false; /** * @var list */ - public $docblock_issues = []; + public array $docblock_issues = []; /** * @var array */ - public $type_aliases = []; + public array $type_aliases = []; /** * @var array */ - public $classlike_aliases = []; + public array $classlike_aliases = []; - /** @var ?Aliases */ - public $aliases; + public ?Aliases $aliases = null; /** @var Aliases[] */ - public $namespace_aliases = []; + public array $namespace_aliases = []; public function __construct(string $file_path) { diff --git a/src/Psalm/Storage/FunctionLikeParameter.php b/src/Psalm/Storage/FunctionLikeParameter.php index 03e88c50ca3..cdeaee2d3eb 100644 --- a/src/Psalm/Storage/FunctionLikeParameter.php +++ b/src/Psalm/Storage/FunctionLikeParameter.php @@ -15,105 +15,51 @@ final class FunctionLikeParameter implements HasAttributesInterface, TypeNode { use CustomMetadataTrait; - /** - * @var string - */ - public $name; + public string $name; - /** - * @var bool - */ - public $by_ref; + public bool $by_ref; - /** - * @var Union|null - */ - public $type; + public ?Union $type = null; - /** - * @var Union|null - */ - public $out_type; + public ?Union $out_type = null; - /** - * @var Union|null - */ - public $signature_type; + public ?Union $signature_type = null; - /** - * @var bool - */ - public $has_docblock_type = false; + public bool $has_docblock_type = false; - /** - * @var bool - */ - public $is_optional; + public bool $is_optional; - /** - * @var bool - */ - public $is_nullable; + public bool $is_nullable; - /** - * @var Union|UnresolvedConstantComponent|null - */ - public $default_type; + public Union|UnresolvedConstantComponent|null $default_type = null; - /** - * @var CodeLocation|null - */ - public $location; + public ?CodeLocation $location = null; - /** - * @var CodeLocation|null - */ - public $type_location; + public ?CodeLocation $type_location = null; - /** - * @var CodeLocation|null - */ - public $signature_type_location; + public ?CodeLocation $signature_type_location = null; - /** - * @var bool - */ - public $is_variadic; + public bool $is_variadic; /** * @var array|null */ - public $sinks; + public ?array $sinks = null; - /** - * @var bool - */ - public $assert_untainted = false; + public bool $assert_untainted = false; - /** - * @var bool - */ - public $type_inferred = false; + public bool $type_inferred = false; - /** - * @var bool - */ - public $expect_variable = false; + public bool $expect_variable = false; - /** - * @var bool - */ - public $promoted_property = false; + public bool $promoted_property = false; /** * @var list */ - public $attributes = []; + public array $attributes = []; - /** - * @var ?string - */ - public $description; + public ?string $description = null; /** * @psalm-external-mutation-free diff --git a/src/Psalm/Storage/FunctionLikeStorage.php b/src/Psalm/Storage/FunctionLikeStorage.php index 8cd00d73cce..ef13057d9dc 100644 --- a/src/Psalm/Storage/FunctionLikeStorage.php +++ b/src/Psalm/Storage/FunctionLikeStorage.php @@ -19,97 +19,64 @@ abstract class FunctionLikeStorage implements HasAttributesInterface { use CustomMetadataTrait; - /** - * @var CodeLocation|null - */ - public $location; + public ?CodeLocation $location = null; - /** - * @var CodeLocation|null - */ - public $stmt_location; + public ?CodeLocation $stmt_location = null; /** * @psalm-readonly-allow-private-mutation * @var list */ - public $params = []; + public array $params = []; /** * @psalm-readonly-allow-private-mutation * @var array */ - public $param_lookup = []; + public array $param_lookup = []; - /** - * @var Union|null - */ - public $return_type; + public ?Union $return_type = null; - /** - * @var CodeLocation|null - */ - public $return_type_location; + public ?CodeLocation $return_type_location = null; - /** - * @var Union|null - */ - public $signature_return_type; + public ?Union $signature_return_type = null; - /** - * @var CodeLocation|null - */ - public $signature_return_type_location; + public ?CodeLocation $signature_return_type_location = null; - /** - * @var ?string - */ - public $cased_name; + public ?string $cased_name = null; /** * @var array */ - public $suppressed_issues = []; + public array $suppressed_issues = []; - /** - * @var ?bool - */ - public $deprecated; + public ?bool $deprecated = null; /** * @var list */ - public $internal = []; + public array $internal = []; - /** - * @var bool - */ - public $variadic = false; + public bool $variadic = false; - /** - * @var bool - */ - public $returns_by_ref = false; + public bool $returns_by_ref = false; - /** - * @var ?int - */ - public $required_param_count; + public ?int $required_param_count = null; /** * @var array */ - public $defined_constants = []; + public array $defined_constants = []; /** * @var array */ - public $global_variables = []; + public array $global_variables = []; /** * @var array */ - public $global_types = []; + public array $global_types = []; /** * An array holding the class template "as" types. @@ -122,57 +89,45 @@ abstract class FunctionLikeStorage implements HasAttributesInterface * * @var array>|null */ - public $template_types; + public ?array $template_types = null; /** * @var array */ - public $assertions = []; + public array $assertions = []; /** * @var array */ - public $if_true_assertions = []; + public array $if_true_assertions = []; /** * @var array */ - public $if_false_assertions = []; + public array $if_false_assertions = []; - /** - * @var bool - */ - public $has_visitor_issues = false; + public bool $has_visitor_issues = false; /** * @var list */ - public $docblock_issues = []; + public array $docblock_issues = []; /** * @var array */ - public $throws = []; + public array $throws = []; /** * @var array */ - public $throw_locations = []; + public array $throw_locations = []; - /** - * @var bool - */ - public $has_yield = false; + public bool $has_yield = false; - /** - * @var bool - */ - public $mutation_free = false; + public bool $mutation_free = false; - /** - * @var string|null - */ - public $return_type_description; + public ?string $return_type_description = null; /** * @var array @@ -181,68 +136,54 @@ abstract class FunctionLikeStorage implements HasAttributesInterface public bool $has_undertyped_native_parameters = false; - /** - * @var bool - */ - public $is_static = false; + public bool $is_static = false; - /** - * @var bool - */ - public $pure = false; + public bool $pure = false; /** * Whether or not the function output is dependent solely on input - a function can be * impure but still have this property (e.g. var_export). Useful for taint analysis. - * - * @var bool */ - public $specialize_call = false; + public bool $specialize_call = false; /** * @var array */ - public $taint_source_types = []; + public array $taint_source_types = []; /** * @var array */ - public $added_taints = []; + public array $added_taints = []; /** * @var array */ - public $removed_taints = []; + public array $removed_taints = []; /** * @var array */ - public $conditionally_removed_taints = []; + public array $conditionally_removed_taints = []; /** * @var array */ - public $return_source_params = []; + public array $return_source_params = []; - /** - * @var bool - */ - public $allow_named_arg_calls = true; + public bool $allow_named_arg_calls = true; /** * @var list */ - public $attributes = []; + public array $attributes = []; /** * @var list, return: bool}>|null */ - public $proxy_calls = []; + public ?array $proxy_calls = []; - /** - * @var ?string - */ - public $description; + public ?string $description = null; public bool $public_api = false; diff --git a/src/Psalm/Storage/FunctionStorage.php b/src/Psalm/Storage/FunctionStorage.php index b9adb7beeeb..f9c9dcfeeb2 100644 --- a/src/Psalm/Storage/FunctionStorage.php +++ b/src/Psalm/Storage/FunctionStorage.php @@ -7,5 +7,5 @@ final class FunctionStorage extends FunctionLikeStorage { /** @var array */ - public $byref_uses = []; + public array $byref_uses = []; } diff --git a/src/Psalm/Storage/MethodStorage.php b/src/Psalm/Storage/MethodStorage.php index dcde8d9a083..c6ebc2d8aab 100644 --- a/src/Psalm/Storage/MethodStorage.php +++ b/src/Psalm/Storage/MethodStorage.php @@ -8,102 +8,45 @@ final class MethodStorage extends FunctionLikeStorage { - /** - * @var bool - */ - public $is_static = false; + public bool $is_static = false; - /** - * @var int - */ - public $visibility = 0; + public int $visibility = 0; - /** - * @var bool - */ - public $final = false; + public bool $final = false; - /** - * @var bool - */ - public $final_from_docblock = false; + public bool $final_from_docblock = false; - /** - * @var bool - */ - public $abstract = false; + public bool $abstract = false; - /** - * @var bool - */ - public $overridden_downstream = false; + public bool $overridden_downstream = false; - /** - * @var bool - */ - public $overridden_somewhere = false; + public bool $overridden_somewhere = false; - /** - * @var bool - */ - public $inheritdoc = false; + public bool $inheritdoc = false; - /** - * @var ?bool - */ - public $inherited_return_type = false; + public ?bool $inherited_return_type = false; - /** - * @var ?string - */ - public $defining_fqcln; + public ?string $defining_fqcln = null; - /** - * @var bool - */ - public $has_docblock_param_types = false; + public bool $has_docblock_param_types = false; - /** - * @var bool - */ - public $has_docblock_return_type = false; + public bool $has_docblock_return_type = false; - /** - * @var bool - */ - public $external_mutation_free = false; + public bool $external_mutation_free = false; - /** - * @var bool - */ - public $immutable = false; + public bool $immutable = false; - /** - * @var bool - */ - public $mutation_free_inferred = false; + public bool $mutation_free_inferred = false; /** * @var ?array */ - public $this_property_mutations; + public ?array $this_property_mutations = null; - /** - * @var Union|null - */ - public $self_out_type; + public ?Union $self_out_type = null; - /** - * @var Union|null - */ - public $if_this_is_type = null; - /** - * @var bool - */ - public $stubbed = false; + public ?Union $if_this_is_type = null; + public bool $stubbed = false; - /** - * @var bool - */ - public $probably_fluent = false; + public bool $probably_fluent = false; } diff --git a/src/Psalm/Storage/Possibilities.php b/src/Psalm/Storage/Possibilities.php index 4eca32da64f..62959661725 100644 --- a/src/Psalm/Storage/Possibilities.php +++ b/src/Psalm/Storage/Possibilities.php @@ -17,13 +17,13 @@ final class Possibilities /** * @var list the rule being asserted */ - public $rule; + public array $rule; /** * @var int|string the id of the property/variable, or * the parameter offset of the affected arg */ - public $var_id; + public int|string $var_id; /** * @param list $rule diff --git a/src/Psalm/Storage/PropertyStorage.php b/src/Psalm/Storage/PropertyStorage.php index b18916c3a67..73d373cc3da 100644 --- a/src/Psalm/Storage/PropertyStorage.php +++ b/src/Psalm/Storage/PropertyStorage.php @@ -12,102 +12,58 @@ final class PropertyStorage implements HasAttributesInterface { use CustomMetadataTrait; - /** - * @var ?bool - */ - public $is_static; + public ?bool $is_static = null; /** * @var ClassLikeAnalyzer::VISIBILITY_* */ public $visibility = ClassLikeAnalyzer::VISIBILITY_PUBLIC; - /** - * @var CodeLocation|null - */ - public $location; + public ?CodeLocation $location = null; - /** - * @var CodeLocation|null - */ - public $stmt_location; + public ?CodeLocation $stmt_location = null; - /** - * @var CodeLocation|null - */ - public $type_location; + public ?CodeLocation $type_location = null; - /** - * @var CodeLocation|null - */ - public $signature_type_location; + public ?CodeLocation $signature_type_location = null; - /** - * @var Union|null - */ - public $type; + public ?Union $type = null; - /** - * @var Union|null - */ - public $signature_type; + public ?Union $signature_type = null; - /** - * @var Union|null - */ - public $suggested_type; + public ?Union $suggested_type = null; - /** - * @var bool - */ - public $has_default = false; + public bool $has_default = false; - /** - * @var bool - */ - public $deprecated = false; + public bool $deprecated = false; - /** - * @var bool - */ - public $readonly = false; + public bool $readonly = false; /** * Whether or not to allow mutation by internal methods - * - * @var bool */ - public $allow_private_mutation = false; + public bool $allow_private_mutation = false; /** * @var list */ - public $internal = []; + public array $internal = []; - /** - * @var ?string - */ - public $getter_method; + public ?string $getter_method = null; - /** - * @var bool - */ - public $is_promoted = false; + public bool $is_promoted = false; /** * @var list */ - public $attributes = []; + public array $attributes = []; /** * @var array */ - public $suppressed_issues = []; + public array $suppressed_issues = []; - /** - * @var ?string - */ - public $description; + public ?string $description = null; public function getInfo(): string { diff --git a/src/Psalm/Type/Atomic.php b/src/Psalm/Type/Atomic.php index a879ec989bb..b80d0af22a0 100644 --- a/src/Psalm/Type/Atomic.php +++ b/src/Psalm/Type/Atomic.php @@ -91,32 +91,19 @@ protected function __clone() /** * Whether or not the type has been checked yet - * - * @var bool */ - public $checked = false; + public bool $checked = false; /** * Whether or not the type comes from a docblock - * - * @var bool */ - public $from_docblock = false; + public bool $from_docblock = false; - /** - * @var ?int - */ - public $offset_start; + public ?int $offset_start = null; - /** - * @var ?int - */ - public $offset_end; + public ?int $offset_end = null; - /** - * @var ?string - */ - public $text; + public ?string $text = null; /** * @return static diff --git a/src/Psalm/Type/Atomic/CallableTrait.php b/src/Psalm/Type/Atomic/CallableTrait.php index 56020594677..6f1c38d1298 100644 --- a/src/Psalm/Type/Atomic/CallableTrait.php +++ b/src/Psalm/Type/Atomic/CallableTrait.php @@ -24,17 +24,11 @@ trait CallableTrait /** * @var list|null */ - public $params = []; + public ?array $params = []; - /** - * @var Union|null - */ - public $return_type; + public ?Union $return_type = null; - /** - * @var ?bool - */ - public $is_pure; + public ?bool $is_pure = null; /** * Constructs a new instance of a generic type diff --git a/src/Psalm/Type/Atomic/TAnonymousClassInstance.php b/src/Psalm/Type/Atomic/TAnonymousClassInstance.php index 85719d74ace..d92a2f2f0b6 100644 --- a/src/Psalm/Type/Atomic/TAnonymousClassInstance.php +++ b/src/Psalm/Type/Atomic/TAnonymousClassInstance.php @@ -11,10 +11,7 @@ */ final class TAnonymousClassInstance extends TNamedObject { - /** - * @var string|null - */ - public $extends; + public ?string $extends = null; /** * @param string $value the name of the object diff --git a/src/Psalm/Type/Atomic/TArray.php b/src/Psalm/Type/Atomic/TArray.php index 5082e6a1dfa..cf90faf8851 100644 --- a/src/Psalm/Type/Atomic/TArray.php +++ b/src/Psalm/Type/Atomic/TArray.php @@ -30,10 +30,7 @@ class TArray extends Atomic */ public array $type_params; - /** - * @var string - */ - public $value = 'array'; + public string $value = 'array'; /** * Constructs a new instance of a generic type diff --git a/src/Psalm/Type/Atomic/TCallable.php b/src/Psalm/Type/Atomic/TCallable.php index 36e2bf3c0e4..90fb430a291 100644 --- a/src/Psalm/Type/Atomic/TCallable.php +++ b/src/Psalm/Type/Atomic/TCallable.php @@ -20,10 +20,7 @@ final class TCallable extends Atomic { use CallableTrait; - /** - * @var string - */ - public $value; + public string $value; /** * Constructs a new instance of a generic type diff --git a/src/Psalm/Type/Atomic/TClassConstant.php b/src/Psalm/Type/Atomic/TClassConstant.php index 2b0946940a1..217877448b7 100644 --- a/src/Psalm/Type/Atomic/TClassConstant.php +++ b/src/Psalm/Type/Atomic/TClassConstant.php @@ -14,11 +14,9 @@ */ final class TClassConstant extends Atomic { - /** @var string */ - public $fq_classlike_name; + public string $fq_classlike_name; - /** @var string */ - public $const_name; + public string $const_name; public function __construct(string $fq_classlike_name, string $const_name, bool $from_docblock = false) { diff --git a/src/Psalm/Type/Atomic/TClassString.php b/src/Psalm/Type/Atomic/TClassString.php index 51641ac4d84..f994601666a 100644 --- a/src/Psalm/Type/Atomic/TClassString.php +++ b/src/Psalm/Type/Atomic/TClassString.php @@ -27,21 +27,15 @@ */ class TClassString extends TString { - /** - * @var string - */ - public $as; + public string $as; public ?TNamedObject $as_type; - /** @var bool */ - public $is_loaded = false; + public bool $is_loaded = false; - /** @var bool */ - public $is_interface = false; + public bool $is_interface = false; - /** @var bool */ - public $is_enum = false; + public bool $is_enum = false; public function __construct( string $as = 'object', diff --git a/src/Psalm/Type/Atomic/TClassStringMap.php b/src/Psalm/Type/Atomic/TClassStringMap.php index 92950418b71..028252540de 100644 --- a/src/Psalm/Type/Atomic/TClassStringMap.php +++ b/src/Psalm/Type/Atomic/TClassStringMap.php @@ -23,17 +23,11 @@ */ final class TClassStringMap extends Atomic { - /** - * @var string - */ - public $param_name; + public string $param_name; public ?TNamedObject $as_type; - /** - * @var Union - */ - public $value_param; + public Union $value_param; /** * Constructs a new instance of a list diff --git a/src/Psalm/Type/Atomic/TClosure.php b/src/Psalm/Type/Atomic/TClosure.php index 334c5837ff3..b556f503d29 100644 --- a/src/Psalm/Type/Atomic/TClosure.php +++ b/src/Psalm/Type/Atomic/TClosure.php @@ -23,7 +23,7 @@ final class TClosure extends TNamedObject use CallableTrait; /** @var array */ - public $byref_uses = []; + public array $byref_uses = []; /** * @param list $params diff --git a/src/Psalm/Type/Atomic/TConditional.php b/src/Psalm/Type/Atomic/TConditional.php index 3673a3b4847..f15ebdf350e 100644 --- a/src/Psalm/Type/Atomic/TConditional.php +++ b/src/Psalm/Type/Atomic/TConditional.php @@ -17,35 +17,17 @@ */ final class TConditional extends Atomic { - /** - * @var string - */ - public $param_name; + public string $param_name; - /** - * @var string - */ - public $defining_class; + public string $defining_class; - /** - * @var Union - */ - public $as_type; + public Union $as_type; - /** - * @var Union - */ - public $conditional_type; + public Union $conditional_type; - /** - * @var Union - */ - public $if_type; + public Union $if_type; - /** - * @var Union - */ - public $else_type; + public Union $else_type; public function __construct( string $param_name, diff --git a/src/Psalm/Type/Atomic/TDependentGetClass.php b/src/Psalm/Type/Atomic/TDependentGetClass.php index 76078ad6d4b..ebc492233b0 100644 --- a/src/Psalm/Type/Atomic/TDependentGetClass.php +++ b/src/Psalm/Type/Atomic/TDependentGetClass.php @@ -15,15 +15,10 @@ final class TDependentGetClass extends TString implements DependentType { /** * Used to hold information as to what this refers to - * - * @var string */ - public $typeof; + public string $typeof; - /** - * @var Union - */ - public $as_type; + public Union $as_type; /** * @param string $typeof the variable id diff --git a/src/Psalm/Type/Atomic/TDependentGetDebugType.php b/src/Psalm/Type/Atomic/TDependentGetDebugType.php index 5dd416e52c3..5875f911fdc 100644 --- a/src/Psalm/Type/Atomic/TDependentGetDebugType.php +++ b/src/Psalm/Type/Atomic/TDependentGetDebugType.php @@ -13,10 +13,8 @@ final class TDependentGetDebugType extends TString implements DependentType { /** * Used to hold information as to what this refers to - * - * @var string */ - public $typeof; + public string $typeof; /** * @param string $typeof the variable id diff --git a/src/Psalm/Type/Atomic/TDependentGetType.php b/src/Psalm/Type/Atomic/TDependentGetType.php index 1db93696a56..7f1bfee3877 100644 --- a/src/Psalm/Type/Atomic/TDependentGetType.php +++ b/src/Psalm/Type/Atomic/TDependentGetType.php @@ -13,10 +13,8 @@ final class TDependentGetType extends TString { /** * Used to hold information as to what this refers to - * - * @var string */ - public $typeof; + public string $typeof; /** * @param string $typeof the variable id diff --git a/src/Psalm/Type/Atomic/TEnumCase.php b/src/Psalm/Type/Atomic/TEnumCase.php index f57927c48ea..2fcbb1faa69 100644 --- a/src/Psalm/Type/Atomic/TEnumCase.php +++ b/src/Psalm/Type/Atomic/TEnumCase.php @@ -11,10 +11,7 @@ */ final class TEnumCase extends TNamedObject { - /** - * @var string - */ - public $case_name; + public string $case_name; public function __construct(string $fq_enum_name, string $case_name) { diff --git a/src/Psalm/Type/Atomic/TFalse.php b/src/Psalm/Type/Atomic/TFalse.php index 8929777083c..0bfc243ef44 100644 --- a/src/Psalm/Type/Atomic/TFalse.php +++ b/src/Psalm/Type/Atomic/TFalse.php @@ -12,7 +12,7 @@ final class TFalse extends TBool { /** @var false */ - public $value = false; + public bool $value = false; public function getKey(bool $include_extra = true): string { diff --git a/src/Psalm/Type/Atomic/TGenericObject.php b/src/Psalm/Type/Atomic/TGenericObject.php index 71f1afc1768..244a3218e40 100644 --- a/src/Psalm/Type/Atomic/TGenericObject.php +++ b/src/Psalm/Type/Atomic/TGenericObject.php @@ -34,7 +34,7 @@ final class TGenericObject extends TNamedObject public array $type_params; /** @var bool if the parameters have been remapped to another class */ - public $remapped_params = false; + public bool $remapped_params = false; /** * @param string $value the name of the object diff --git a/src/Psalm/Type/Atomic/TIntMask.php b/src/Psalm/Type/Atomic/TIntMask.php index b5686ae83bc..f19e30ee91d 100644 --- a/src/Psalm/Type/Atomic/TIntMask.php +++ b/src/Psalm/Type/Atomic/TIntMask.php @@ -15,7 +15,7 @@ final class TIntMask extends TInt { /** @var non-empty-array */ - public $values; + public array $values; /** @param non-empty-array $values */ public function __construct(array $values, bool $from_docblock = false) diff --git a/src/Psalm/Type/Atomic/TIntMaskOf.php b/src/Psalm/Type/Atomic/TIntMaskOf.php index acd878433cc..ace9727db82 100644 --- a/src/Psalm/Type/Atomic/TIntMaskOf.php +++ b/src/Psalm/Type/Atomic/TIntMaskOf.php @@ -15,8 +15,7 @@ */ final class TIntMaskOf extends TInt { - /** @var TClassConstant|TKeyOf|TValueOf */ - public $value; + public TClassConstant|TKeyOf|TValueOf $value; /** * @param TClassConstant|TKeyOf|TValueOf $value diff --git a/src/Psalm/Type/Atomic/TIntRange.php b/src/Psalm/Type/Atomic/TIntRange.php index a7991a52153..b3a55d714fd 100644 --- a/src/Psalm/Type/Atomic/TIntRange.php +++ b/src/Psalm/Type/Atomic/TIntRange.php @@ -17,17 +17,10 @@ final class TIntRange extends TInt public const BOUND_MIN = 'min'; public const BOUND_MAX = 'max'; - /** - * @var int|null - */ - public $min_bound; - /** - * @var int|null - */ - public $max_bound; + public ?int $min_bound = null; + public ?int $max_bound = null; - /** @var string|null */ - public $dependent_list_key; + public ?string $dependent_list_key = null; public function __construct( ?int $min_bound, diff --git a/src/Psalm/Type/Atomic/TIterable.php b/src/Psalm/Type/Atomic/TIterable.php index 93d1caa8875..f8153751a04 100644 --- a/src/Psalm/Type/Atomic/TIterable.php +++ b/src/Psalm/Type/Atomic/TIterable.php @@ -33,15 +33,9 @@ final class TIterable extends Atomic */ public array $type_params; - /** - * @var string - */ - public $value = 'iterable'; + public string $value = 'iterable'; - /** - * @var bool - */ - public $has_docblock_params = false; + public bool $has_docblock_params = false; /** * @param array{Union, Union}|array $type_params diff --git a/src/Psalm/Type/Atomic/TKeyOf.php b/src/Psalm/Type/Atomic/TKeyOf.php index 51370754b27..22d9e53d588 100644 --- a/src/Psalm/Type/Atomic/TKeyOf.php +++ b/src/Psalm/Type/Atomic/TKeyOf.php @@ -16,8 +16,7 @@ */ final class TKeyOf extends TArrayKey { - /** @var Union */ - public $type; + public Union $type; public function __construct(Union $type, bool $from_docblock = false) { diff --git a/src/Psalm/Type/Atomic/TKeyedArray.php b/src/Psalm/Type/Atomic/TKeyedArray.php index 965ef12e2ec..80f9f968319 100644 --- a/src/Psalm/Type/Atomic/TKeyedArray.php +++ b/src/Psalm/Type/Atomic/TKeyedArray.php @@ -36,24 +36,24 @@ class TKeyedArray extends Atomic /** * @var non-empty-array */ - public $properties; + public array $properties; /** * @var array|null */ - public $class_strings; + public ?array $class_strings = null; /** * If the shape has fallback params then they are here * * @var array{Union, Union}|null */ - public $fallback_params; + public ?array $fallback_params = null; /** * @var bool - if this is a list of sequential elements */ - public $is_list = false; + public bool $is_list = false; /** @var non-empty-lowercase-string */ protected const NAME_ARRAY = 'array'; diff --git a/src/Psalm/Type/Atomic/TLiteralClassString.php b/src/Psalm/Type/Atomic/TLiteralClassString.php index b7936a488c7..a3e14fa2d12 100644 --- a/src/Psalm/Type/Atomic/TLiteralClassString.php +++ b/src/Psalm/Type/Atomic/TLiteralClassString.php @@ -19,10 +19,8 @@ final class TLiteralClassString extends TLiteralString { /** * Whether or not this type can represent a child of the class named in $value - * - * @var bool */ - public $definite_class = false; + public bool $definite_class = false; public function __construct(string $value, bool $definite_class = false, bool $from_docblock = false) { diff --git a/src/Psalm/Type/Atomic/TLiteralString.php b/src/Psalm/Type/Atomic/TLiteralString.php index 6da01c89674..f235fdfb95b 100644 --- a/src/Psalm/Type/Atomic/TLiteralString.php +++ b/src/Psalm/Type/Atomic/TLiteralString.php @@ -19,8 +19,7 @@ */ class TLiteralString extends TString { - /** @var string */ - public $value; + public string $value; /** * Creates a literal string with a known value. diff --git a/src/Psalm/Type/Atomic/TMixed.php b/src/Psalm/Type/Atomic/TMixed.php index d9aad81eb38..b7f24fcb6c5 100644 --- a/src/Psalm/Type/Atomic/TMixed.php +++ b/src/Psalm/Type/Atomic/TMixed.php @@ -13,8 +13,7 @@ */ class TMixed extends Atomic { - /** @var bool */ - public $from_loop_isset = false; + public bool $from_loop_isset = false; public function __construct(bool $from_loop_isset = false, bool $from_docblock = false) { diff --git a/src/Psalm/Type/Atomic/TNamedObject.php b/src/Psalm/Type/Atomic/TNamedObject.php index daf9571e7fd..7a0a2e602fe 100644 --- a/src/Psalm/Type/Atomic/TNamedObject.php +++ b/src/Psalm/Type/Atomic/TNamedObject.php @@ -24,27 +24,16 @@ class TNamedObject extends Atomic { use HasIntersectionTrait; - /** - * @var string - */ - public $value; + public string $value; - /** - * @var bool - */ - public $is_static = false; + public bool $is_static = false; - /** - * @var bool - */ - public $is_static_resolved = false; + public bool $is_static_resolved = false; /** * Whether or not this type can represent a child of the class named in $value - * - * @var bool */ - public $definite_class = false; + public bool $definite_class = false; /** * @param string $value the name of the object diff --git a/src/Psalm/Type/Atomic/TNonEmptyArray.php b/src/Psalm/Type/Atomic/TNonEmptyArray.php index c4b9a9c28ab..b71dd5d5f3b 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyArray.php +++ b/src/Psalm/Type/Atomic/TNonEmptyArray.php @@ -17,17 +17,14 @@ final class TNonEmptyArray extends TArray /** * @var positive-int|null */ - public $count; + public ?int $count = null; /** * @var positive-int|null */ - public $min_count; + public ?int $min_count = null; - /** - * @var string - */ - public $value = 'non-empty-array'; + public string $value = 'non-empty-array'; /** * @param array{Union, Union} $type_params diff --git a/src/Psalm/Type/Atomic/TObjectWithProperties.php b/src/Psalm/Type/Atomic/TObjectWithProperties.php index 96dcc33a062..1f54c63c8a8 100644 --- a/src/Psalm/Type/Atomic/TObjectWithProperties.php +++ b/src/Psalm/Type/Atomic/TObjectWithProperties.php @@ -29,15 +29,14 @@ final class TObjectWithProperties extends TObject /** * @var array */ - public $properties; + public array $properties; /** * @var array */ - public $methods; + public array $methods; - /** @var bool */ - public $is_stringable_object_only = false; + public bool $is_stringable_object_only = false; /** * Constructs a new instance of a generic type diff --git a/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php b/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php index ac2442834af..bba86e66e29 100644 --- a/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php +++ b/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php @@ -11,20 +11,11 @@ */ final class TTemplateIndexedAccess extends Atomic { - /** - * @var string - */ - public $array_param_name; + public string $array_param_name; - /** - * @var string - */ - public $offset_param_name; + public string $offset_param_name; - /** - * @var string - */ - public $defining_class; + public string $defining_class; public function __construct( string $array_param_name, diff --git a/src/Psalm/Type/Atomic/TTemplateKeyOf.php b/src/Psalm/Type/Atomic/TTemplateKeyOf.php index 50f20ff1e13..48c61dff5ec 100644 --- a/src/Psalm/Type/Atomic/TTemplateKeyOf.php +++ b/src/Psalm/Type/Atomic/TTemplateKeyOf.php @@ -17,20 +17,11 @@ */ final class TTemplateKeyOf extends Atomic { - /** - * @var string - */ - public $param_name; + public string $param_name; - /** - * @var string - */ - public $defining_class; + public string $defining_class; - /** - * @var Union - */ - public $as; + public Union $as; public function __construct( string $param_name, diff --git a/src/Psalm/Type/Atomic/TTemplateParam.php b/src/Psalm/Type/Atomic/TTemplateParam.php index d896b87b817..8a95ab2bdb8 100644 --- a/src/Psalm/Type/Atomic/TTemplateParam.php +++ b/src/Psalm/Type/Atomic/TTemplateParam.php @@ -21,20 +21,11 @@ final class TTemplateParam extends Atomic { use HasIntersectionTrait; - /** - * @var string - */ - public $param_name; + public string $param_name; - /** - * @var Union - */ - public $as; + public Union $as; - /** - * @var string - */ - public $defining_class; + public string $defining_class; /** * @param array $extra_types diff --git a/src/Psalm/Type/Atomic/TTemplateParamClass.php b/src/Psalm/Type/Atomic/TTemplateParamClass.php index 488a8e382dd..00b370a68b8 100644 --- a/src/Psalm/Type/Atomic/TTemplateParamClass.php +++ b/src/Psalm/Type/Atomic/TTemplateParamClass.php @@ -11,15 +11,9 @@ */ final class TTemplateParamClass extends TClassString { - /** - * @var string - */ - public $param_name; + public string $param_name; - /** - * @var string - */ - public $defining_class; + public string $defining_class; public function __construct( string $param_name, diff --git a/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php b/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php index d629f704fb6..e1e888f10f5 100644 --- a/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php +++ b/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php @@ -17,18 +17,9 @@ */ final class TTemplatePropertiesOf extends Atomic { - /** - * @var string - */ - public $param_name; - /** - * @var string - */ - public $defining_class; - /** - * @var TTemplateParam - */ - public $as; + public string $param_name; + public string $defining_class; + public TTemplateParam $as; /** * @var TPropertiesOf::VISIBILITY_*|null */ diff --git a/src/Psalm/Type/Atomic/TTemplateValueOf.php b/src/Psalm/Type/Atomic/TTemplateValueOf.php index 895a532ef13..98be9d1e85c 100644 --- a/src/Psalm/Type/Atomic/TTemplateValueOf.php +++ b/src/Psalm/Type/Atomic/TTemplateValueOf.php @@ -17,20 +17,11 @@ */ final class TTemplateValueOf extends Atomic { - /** - * @var string - */ - public $param_name; + public string $param_name; - /** - * @var string - */ - public $defining_class; + public string $defining_class; - /** - * @var Union - */ - public $as; + public Union $as; public function __construct( string $param_name, diff --git a/src/Psalm/Type/Atomic/TTrue.php b/src/Psalm/Type/Atomic/TTrue.php index 16b354ad91e..67937dd7548 100644 --- a/src/Psalm/Type/Atomic/TTrue.php +++ b/src/Psalm/Type/Atomic/TTrue.php @@ -12,7 +12,7 @@ final class TTrue extends TBool { /** @var true */ - public $value = true; + public bool $value = true; public function getKey(bool $include_extra = true): string { diff --git a/src/Psalm/Type/Atomic/TTypeAlias.php b/src/Psalm/Type/Atomic/TTypeAlias.php index fdc674cd8a4..52a2fe9037a 100644 --- a/src/Psalm/Type/Atomic/TTypeAlias.php +++ b/src/Psalm/Type/Atomic/TTypeAlias.php @@ -20,13 +20,11 @@ final class TTypeAlias extends Atomic * referencing type(s) are part of other intersection types. The intersection types are not set anymore * and with v6 this property along with its related methods will get removed. */ - public $extra_types; + public ?array $extra_types = null; - /** @var string */ - public $declaring_fq_classlike_name; + public string $declaring_fq_classlike_name; - /** @var string */ - public $alias_name; + public string $alias_name; /** * @param array|null $extra_types diff --git a/src/Psalm/Type/Atomic/TValueOf.php b/src/Psalm/Type/Atomic/TValueOf.php index b278bc82989..ad71cd03ce3 100644 --- a/src/Psalm/Type/Atomic/TValueOf.php +++ b/src/Psalm/Type/Atomic/TValueOf.php @@ -20,8 +20,7 @@ */ final class TValueOf extends Atomic { - /** @var Union */ - public $type; + public Union $type; public function __construct(Union $type, bool $from_docblock = false) { diff --git a/src/Psalm/Type/MutableUnion.php b/src/Psalm/Type/MutableUnion.php index bcf0aa44534..70b6377ee69 100644 --- a/src/Psalm/Type/MutableUnion.php +++ b/src/Psalm/Type/MutableUnion.php @@ -41,120 +41,88 @@ final class MutableUnion implements TypeNode /** * Whether the type originated in a docblock - * - * @var bool */ - public $from_docblock = false; + public bool $from_docblock = false; /** * Whether the type originated from integer calculation - * - * @var bool */ - public $from_calculation = false; + public bool $from_calculation = false; /** * Whether the type originated from a property * * This helps turn isset($foo->bar) into a different sort of issue - * - * @var bool */ - public $from_property = false; + public bool $from_property = false; /** * Whether the type originated from *static* property * * Unlike non-static properties, static properties have no prescribed place * like __construct() to be initialized in - * - * @var bool */ - public $from_static_property = false; + public bool $from_static_property = false; /** * Whether the property that this type has been derived from has been initialized in a constructor - * - * @var bool */ - public $initialized = true; + public bool $initialized = true; /** * Which class the type was initialised in - * - * @var ?string */ - public $initialized_class; + public ?string $initialized_class = null; /** * Whether or not the type has been checked yet - * - * @var bool */ - public $checked = false; + public bool $checked = false; - /** - * @var bool - */ - public $failed_reconciliation = false; + public bool $failed_reconciliation = false; /** * Whether or not to ignore issues with possibly-null values - * - * @var bool */ - public $ignore_nullable_issues = false; + public bool $ignore_nullable_issues = false; /** * Whether or not to ignore issues with possibly-false values - * - * @var bool */ - public $ignore_falsable_issues = false; + public bool $ignore_falsable_issues = false; /** * Whether or not to ignore issues with isset on this type - * - * @var bool */ - public $ignore_isset = false; + public bool $ignore_isset = false; /** * Whether or not this variable is possibly undefined - * - * @var bool */ - public $possibly_undefined = false; + public bool $possibly_undefined = false; /** * Whether or not this variable is possibly undefined - * - * @var bool */ - public $possibly_undefined_from_try = false; + public bool $possibly_undefined_from_try = false; /** * whether this type had never set explicitly * since it's the bottom type, it's combined into everything else and lost * * @psalm-suppress PossiblyUnusedProperty used in setTypes and addType - * @var bool */ - public $explicit_never = false; + public bool $explicit_never = false; /** * Whether or not this union had a template, since replaced - * - * @var bool */ - public $had_template = false; + public bool $had_template = false; /** * Whether or not this union comes from a template "as" default - * - * @var bool */ - public $from_template_default = false; + public bool $from_template_default = false; /** * @var array @@ -180,25 +148,14 @@ final class MutableUnion implements TypeNode * True if the type was passed or returned by reference, or if the type refers to an object's * property or an item in an array. Note that this is not true for locally created references * that don't refer to properties or array items (see Context::$references_in_scope). - * - * @var bool */ - public $by_ref = false; + public bool $by_ref = false; - /** - * @var bool - */ - public $reference_free = false; + public bool $reference_free = false; - /** - * @var bool - */ - public $allow_mutations = true; + public bool $allow_mutations = true; - /** - * @var bool - */ - public $has_mutations = true; + public bool $has_mutations = true; /** * This is a cache of getId on non-exact mode @@ -214,12 +171,9 @@ final class MutableUnion implements TypeNode /** * @var array */ - public $parent_nodes = []; + public array $parent_nodes = []; - /** - * @var bool - */ - public $different = false; + public bool $different = false; /** @psalm-suppress PossiblyUnusedProperty */ public bool $propagate_parent_nodes = false; diff --git a/src/Psalm/Type/Union.php b/src/Psalm/Type/Union.php index cb0575674e0..1d0b7fd0748 100644 --- a/src/Psalm/Type/Union.php +++ b/src/Psalm/Type/Union.php @@ -54,119 +54,86 @@ final class Union implements TypeNode /** * Whether the type originated in a docblock - * - * @var bool */ - public $from_docblock = false; + public bool $from_docblock = false; /** * Whether the type originated from integer calculation - * - * @var bool */ - public $from_calculation = false; + public bool $from_calculation = false; /** * Whether the type originated from a property * * This helps turn isset($foo->bar) into a different sort of issue - * - * @var bool */ - public $from_property = false; + public bool $from_property = false; /** * Whether the type originated from *static* property * * Unlike non-static properties, static properties have no prescribed place * like __construct() to be initialized in - * - * @var bool */ - public $from_static_property = false; + public bool $from_static_property = false; /** * Whether the property that this type has been derived from has been initialized in a constructor - * - * @var bool */ - public $initialized = true; + public bool $initialized = true; /** * Which class the type was initialised in - * - * @var ?string */ - public $initialized_class; + public ?string $initialized_class = null; /** * Whether or not the type has been checked yet - * - * @var bool */ - public $checked = false; + public bool $checked = false; - /** - * @var bool - */ - public $failed_reconciliation = false; + public bool $failed_reconciliation = false; /** * Whether or not to ignore issues with possibly-null values - * - * @var bool */ - public $ignore_nullable_issues = false; + public bool $ignore_nullable_issues = false; /** * Whether or not to ignore issues with possibly-false values - * - * @var bool */ - public $ignore_falsable_issues = false; + public bool $ignore_falsable_issues = false; /** * Whether or not to ignore issues with isset on this type - * - * @var bool */ - public $ignore_isset = false; + public bool $ignore_isset = false; /** * Whether or not this variable is possibly undefined - * - * @var bool */ - public $possibly_undefined = false; + public bool $possibly_undefined = false; /** * Whether or not this variable is possibly undefined - * - * @var bool */ - public $possibly_undefined_from_try = false; + public bool $possibly_undefined_from_try = false; /** * whether this type had never set explicitly * since it's the bottom type, it's combined into everything else and lost - * - * @var bool */ - public $explicit_never = false; + public bool $explicit_never = false; /** * Whether or not this union had a template, since replaced - * - * @var bool */ - public $had_template = false; + public bool $had_template = false; /** * Whether or not this union comes from a template "as" default - * - * @var bool */ - public $from_template_default = false; + public bool $from_template_default = false; /** * @var array @@ -192,25 +159,14 @@ final class Union implements TypeNode * True if the type was passed or returned by reference, or if the type refers to an object's * property or an item in an array. Note that this is not true for locally created references * that don't refer to properties or array items (see Context::$references_in_scope). - * - * @var bool */ - public $by_ref = false; + public bool $by_ref = false; - /** - * @var bool - */ - public $reference_free = false; + public bool $reference_free = false; - /** - * @var bool - */ - public $allow_mutations = true; + public bool $allow_mutations = true; - /** - * @var bool - */ - public $has_mutations = true; + public bool $has_mutations = true; /** * This is a cache of getId on non-exact mode @@ -226,14 +182,11 @@ final class Union implements TypeNode /** * @var array */ - public $parent_nodes = []; + public array $parent_nodes = []; public bool $propagate_parent_nodes = false; - /** - * @var bool - */ - public $different = false; + public bool $different = false; /** * @param TProperties $properties From efb86f8866d060b1e8b23d9f1d9f9d84a2ea135e Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 13:37:36 +0200 Subject: [PATCH 35/38] cs-fix --- src/Psalm/Storage/Assertion/HasArrayKey.php | 5 +---- src/Psalm/Storage/Assertion/IsNotCountable.php | 5 +---- src/Psalm/Storage/Assertion/NonEmptyCountable.php | 5 +---- src/Psalm/Storage/PropertyStorage.php | 2 +- src/Psalm/Type/Atomic/TPropertiesOf.php | 2 +- src/Psalm/Type/Atomic/TTemplatePropertiesOf.php | 2 +- 6 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/Psalm/Storage/Assertion/HasArrayKey.php b/src/Psalm/Storage/Assertion/HasArrayKey.php index 7332480e460..1326f09510e 100644 --- a/src/Psalm/Storage/Assertion/HasArrayKey.php +++ b/src/Psalm/Storage/Assertion/HasArrayKey.php @@ -12,11 +12,8 @@ */ final class HasArrayKey extends Assertion { - public $key; - - public function __construct(string $key) + public function __construct(public readonly string $key) { - $this->key = $key; } public function getNegation(): Assertion diff --git a/src/Psalm/Storage/Assertion/IsNotCountable.php b/src/Psalm/Storage/Assertion/IsNotCountable.php index dd73fef7f24..5f11cf6df6b 100644 --- a/src/Psalm/Storage/Assertion/IsNotCountable.php +++ b/src/Psalm/Storage/Assertion/IsNotCountable.php @@ -11,11 +11,8 @@ */ final class IsNotCountable extends Assertion { - public $is_negatable; - - public function __construct(bool $is_negatable) + public function __construct(public readonly bool $is_negatable) { - $this->is_negatable = $is_negatable; } public function isNegation(): bool diff --git a/src/Psalm/Storage/Assertion/NonEmptyCountable.php b/src/Psalm/Storage/Assertion/NonEmptyCountable.php index b2b4f28806f..a36bffdd2a6 100644 --- a/src/Psalm/Storage/Assertion/NonEmptyCountable.php +++ b/src/Psalm/Storage/Assertion/NonEmptyCountable.php @@ -11,11 +11,8 @@ */ final class NonEmptyCountable extends Assertion { - public $is_negatable; - - public function __construct(bool $is_negatable) + public function __construct(public readonly bool $is_negatable) { - $this->is_negatable = $is_negatable; } public function getNegation(): Assertion diff --git a/src/Psalm/Storage/PropertyStorage.php b/src/Psalm/Storage/PropertyStorage.php index 73d373cc3da..3eb742c281e 100644 --- a/src/Psalm/Storage/PropertyStorage.php +++ b/src/Psalm/Storage/PropertyStorage.php @@ -17,7 +17,7 @@ final class PropertyStorage implements HasAttributesInterface /** * @var ClassLikeAnalyzer::VISIBILITY_* */ - public $visibility = ClassLikeAnalyzer::VISIBILITY_PUBLIC; + public int $visibility = ClassLikeAnalyzer::VISIBILITY_PUBLIC; public ?CodeLocation $location = null; diff --git a/src/Psalm/Type/Atomic/TPropertiesOf.php b/src/Psalm/Type/Atomic/TPropertiesOf.php index 89707bfc9c3..c5c4a92b6fe 100644 --- a/src/Psalm/Type/Atomic/TPropertiesOf.php +++ b/src/Psalm/Type/Atomic/TPropertiesOf.php @@ -26,7 +26,7 @@ final class TPropertiesOf extends Atomic /** * @var self::VISIBILITY_*|null */ - public $visibility_filter; + public ?int $visibility_filter; /** * @return list diff --git a/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php b/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php index e1e888f10f5..31f6ef3b3ec 100644 --- a/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php +++ b/src/Psalm/Type/Atomic/TTemplatePropertiesOf.php @@ -23,7 +23,7 @@ final class TTemplatePropertiesOf extends Atomic /** * @var TPropertiesOf::VISIBILITY_*|null */ - public $visibility_filter; + public ?int $visibility_filter; /** * @param TPropertiesOf::VISIBILITY_*|null $visibility_filter From 1988be41bf9346f90a85eb57c785b87ec4351f90 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 13:38:00 +0200 Subject: [PATCH 36/38] One more type --- src/Psalm/Report/ReportOptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/Report/ReportOptions.php b/src/Psalm/Report/ReportOptions.php index 38b9b190f7e..f6e335a47dc 100644 --- a/src/Psalm/Report/ReportOptions.php +++ b/src/Psalm/Report/ReportOptions.php @@ -17,7 +17,7 @@ final class ReportOptions /** * @var Report::TYPE_* */ - public $format = Report::TYPE_CONSOLE; + public string $format = Report::TYPE_CONSOLE; public bool $pretty = false; From 09a606cb93285ee6b53494c0ad8ed63230bd3d3c Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 13:40:45 +0200 Subject: [PATCH 37/38] Readonly --- src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php | 2 +- src/Psalm/Type/Union.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index bd01162b0bd..16ccc996926 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -94,7 +94,7 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer /** * @var TFunction */ - protected $function; + protected Closure|Function_|ClassMethod|ArrowFunction $function; protected Codebase $codebase; diff --git a/src/Psalm/Type/Union.php b/src/Psalm/Type/Union.php index 1d0b7fd0748..8e6c3b56cb4 100644 --- a/src/Psalm/Type/Union.php +++ b/src/Psalm/Type/Union.php @@ -47,10 +47,9 @@ final class Union implements TypeNode use UnionTrait; /** - * @psalm-readonly * @var non-empty-array */ - private array $types; + private readonly array $types; /** * Whether the type originated in a docblock From 2d43c1609d69e422d80e13f70d4f55b2d17271f3 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Oct 2023 13:45:36 +0200 Subject: [PATCH 38/38] Revert due to reset() in getSingleAtomic --- src/Psalm/Type/Union.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Type/Union.php b/src/Psalm/Type/Union.php index 8e6c3b56cb4..1d0b7fd0748 100644 --- a/src/Psalm/Type/Union.php +++ b/src/Psalm/Type/Union.php @@ -47,9 +47,10 @@ final class Union implements TypeNode use UnionTrait; /** + * @psalm-readonly * @var non-empty-array */ - private readonly array $types; + private array $types; /** * Whether the type originated in a docblock