Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanContent obliterates entire classes when it mistakes a quote inside a comment for the start of a string #7

Open
ExplodingCabbage opened this issue Aug 12, 2016 · 1 comment

Comments

@ExplodingCabbage
Copy link
Contributor

Calling cleanContent on this file...

<?php namespace Foo;

// By the gods' wounds, this was an annoying bug!
class Bla {
  public function helloWorld() {
    return 'hello world';
  }
}

will result in this:

<?php namespace Foo;


  }
}

and as a result parseFileWithRegexForDefinedEntities will later fail to find the Foo class.

I'd be happy to apply some regex wizardry to find a way to clean this up, but it's very difficult to do so at the moment because cleanContent is completely undocumented and I dunno for sure what stuff it's supposed to be removing from the file content.

@bashofmann
Copy link
Contributor

The cleanContent implementation is extremely hacky, the plan was always to replace it with using a proper PHP AST Parser (e.g. https://github.com/nikic/PHP-Parser) completely.
Since this a bit of a larger project and the current hacky and buggy solution is good enough for our use-case this did not have a huge priority so far unfortunately. I also can't give you an estimate when we will get around to do it, but feel free to chip in there :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants