I had some spare time over the weekend so I decided to hack together a little Magento QA tool. The tool will have some added benefit in months / weeks to come with the release of a new service that might becoming available.
Currently all the tool does is to look at a path or file and will generate the output for all the Magento rewrites the module(2) have. Why such a tool I head you ask ? Well rewrites in Magento 1 should be a last resort. Where possible you should always look to use the Event Observer system to add extra functionality.
The problem with rewrites is that they are so simple to use, Yet if you are rewriting the same class more than once you end up in inheritance hell. A class can only be rewrote a single time and when Magento compiles the config.xml it becomes a first come first served competition that can lead to un expected side effects. Ive had to do this where I either fudge in some PHP check to see if a class exists and then extend another class in PHP. Or I have to rewrite another class in XML causing reall maintinance issues.
So the link to the script can be found here Once I add some more features to it I will push as a composer package so that I can be used as a project dev dependency and ran as part of the project build process.
For more information on what the script does, Just take a look at the features directory. All the scenarios are covered using Behat.
An alternative to using this script would be to use the N98-MageRun tool with
dev:rewrite:conflict currently this is more advanced than mine but does not support different output modes that I am looking to support. Mainly
for Jenkins / Travis build support.
You may also find these related posts interesting: Developer Book Club All hail Xdebug and lets let var dump die A new look and a cleanup of content plus good bye github pages. Docker and Docker Sync