Return value

Discussion in 'Development' started by A354-PH, Jan 27, 2019.

  1. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    Anyone can fix this?

    Error:
    Code:
    [10:35:39] [Server thread/CRITICAL]: TypeError: "Return value of bedwars\BedWars::getArenaManager() must be an instance of bedwars\ArenaManager, null returned" (EXCEPTION) in "plugins/BedWars v1.4 PRO.phar/src/bedwars/BedWars" at line 95
    CODE;
    PHP:
    public function getArenaManager(): ArenaManager {
            return 
    $this->arenaManager//line 95
    }
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,388
    GitHub:
    HimbeersaftLP
    I assume that your property arenaManager is not defined.
     
    corytortoise and Muqsit like this.
  3. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    This is how its defined
    PHP:
    class BedWars extends PluginBase {

        
    /** @var BedWars $instance */
        
    private static $instance;

        
    /** @var ArenaManager $arenaManager */
        
    private $arenaManager;

        
    /** @var LevelManager $levelManager */
        
    private $levelManager;

        
    /** @var ArenaSetupManager $arenaSetupManager */
        
    private $arenaSetupManager;

        
    /** @var LevelSetupManager $levelSetupManager */
        
    private $levelSetupManager;

        
    /** @var ConfigManager $configManager */
        
    private $configManager;

        
    /** @var Command[] $commands */
        
    private $commands = [];

        public function 
    onEnable() {
            
    self::$instance $this;
            
    $this->registerCommands();
            
    $this->configManager = new ConfigManager;
            
    $this->levelManager = new LevelManager;
            
    $this->arenaManager = new ArenaManager;
            
    $this->arenaSetupManager = new ArenaSetupManager;
            
    $this->levelSetupManager = new LevelSetupManager;
        }
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,570
    GitHub:
    muqsit
    Seems like the error happens before ArenaManager is defined. Can you send the errorebacktrace?
     
    HimbeersaftLP likes this.
  5. CV71-codes

    CV71-codes Spider

    Messages:
    7
    GitHub:
    craveyou-newcoder
    My Annihilation plugin Says That
     
  6. JustJ0rd4n

    JustJ0rd4n Creeper

    Messages:
    3
    GitHub:
    justj0rd4n
    I suggest you to learn PHP OOP, there you can learn how objects work.
     
  7. Marabou

    Marabou Baby Zombie

    Messages:
    135
    GitHub:
    wiligangster
    I suggest you to help this guy and stop shitposting.
     
  8. Dyntes

    Dyntes Spider Jockey

    Messages:
    43
    GitHub:
    Dyntes
    Can you send the full code of this file??
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.