Jump to content

Проблема с переходом на PHP 8


Recommended Posts

Привет,

Я делаю свое собственное приложение.
Теперь я изменил версию PHP 8, и мне нужно адаптировать свой код к этой версии. В папке /sources в приложении у меня есть файл, определяющий названия отдельных элементов, например 0=>Original , 2=> Fake
В php-коде модуля я загружаю этот файл через код:

$actorstype = \IPS\gamecp\Game::loadActorsType();

$actorstype = \IPS\gamecp\Game::loadActorsType();

Однако в файле w/sources у меня что-то вроде этого:
 

public static function loadActorsType ()
{
        return array(
						0 => 'Regular Actor',
						1 => 'Actor Rybak',
                        2 => 'Actor Lumberjack',
                        3 => 'Actor Dealer Weapons',
                        4 => 'Heist actor',
                        5 => 'Actor to the store 24/7',
                        6 => 'Actor for office',
                        7 => 'Actor to the employment office',
                        8 => 'Actor for business',
                        9 => 'Actor to bank',
		);
}


При изменении php на 8.0 я получаю сообщение об ошибке:

Whoops \ Exception \ ErrorException (E_USER_ERROR)
You do not have any methods in IPS\gamecp\Game which are not static. Please refactor. (PHP Coding Standards: Functions and Methods.6)

Как я могу изменить его на новую версию?

Link to comment
Share on other sites

Добавьте какую-нить не static функцию. Даже пустышка с return true; сойдет. Ну или переделайте класс в trait.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Ваша ссылка была автоматически строена.   Отображать как обычную ссылку

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...