Closed bloodangel78 closed 9 years ago
@bloodangel78 , you've missed to put actual error message in task description. Also include the file being analyzed and the used coding standard.
Clicking on URL above shows "Forbidden" error message.
Oupps sorry.
Here is it:
PHP Code Sniffer phpcs: PHP Notice: Undefined offset: 0 in /usr/share/php/PHP/CodeSniffer/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php on line 420 PHP Notice: Undefined offset: 0 in /usr/share/php/PHP/CodeSniffer/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php on line 459 PHP Notice: Undefined offset: 0 in /usr/share/php/PHP/CodeSniffer/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php on line 462 PHP Notice: Undefined offset: 0 in /usr/share/php/PHP/CodeSniffer/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php on line 459
I have temporally fixed it to modify the line in the ScopeIndentSniff.php:
private $_openTagIndents = array('0' => 0);
ps: It was not an array before, just a variable init to 0
Try to arrange some reproducible code piece that can be used to debug a problem. Code piece will consist of:
So I can respond for the file checked:
For the two other questions, sorry but i dont know what you want (can you explain how get it?).
ps: I have installed the code sniffer like this:
sudo apt-get install php-pear sudo pear install PHP_CodeSniffer sudo pear channel-discover pear-channel.vitry.intranet sudo pear install smile/PHPCS_Standards
Then for PHPStorm:
File - Settings - PHP - Code Sniffer - PHP code sniffer path: /usr/bin/phpcs Inspections - PHP - PHP Code sniffer validation Options: Severity: Warning => Then refresh the "coding standard" and choose "Magento"
One more thing: put file on gist and put link instead of contents of a file, because right now parts of file are interpreted as github flavored markdown.
Yes sorry not see that the render is not good
Here it is ;) : http://www.partage-facile.com/TZEL87SMYY/test.php.html
Gist please. There is dedicated service on GitHub for code sharing: https://gist.github.com/
Ok sorry i'm new, i weas thinking it was only svn/git.
Here it is => https://gist.github.com/bloodangel78/
sudo pear channel-discover pear-channel.vitry.intranet
This appears to be adding channel from your private network. Is there any way to get these standards via GitHub/Packagist for example?
I send you the file that extends your class
I say you tommorrow for the internal network page
Yes, that file helped a lot. Thanks. I've put sniff in question on this gist: https://gist.github.com/aik099/35be63200004818cba09
What's interesting there is that Magento_Sniffs_WhiteSpace_ScopeIndentSniff
sniff extends Generic_Sniffs_WhiteSpace_ScopeIndentSniff
, however it doesn't call that parent::process(...)
within extended process
method. I bet it's doing so to be able to perform indentation check using methods from parent class in different way.
This makes me thinking, that sniff itself (the Magento_Sniffs_WhiteSpace_ScopeIndentSniff
) might be using parent class method in wrong way. Maybe originally it was ok to do so, but due evolution of parent class this started to create problems.
So if i have understand we just need to fix our process method in "Magento_Sniffs_WhiteSpace_ScopeIndentSniff" class?
So if i have understand we just need to fix our process method in "Magento_Sniffs_WhiteSpace_ScopeIndentSniff" class?
I believe so. Just inspect parent class process
method to see what and how it does and compare it to ways how it's done in parent class. I would start by placing breakpoint in place that causes notices to happen and see what leads you there.
I'm not sure how you'll debug file included via PEAR, but I bet there is some way.
P.S. You can remove temporary comment part now. Whoever is subscribed to receive comment notifications from this repo will get your shared link anyway. That's such things better to be shared via direct e-mail, not publicly.
Thank for your help i will see this tommorrow but yes its like our "Magento_Sniffs_WhiteSpace_ScopeIndentSniff" dont use an array as you have change int to array.
@aik099 Thanks for helping with this. Doesn't appear to be a core issue here.
One warning: ScopeIndentSniff has been rewritten in the 2.0.0RC3 release, so it is worth taking a look at the changes there as well.
Hi, I use a Magento CodeSniffer extending your. => xxxxx
Here are the error I have in PHPStorm when using it. Can you fix your document to check if the key exist in the array?
Cordially.