title: How do I fix a fatal error: cannot redeclare class that's only on Macintosh?
body: <p>I get this fatal error only when I run on a Macintosh, but not on a windows browser, which doesn't make sense since, other than checking for the Browser condition, the conditional loops run the same code:</p>
  
  <p>Can someone help me understand how to stop this error in php? The error occurs on the FIRST instance of QEnterKeyEvent...and NOT the second.  This doesn't make sense.</p>
  
  <p>In the code, the first instance is the first time it is ever called, so the class has not yet been created as far as I can tell.</p>
  
  <p>Yet the error says: cannot redeclare class QEnterKeyEvent</p>
  
  <pre><code>// Key-Specific Events (EnterKey, EscapeKey, UpArrowKey, DownArrowKey, etc.)
  
  if (QApplication::IsBrowser(QBrowserType::Macintosh)) {
      echo "keyspecific events - macintosh";
  
      class QEnterKeyEvent extends QKeyPressEvent {
          protected $strCondition = 'event.keyCode == 13';
      }
      class QEscapeKeyEvent extends QKeyPressEvent {
          protected $strCondition = 'event.keyCode == 27';
      }
      class QUpArrowKeyEvent extends QKeyPressEvent {
          protected $strCondition = 'event.keyCode == 38';
      }
      class QDownArrowKeyEvent extends QKeyPressEvent {
          protected $strCondition = 'event.keyCode == 40';
      }
  } else {
      echo "key specific events - windows";
  
      class QEnterKeyEvent extends QKeyDownEvent {
          protected $strCondition = 'event.keyCode == 13';
      }
      class QEscapeKeyEvent extends QKeyDownEvent {
          protected $strCondition = 'event.keyCode == 27';
      }
      class QUpArrowKeyEvent extends QKeyDownEvent {
          protected $strCondition = 'event.keyCode == 38';
      }
      class QDownArrowKeyEvent extends QKeyDownEvent {
          protected $strCondition = 'event.keyCode == 40';
      }
  }
  </code></pre>