Repository navigation
Conversation
…in their library stubs
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
@psalm-capabilities(and@psalm-pureon the static level helpers) to the methods of the library stubs for monolog/monolog and to a new library stub for psr/log, so that code with declared capabilities can build a logging setup and log:stubs/libraries/monolog/monolog.phpstub(monolog/monolog 3):Logger(gettersread-props, settersread-props|write-this-props, logging,close()andreset()every capability butwrite-refs,getLevelName()/toMonologLevel()pure), the constructors and setters ofAbstractHandler,StreamHandler,SocketHandler,ErrorLogHandler,GroupHandler,NormalizerFormatter,LineFormatter,JsonFormatterandWebProcessor, andFormattableHandlerInterface/FormattableHandlerTrait. The reasons for each set are in the stub's header. The file and SSRF sinks of theStreamHandlerandSocketHandlerconstructors stay.stubs/libraries/psr/log.phpstub: the methods ofLoggerInterface, every capability butwrite-refs. Its signatures are those of psr/log 2, without the nativevoidreturn types psr/log 3 adds (@return voidinstead), so that loggers written against psr/log 1 and 2 don't getMethodSignatureMustProvideReturnTypeonce the stub makes the interface a stubbed one.The declared methods keep the signatures and docblocks of monolog/monolog 3.10, since a stub's declaration replaces the method's.
LibraryStubsTestCasecan now list other issue types than the taint ones (getReportedIssueTypePrefixes());MonologLibraryStubsTestgets cases for the capabilities ofLogger,LoggerInterfaceand a handler setup.