mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-11-12 00:06:27 +00:00
Allow declare/namespace/use statements before the JEXEC guard
This commit is contained in:
parent
1a201318c6
commit
edf06dc135
@ -122,6 +122,9 @@ class JedcheckerRulesJexec extends JEDcheckerRule
|
|||||||
$this->regex
|
$this->regex
|
||||||
= '#^' // at the beginning of the file
|
= '#^' // at the beginning of the file
|
||||||
. '<\?php\s+' // there is an opening php tag
|
. '<\?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
|
||||||
|
. '(?:use [0-9A-Za-z_\\\\]+ ?(?:as [0-9A-Za-z_]+ ?)?; ?)*' // optionally followed by use directives
|
||||||
. 'defined ?\( ?' // followed by defined test
|
. 'defined ?\( ?' // followed by defined test
|
||||||
. '([\'"])(?:' . implode('|', $defines) . ')\1' // of any of given constant
|
. '([\'"])(?:' . implode('|', $defines) . ')\1' // of any of given constant
|
||||||
. ' ?\) ?(?:or |\|\| ?)(?:die|exit)\b' // or exit
|
. ' ?\) ?(?:or |\|\| ?)(?:die|exit)\b' // or exit
|
||||||
|
Loading…
Reference in New Issue
Block a user