From 799af36bb2e4c33060543516e345392df4017df5 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 17 Feb 2025 18:15:17 +0000 Subject: [PATCH] Hide a couple of parameters from stack traces When something goes wrong, the stack trace contains ~10,000 lines of spam, often repeated several times over, which makes it hard to find the actual error --- generator/src/Commands/GenerateCommand.php | 9 ++++++--- generator/src/Generator/FileCreator.php | 9 +++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/generator/src/Commands/GenerateCommand.php b/generator/src/Commands/GenerateCommand.php index f9bf4232..2b9adc4c 100644 --- a/generator/src/Commands/GenerateCommand.php +++ b/generator/src/Commands/GenerateCommand.php @@ -25,9 +25,12 @@ protected function configure(): void ; } - protected function execute(InputInterface $input, OutputInterface $output): int - { - + protected function execute( + // These aren't actually sensitive, they just fill the + // stack traces with tons of useless information. + #[\SensitiveParameter] InputInterface $input, + #[\SensitiveParameter] OutputInterface $output + ): int { $this->rmGenerated(); // Let's build the DTD necessary to load the XML files. diff --git a/generator/src/Generator/FileCreator.php b/generator/src/Generator/FileCreator.php index 9df9a3af..92c45822 100644 --- a/generator/src/Generator/FileCreator.php +++ b/generator/src/Generator/FileCreator.php @@ -19,8 +19,13 @@ class FileCreator * @param Method[] $functions * @param Method[] $missingFunctions */ - public function generatePhpFile(array $functions, array $missingFunctions, string $path): void - { + public function generatePhpFile( + // These aren't actually sensitive, they just fill the + // stack traces with tons of useless information. + #[\SensitiveParameter] array $functions, + #[\SensitiveParameter] array $missingFunctions, + string $path + ): void { $path = rtrim($path, '/').'/'; $phpFunctionsByModule = []; foreach ($functions as $function) {