Basic cleanup of the existing PHP code, apply current best practices. There is a lot of very ugly code, esp. callbacks like [ $obj, 'method' ], as well as a dynamically created attribute stuffed in the Parser! At least make sure each issue is local, in as few places as possible.
Limit scope of cleanup to the code we probably need to touch.
Original estimation: 8