Zend certified PHP/Magento developer

di compile error after upgrading from 2.4.5-p4 to 2.4-5-p5

I recently upgraded a Magento instance from version 2.4.5-p4 to 2.4.5-p5 . Its running on PHP 7.4.9 . Its a AWS/bitnami instance.

The upgrade seems succesful (no errors shown in front end or admin, when the version is checked it show 2.4.5-p5 .

However, the setup:di:compile command gets interrupted with following errors.

syntax error, unexpected '|', expecting ';' or '{'#0 /opt/bitnami/magento/vendor                                                                             /composer/ClassLoader.php(428): ComposerAutoload{closure}()
#1 [internal function]: ComposerAutoloadClassLoader->loadClass()
#2 [internal function]: spl_autoload_call()
#3 /opt/bitnami/magento/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesSca                                                                             nner.php(134): class_exists()
#4 /opt/bitnami/magento/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesSca                                                                             nner.php(117): MagentoSetupModuleDiCodeReaderClassesScanner->includeClass(                                                                             )
#5 /opt/bitnami/magento/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesSca                                                                             nner.php(87): MagentoSetupModuleDiCodeReaderClassesScanner->extract()
#6 /opt/bitnami/magento/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Rep                                                                             ositoryGenerator.php(61): MagentoSetupModuleDiCodeReaderClassesScanner->ge                                                                             tList()
#7 /opt/bitnami/magento/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(5                                                                             6): MagentoSetupModuleDiAppTaskOperationRepositoryGenerator->doOperation(                                                                             )
#8 /opt/bitnami/magento/setup/src/Magento/Setup/Console/Command/DiCompileCommand                                                                             .php(216): MagentoSetupModuleDiAppTaskManager->process()
#9 /opt/bitnami/magento/vendor/symfony/console/Command/Command.php(255): Magento                                                                             SetupConsoleCommandDiCompileCommand->execute()
#10 /opt/bitnami/magento/vendor/symfony/console/Application.php(1021): SymfonyC                                                                             omponentConsoleCommandCommand->run()
#11 /opt/bitnami/magento/vendor/symfony/console/Application.php(275): SymfonyCo                                                                             mponentConsoleApplication->doRunCommand()
#12 /opt/bitnami/magento/vendor/magento/framework/Console/Cli.php(116): Symfony                                                                             ComponentConsoleApplication->doRun()
#13 /opt/bitnami/magento/vendor/symfony/console/Application.php(149): MagentoFr                                                                             ameworkConsoleCli->doRun()
#14 /opt/bitnami/magento/bin/magento(23): SymfonyComponentConsoleApplication-                                                                             >run()
#15 {main}

By putting a echo in composer/ClassLoader.php error location, I found that this error is occuring when /opt/bitnami/magento/vendor/composer/../paypal/module-braintree-core/Gateway/Com mand/GetPaymentNonceCommand.php is processed.

If you have encountered same or a similar issue, I do highly appreciate if you could please guide me to resolve it.

Thanks and Best Regards

Indunil