PHP class "cannot be resolved to a type" error [message #1840160] |
Wed, 07 April 2021 17:28  |
Eclipse User |
|
|
|
I've just installed Eclipse in my Macbook with Big Sur. I did open a folder with a website to work with as a project.
A lot of errors like "<classname> cannot be resolved as a type" is displayed. I have researched about this error and there is a lot of complains about, for many years. Sometimes, to modify .buildpath solve it, but my file is ok, it seems Eclipse is not finding the class declaration.
Here is the thing, as you can see below, my classes are in other files included by a dynamic path, so is only possible to know the source when running. Is there any solution or workaround to this issue?
<?php
if($_SERVER["HTTP_HOST"]=="localhost"){
ini_set("display_errors", "1");
error_reporting(E_ALL ^ E_NOTICE);
}
$main = 'admin3.php';
require_once("sessao.php");
if($Erros) die('<h1>Erro de início de sessão</h1><p>'.implode('<br />', $Erros).'</p><p>Inicialização abortada!</p>');
$reloadMain = $Amb->url.$main;
$htmlUsuario = ($_SESSION["Login"]["Usuario"]["logado"])?
'Usuário: <b>'.$_SESSION["Login"]["Usuario"]["nome"].' <a href="#" onclick="info(\'usr\'); return false;"> ? </a> <a href="#" onclick="loginLogout(); return false;">Sair</a></b>'
: 'Usuário não logado' ;
// jGp
$jGp = ($Amb->host=="localhost")? $Amb->urlJGp."ini-1.1.js" : $Amb->urlJGp."ini_1.1.js" ;
$jGp_modFup = ($Amb->host=="localhost")? $Amb->urlJGp."modFup-1.1.js" : $Amb->urlJGp."modFup_1.1.js" ;
// bibs
require_once($Amb->dirBibPhp."BaseDeDados.php");
require_once($Amb->dirBibPhp."ListaDir_1.php");
//require_once($Amb->dirBibPhp."EchoPlus.php");
//require_once($Amb->dirBibPhp."TextoFuncs.php");
//$TF = new TF();
//$echo = new EchoPlus();
$BD = new BaseDeDados(); ***here is pointed an error***
...
|
|
|
Re: PHP class "cannot be resolved to a type" error [message #1840269 is a reply to message #1840160] |
Sat, 10 April 2021 18:01  |
Eclipse User |
|
|
|
No answers yet? Where are the masters of this community???
Ok, what I did so far was just disable those errors, set to a simple message. But I still got 3 errors when I embed the facebook tools, but these ones I'm thinking in work differently of other libraries.
require($Amb->dirBibPhp.'Facebook/autoload.php');
//use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
|
|
|
Powered by
FUDForum. Page generated in 0.05362 seconds