martin-helmich / typo3-typoscript-lint

Find coding errors in your TypoScript files.
MIT License
82 stars 19 forks source link

Negative indentation level in TypoScript with condition #88

Closed saitho closed 4 years ago

saitho commented 4 years ago

I noticed a PHP warning when the sniffer was processing one of my files. The file is structured like that:

plugin.tx_solr {
  # ...
}
[extensionLoaded("persons")]
plugin.tx_solr {
  #...
}
[end]

Error is the following, caused by a negative indentation level:

PHP Warning:  str_repeat(): Second argument has to be greater than or equal to 0 in /home/saitho/Workspace/t3-extension/vendor/helmich/typo3-typoscript-lint/src/Linter/Sniff/IndentationSniff.php on line 72
martin-helmich commented 4 years ago

Thanks for the report. Does this issue occur on the latest released version (in which case it might be a duplicate of #79) or also on master (in acknowledgement of #87 that master might also be broken)?

saitho commented 4 years ago

Only tested the latest release. Might be a duplicate, will check master.

martin-helmich commented 4 years ago

I've added an extra test case for this issue in 8fa7bd8 -- doesn't look like it still occurs on master.