0

I get this message with PHP Code Sniffer:

Expected "if (...)\n"; found "if (...)"

My code:

<?php if ($user->authorise('core.admin')): ?> <li><a href="<?php echo $this->baseurl; ?>/index.php?option=com_affiliates&amp;view=config"><?php echo JText::_('COM_AFFILIATES_LINK_GLOBAL_CONFIG'); ?></a></li> <?php endif; ?>

hakre
  • 193,403
  • 52
  • 435
  • 836
Bruno Batista
  • 223
  • 3
  • 11

1 Answers1

1

I assume you are using the Joomla code style sniffs. Are you using the sniff for the CMS or the one for the platform? In the platform you never use the if (..): .... endif; code style, but it is the preferred style for layouts (in the CMS). So I am pretty sure you should not be getting an error if you have the below and are using the CMS style checker. You should certainly have *nix style line endings as shown

<?php if ($user->authorise('core.admin')): ?> 
<li><a href="<?php echo $this->baseurl; ?>/index.php?option=com_affiliates&amp;view=config"><?php echo JText::_('COM_AFFILIATES_LINK_GLOBAL_CONFIG'); ?></a></li> 
<?php endif; ?>
Elin
  • 6,507
  • 3
  • 25
  • 47