title: PHP7 - Uncaught Error: Access to undeclared static property
body: <p>I've been attempting to play with this dicecalculator found here: 
  <a href="https://github.com/ringmaster/dicecalc" rel="noreferrer">https://github.com/ringmaster/dicecalc</a></p>
  
  <p>Previously everything functioned as expected, I could "roll" 3d6, 3d6+2, 1d12, etc without any problems.</p>
  
  <p>After upgrading my vps to Ubuntu 16.04 with php7 on it, I started to receive the following error:</p>
  
  <blockquote>
    <p>mod_fcgid: stderr: PHP Fatal error:  Uncaught Error: Access to undeclared static property: DiceCalc\CalcOperation::$operators in /public_html/dice/src/DiceCalc/CalcOperation.php:34</p>
  </blockquote>
  
  <p>I've done a few searches on <em>Access to undeclared static property</em> to no avail. I've tried returning static:: on each of them. Here's the CalcOperation.php it's referencing: </p>
  
  <pre><code>&lt;?php
  /**
   * Class CalcOperation
   *
   * @package DiceCalc
   * @author  Owen Winkler &lt;epithet@gmail.com&gt;
   * @license MIT http://opensource.org/licenses/MIT
   */
  namespace DiceCalc;
  class CalcOperation {
      /**
       * @param  string $operator
       * @param $operand2
       * @param $operand1
       *
       * @throws \Exception
       * @return bool|number
       */
      public function calc($operator, $operand1, $operand2) {
          $operators = array(
              '+' =&gt; 'add',
              '*' =&gt; 'multiply',
              '=' =&gt; 'equalto',
              '&lt;' =&gt; 'lessthan',
              '&gt;' =&gt; 'greaterthan',
              '^' =&gt; 'exponent',
              '/' =&gt; 'divide',
              '-' =&gt; 'subtract'
          );
          if (isset($operators[$operator])) {
              return self::$operators[$operator](self::reduce($operand1), self::reduce($operand2));
          }
          throw new \Exception('Unknown operator "' . $operator . '".');
      }
      /**
       * @param $operand
       *
       * @return number|string
       * @throws \Exception
       */
      public function reduce($operand) {
          if (is_numeric($operand)) {
              return $operand;
          } elseif ($operand instanceof Calc) {
              return $operand();
          }
          throw new \Exception('This is not a number');
      }
      /**
       * @param  number      $operand1
       * @param  number      $operand2
       *
       * @return bool|number
       */
      public function add($operand1, $operand2) {
          return $operand1 + $operand2;
      }
      /**
       * @param  number      $operand1
       * @param  number      $operand2
       *
       * @return bool|number
       */
      public function multiply($operand1, $operand2) {
          return $operand1 * $operand2;
      }
      /**
       * @param  number      $operand1
       * @param  number      $operand2
       *
       * @return bool|number
       */
      public function subtract($operand1, $operand2) {
          return $operand1 - $operand2;
      }
      /**
       * @param  number    $operand1
       * @param  number    $operand2
       *
       * @return bool|number
       */
      public function divide($operand1, $operand2) {
          return $operand1 / $operand2;
      }
      /**
       * @param  number      $operand1
       * @param  number      $operand2
       *
       * @return bool|number
       */
      public function exponent($operand1, $operand2) {
          return pow($operand1, $operand2);
      }
      /**
       * @param  number $operand1
       * @param  number $operand2
       *
       * @return bool
       */
      public function greaterthan($operand1, $operand2) {
          return $operand1 &gt; $operand2;
      }
      /**
       * @param  number $operand1
       * @param  number $operand2
       *
       * @return bool
       */
      public function lessthan($operand1, $operand2) {
          return ($operand1 &lt; $operand2);
      }
      /**
       * @param  number $operand1
       * @param  number $operand2
       *
       * @return bool
       */
      public function equalto($operand1, $operand2) {
          return ($operand1 == $operand2);
      }
  }
  </code></pre>
  
  <p>And here's the line that calls the class:</p>
  
  <pre><code>$stack[] = CalcOperation::calc($step, $r2, $r1);
  </code></pre>
  
  <p>I'm just beginning to wrap my head around classes etc so I'm not sure how to fix this. I've tried switching the return self:: to return static:: among a few other things I've found by searching on here. I'm just stuck now. Anyone able to help?</p>