Closed EvgenyOrekhov closed 6 years ago
@EvgenyOrekhov Can you try dev-master?
@kukulich I will try it on Monday.
@kukulich Got the same error on dev-master:
.............E................E..................E..... Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 2147483656 bytes) in /app/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/EarlyExitSniff.php on line 488
Slevomat Coding Standard version: 2b5a5a2
@EvgenyOrekhov Ok. Please try verbose modes for PHPCS to detect the file and please post the file here. I'm not able to fix it without the code.
@kukulich Here you go:
<?php if ($a): ?>
true
<?php else: ?>
false
<?php endif; ?>
<?php else: ?>
is the cause of the infinite loop.
@EvgenyOrekhov This doesn't look like a file you should check with PHPCS...
@kukulich I reduced the original file to the simplest case that generates the error. The original file is a "view" file that contains HTML and PHP. PHP_CodeSniffer's built-in sniffers are perfectly capable of analyzing this kind of files.
Ok but I don't want to support view files. I don't see any benefit. So I'm sorry but I'll not fix this.
@kukulich I checked the following code:
<?php
class Example
{
public function f($a)
{
if ($a):
return 'true';
else:
return 'false';
endif;
}
}
It's not a view, but It also generates the out of memory error because of else:
.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
https://github.com/slevomat/coding-standard/blob/1e609159241fa90d5a429f185b2ea9b881340a7c/SlevomatCodingStandard/Sniffs/ControlStructures/EarlyExitSniff.php#L476
I don't know how to make PHP_CodeSniffer tell me the name of the file that trips up the sniffer.
Slevomat Coding Standard version: 4.5.2 PHP version: 7.2.3