phpcheckstyle
phpcheckstyle copied to clipboard
Read string as well as a file
Currently PHPCheckstyle is only able to check the style guides against files and not a string itself.
Rather than messing with processFiles, I'm thinking of adding just process as a method itself. This gives the end-developer much more flexibility.
I like the idea, to be able to process any given string would be cool.
We will need to cleanup a few things I think. The "processFiles" method set up some variables and flags (current file name, ...). We can check if we have consistent defaut values for these flags, and when possible eliminate or move all these variables.
When I was looking at doing this, I realised that processFiles does too much in one method:
- Setup error handlers
- Grab the sources
- Begin counting lines
- Process each file
- Clean up
We could split out some methods so that they can be re-used by a process method.
Agree, there is some cleanup to do.
I started looking at this, but quickly realised that there are a lot of changes required.
Tokenizer@tokenizetakes a file name for example.PHPCheckstyle@processFilescalls_processFilewhich assume it's a file.
This requires a big rewrite of the core methods.