Orri Posted October 2, 2022 Report Share Posted October 2, 2022 Привет, Я делаю свое собственное приложение. Теперь я изменил версию 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) Как я могу изменить его на новую версию? Quote Link to comment Share on other sites More sharing options...
Desti Posted October 2, 2022 Report Share Posted October 2, 2022 Добавьте какую-нить не static функцию. Даже пустышка с return true; сойдет. Ну или переделайте класс в trait. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.