Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax error using static as type hint #31

Open
MaryVictoria opened this issue Jan 29, 2016 · 3 comments
Open

Syntax error using static as type hint #31

MaryVictoria opened this issue Jan 29, 2016 · 3 comments

Comments

@MaryVictoria
Copy link

PocketMine-MP Crash Dump Fri Jan 29 04:53:43 UTC 2016

Error: syntax error, unexpected 'static' (T_STATIC), expecting variable (T_VARIABLE)
File: /PocketFactions_Dev.phar/src/pocketfactions/utils/ModelledEnum
Line: 27
Type: E_PARSE

THIS CRASH WAS CAUSED BY A PLUGIN

Code:
[18] abstract class ModelledEnum{
[19]    /** @var static[] */
[20]    private static $pool = [];
[21] 
[22]    /** @var int */
[23]    private $id;
[24]    /** @var string */
[25]    private $name;
[26] 
[27]    protected static function addEnumEntry(static $entry){
[28]        self::$pool[$entry->getId()] = $entry;
[29]    }
[30] 
[31]    public static function get($id){
[32]        return isset(self::$pool[$id]) ? clone self::$pool[$id] : null;
[33]    }
[34] 
[35]    public static function getByName($name){
[36]        foreach(self::$pool as $element){
[37]            if($element->getName() === $name){

Backtrace:
#0 (): pocketmine\Server->crashDump(boolean)

PocketMine-MP version: 1.6dev #1266 [Protocol 38; API 1.13.1]
Git commit: 0000000000000000000000000000000000000000
uname -a: Linux localhost 3.0.31-3569041 #1 SMP PREEMPT Fri Dec 12 20:16:40 KST 2014 armv7l
PHP Version: 5.6.2
Zend version: 2.6.0
OS : Linux, android

Loaded plugins:
EconomyAPI 2.0.9 by onebone for API(s) 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.4.0, 1.4.1
ManyWorlds 2.0.3 by aliuly for API(s) 1.10.0
essentialsTP 1.1.0 by  for API(s) 1.12.0
DevTools 1.10.0 by PocketMine Team for API(s) 1.3.1
PurePerms 1.1.12 by 64FF00 for API(s) 1.13.0
PopupAlerts 1.3 by EvolSoft for API(s) 1.12.0
Slapper 1.2.8 by jojoe77777 for API(s) 1.12.0
CustomAlerts 1.6 by EvolSoft for API(s) 1.12.0
SurvivalGame 1.0.7 by AndreTheGamer for API(s) 1.0.0
@PEMapModder PEMapModder changed the title crash dump Syntax error using static as type hint Jan 29, 2016
@SuperCraftFacs
Copy link

I'm having same thing :/

Code:
[18] abstract class ModelledEnum{
[19] /** @var static[] /
[20] private static $pool = [];
[21]
[22] /
* @var int /
[23] private $id;
[24] /
* @var string */
[25] private $name;
[26]
[27] protected static function addEnumEntry(static $entry){
[28] self::$pool[$entry->getId()] = $entry;
[29] }
[30]
[31] public static function get($id){
[32] return isset(self::$pool[$id]) ? clone self::$pool[$id] : null;
[33] }
[34]
[35] public static function getByName($name){
[36] foreach(self::$pool as $element){
[37] if($element->getName() === $name){

@Kris-Driv
Copy link

Static functions can not be protected.

@SOF3
Copy link
Member

SOF3 commented Dec 12, 2016

This project is no longer under development now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants