We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

_getVersion() must be compatible

Hello, I Installed de last version from phalcon and then install the same for devtools (I think), but when I try to use the command phalcon, I recived this:

PHP Fatal error: Declaration of Phalcon\Devtools\Version::_getVersion() must be compatible with Phalcon\Version::_getVersion(): array in /var/www/html/phalcon-devtools/scripts/Phalcon/Devtools/Version.php on line 44

And this line does not give any clue....



8.4k
Accepted
answer

the error says that the method declaration of _getVersion in /var/www/html/phalcon-devtools/scripts/Phalcon/Devtools/Version.php should be compatible with Phalcon\Version::_getVersion() as the class extends Phalcon\Version which is defined in the extension

you php cli could use a different php than used in http

first do this command in your cmd/console

php -r var_dump(Phalcon\Version::get());

and this

php -v

and then paste the phalcon-dev tools version from the file /var/www/html/phalcon-devtools/scripts/Phalcon/Devtools/Version.php

edited Dec '19

In the file /var/www/html/phalcon-devtools/scripts/Phalcon/Devtools/Version.php add : array as returntype hint to the _getVersion() function

protected static function _getVersion() : array

In the file /var/www/html/phalcon-devtools/scripts/Phalcon/Devtools/Version.php add : array as returntype hint to the _getVersion() function

protected static function _getVersion() : array

Thank you so much, I've spent 3 hours trying to solve the problem, then I read your comment. Thanks