31
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-05-28 19:30:48 +00:00
This commit is contained in:
Denis Ryabov 2021-11-16 20:00:36 +03:00
parent fa3ba35933
commit d6e0dbc7d9

View File

@ -116,7 +116,7 @@ class JedcheckerRulesJexec extends JEDcheckerRule
$content = preg_replace('/^\xEF\xBB\xBF/', '', $content);
// Skip empty files
if ($content === '' || preg_match('#^<\?php\s+$#', $content))
if ($content === '' || preg_match('#^\s*<\?php\s+$#', $content))
{
return true;
}
@ -147,7 +147,7 @@ class JedcheckerRulesJexec extends JEDcheckerRule
}
$this->regex
= '#^' // at the beginning of the file
= '#^\s*' // at the beginning of the file
. '<\?php\s+' // there is an opening php tag
. '(?:declare ?\(strict_types ?= ?1 ?\) ?; ?)?' // optionally followed by declare(strict_types=1) directive
. '(?:namespace [0-9A-Za-z_\\\\]+ ?; ?)?' // optionally followed by namespace directive