PHP 5.3到PHP7 - 未定义的类常量'self :: MYCONST'

I have a project running on PHP 5.3.21 that I am trying to migrate to PHP 7.0. The project uses a lot the structure as in the example below:

<?php
class foo {
    protected $_const = self::MYCONST;
}

class boo extends foo {
    const MYCONST = "test";

    public function __construct() {
        echo $this->_const.PHP_EOL;
    }
}
new boo();

The expected result is printing "test", and it works perfectly on 5.3, but on 7.0 I get

PHP Fatal error: Uncaught Error: Undefined class constant 'self::MYCONST'

Any help will be highly appreciated

Try to transfer the constants to the parent classes in your project