How to solve error of repeated functions in common file of scheduled tasks?

It’s not clear to me how I produced this behavior. But every time I repair a suitecrm instance two functions with the same name are created in the public/legacy/custom/modules/Schedulers/Ext/ScheduledTasks/scheduledtasks.ext.php file. This makes the management of scheduled tasks impossible. The manual solution that I do is to edit the file and delete one of them. After that I can manage the scheduled tasks and continue.

What is the correct way to resolve this behaviour?

Thanks in advance

You can do a “find-in-files” search of your entire directory to find the two original places that SuiteCRM is finding your function in. And then remove one.

Go to your main SuiteCRM directory and run:
grep -irn MyFunctionName .

If you really need a solution in PHP, you can wrap your function in an if like this: