- Make sure you have version control. So easy to do these days, so often forgotten.
- don't think that the steps above must be done in order, right now.
- dkarlovi mentions tests. Start with 1.) smoke tests like simple selenium tests or something like that. You'll find lots of vate towards it if you look and I admit it has issues but for simple projects like this that doesn't change much it should be fine. Of course of you find something better use that.
- one of the most important things about a good IDE is being able to refactor confidently so you can rename variables to something reasonable as you figure out what they really are.
- the book "refactoring legacy code" might be the best programming book I've read.
"Working Effectively with Legacy Code" is the name. The author is Michael C. Feathers I think.
My basic procedure when inheriting legacy code is:
- Load the project in phpstorm
- Perform autoformatting so it becomes readable
- Run code inspection to find any obvious issues the original author missed
- Write tests in phpstorm, if not already exists
- Run the code with xdebug, step through it
Adding tests for an app with no documentation requires a lot of effort.
code tests yes. Assuming it's a web app, probably not too hard. Get something that records the browser interactions, and do the common tasks people do (log in, click links, make a report, etc). Having general things like that automated to ensure you can run them repeatedly to make sure basic stuff didn't break unexpectedly will help provide some confidence when making changes.
1. Definitely get a PHP IDE: https://www.jetbrains.com/phpstorm/
2. Get a step debugger and hook it in: https://xdebug.org/
3. Fix the code style: https://github.com/FriendsOfPHP/PHP-CS-Fixer
4. Run the code through some static analysis tools https://phpstan.org/ https://psalm.dev/
5. Upgrade the code with an AST fixer (might help you update to newer PHP version): https://github.com/rectorphp/rector
6. Add tests to it: https://phpunit.de/
7. Run mutation tests: https://infection.github.io/
The "0 budget" is rough, though.