Closed paweltatarczuk closed 7 years ago
@trawiasty thank you so much for your contribution!
I have a few comments to this pull request:
When I configure PHP_CodeSniffer by adding path to Magento 2 instance and run tests
vendor/bin/phpunit vendor/squizlabs/php_codesniffer/tests/AllTests.php
I get following error:
Fatal error: Class 'PHP_CodeSniffer' not found in MEQP/Utils/Helper.php on line 76
It should be replaced with PHP_CodeSniffer\Config
class.
Lines MEQP2/Sniffs/SQL/CoreTablesModificationSniff.php:184
and MEQP2/Sniffs/SQL/CoreTablesModificationSniff.php:187
will also lead to an error.
I've updated my fork with an amended commit - it should fix both issues reported in @lenaorobei review.
I hope that amending a commit does not break antything here, if I should've sent a new commit with fixes I can reset master
to originally reviewed commit and push changes with a new one. I'm not familiar with review workflow at github.
@trawiasty there is one small issue in MEQP2/Sniffs/SQL/CoreTablesModificationSniff.php:185
$tokenizer = new Tokenizer($content, $sourceFile->config, $eolChar);
$sourceFile
is undefined variable here. When I change to $tokenizer = new Tokenizer($content, null, $eolChar);
it works as expected.
About amending commit I don't see any issue here, so I think you don't need any additional actions only this small fix in CoreTablesModificationSniff.php
.
Oh I see, I meant to use $sourceFile
from process()
method, stupid mistake. Do you think it's better to pass null
there or should I fix missing $sourceFile
instead? If we pass null
then some logic in PHP_CodeSniffer\Tokenizers\Tokenizer
constructor is skipped. I'm not sure if that's desired behavior.
We don't need additional configuration to parse requested files and find core tables names. So, if we pass null
it works as expected.
@trawiasty, great! Thank you!
@lenaorobei Thank you for the help here!