diff options
author | jld3103 <jld3103yt@gmail.com> | 2023-03-24 12:55:47 +0100 |
---|---|---|
committer | jld3103 <jld3103yt@gmail.com> | 2023-04-05 07:07:53 +0200 |
commit | 14283001a5894ca1816069aa53387fb08cccc43b (patch) | |
tree | 7395ae92ee8a234a69d1c725c45b9504612efb94 /build/psalm | |
parent | 746a1e9922ccbbd3756934eb3d20c03ca0ebdbe8 (diff) | |
download | nextcloud-server-14283001a5894ca1816069aa53387fb08cccc43b.tar.gz nextcloud-server-14283001a5894ca1816069aa53387fb08cccc43b.zip |
Update AppFrameworkTainter to use non-deprecated interface
Signed-off-by: jld3103 <jld3103yt@gmail.com>
Diffstat (limited to 'build/psalm')
-rw-r--r-- | build/psalm/AppFrameworkTainter.php | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/build/psalm/AppFrameworkTainter.php b/build/psalm/AppFrameworkTainter.php index c12dcfc6ce2..15023da8d58 100644 --- a/build/psalm/AppFrameworkTainter.php +++ b/build/psalm/AppFrameworkTainter.php @@ -23,31 +23,26 @@ * SOFTWARE. */ use Psalm\CodeLocation; -use Psalm\Plugin\Hook\AfterFunctionLikeAnalysisInterface; +use Psalm\Plugin\EventHandler\AfterFunctionLikeAnalysisInterface; +use Psalm\Plugin\EventHandler\Event\AfterFunctionLikeAnalysisEvent; use Psalm\Type\TaintKindGroup; class AppFrameworkTainter implements AfterFunctionLikeAnalysisInterface { - public static function afterStatementAnalysis( - PhpParser\Node\FunctionLike $stmt, - Psalm\Storage\FunctionLikeStorage $classlike_storage, - Psalm\StatementsSource $statements_source, - Psalm\Codebase $codebase, - array &$file_replacements = [] - ): ?bool { - if ($statements_source->getFQCLN() !== null) { - if ($codebase->classExtendsOrImplements($statements_source->getFQCLN(), \OCP\AppFramework\Controller::class)) { - if ($stmt instanceof PhpParser\Node\Stmt\ClassMethod) { - if ($stmt->isPublic() && !$stmt->isMagic()) { - foreach ($stmt->params as $i => $param) { + public static function afterStatementAnalysis(AfterFunctionLikeAnalysisEvent $event): ?bool { + if ($event->getStatementsSource()->getFQCLN() !== null) { + if ($event->getCodebase()->classExtendsOrImplements($event->getStatementsSource()->getFQCLN(), \OCP\AppFramework\Controller::class)) { + if ($event->getStmt() instanceof PhpParser\Node\Stmt\ClassMethod) { + if ($event->getStmt()->isPublic() && !$event->getStmt()->isMagic()) { + foreach ($event->getStmt()->params as $i => $param) { $expr_type = new Psalm\Type\Union([new Psalm\Type\Atomic\TString()]); - $expr_identifier = (strtolower($statements_source->getFQCLN()) . '::' . strtolower($classlike_storage->cased_name) . '#' . ($i + 1)); + $expr_identifier = (strtolower($event->getStatementsSource()->getFQCLN()) . '::' . strtolower($event->getFunctionlikeStorage()->cased_name) . '#' . ($i + 1)); if ($expr_type) { - $codebase->addTaintSource( + $event->getCodebase()->addTaintSource( $expr_type, $expr_identifier, TaintKindGroup::ALL_INPUT, - new CodeLocation($statements_source, $param) + new CodeLocation($event->getStatementsSource(), $param) ); } } |