This check compares the return type specified in the @return annotation of a function
or method doc comment with the types returned by the function and raises an issue if they
mismatch.
eventCoreIndexStart uses the super-global variable $_SESSION which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies
of your class. This makes your code less dependent on global state and it
becomes generally more testable:
// BadclassRouter{publicfunctiongenerate($path){return$_SERVER['HOST'].$path;}}// BetterclassRouter{private$host;publicfunction__construct($host){$this->host=$host;}publicfunctiongenerate($path){return$this->host.$path;}}classController{publicfunctionmyAction(Request$request){// Instead of$page=isset($_GET['page'])?intval($_GET['page']):1;// Better (assuming you use the Symfony2 request)$page=$request->query->get('page',1);}}
Loading history...
36
{
37
// check once per user session if xsitemap exists
38
$sessionVar = 'xsitemapChecked';
39
$retVal = true;
40
if (empty($_SESSION[$sessionVar])) {
41
if (!file_exists(dirname(__DIR__) . "/xsitemap.xml")) {
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.