Since PHP 5.6.x you can not call a non-static method, that is, using ::
, as if it were static, without having the warning you indicate in your question ( see PHP Manual ).
The message does not appear in your local environment because you probably have a PHP version earlier than 5.6.x
, while the hosting version is +5.6.x
.
This is one of the relatively recent changes in PHP to correct something that was actually an irregularity : to treat a non-static as static method.
>
There are several ways to avoid that situation ... but the most consistent one would be to declare the method enlacesModel
as static
in class EnlacesModels
if you want to continue using it in this way: EnlacesModels::enlacesModels
.
I would not recommend in any case that you try to avoid the cheating :) message, such as by avoiding warning messages. It is very likely that in the future this situation will change from warning to error. Then you could be writing a code that will fail a posteriori.
You could solve it like this:
Something like this:
class EnlacesModels {
//...
public static enlacesModel($enlaces) {
}
}