S
S
Sergey Rogozhkin2012-11-09 11:19:56
PHP
Sergey Rogozhkin, 2012-11-09 11:19:56

PHP to PHP parsing and code generation

Dear colleagues!

Brief background of the question: you need to modify more than a thousand php files with classes, add methods, add / change some method modifiers according to clear rules. All in order to change the coding standard.

I am looking for a way to automate the process, because standard means of refactoring is very long and painful.

Attention, question.

Please tell me the library / way to parse files with php classes and present it all in the form of a meaningful structure with a list of methods. To then make changes and generate / write files back.

Thanks in advance for any insights.

PS/ working hypothesis: partially use the phpDocumentor code; but suddenly who met specialized solutions/libraries; I want to quit everything and write my bike, I'm holding back with all my might :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vyacheslav Plisko, 2012-11-09
@thecoder

There is a built-in tokenizer php.net/manual/ru/book.tokenizer.php
There is a generator and a reflection in the Zend Framework
But there is also a ready-made style fixer github.com/fabpot/PHP-CS-Fixer

P
plaha, 2012-11-09
@plaha

reflection API?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question