-1

How i can remove the error so i don't have to add file tag before namespace and class tag for after name space

namespace backend\controllers;

use common\models\helpers\Frontend\DropdownHelper;
use common\models\Lookup;
use common\models\Partner;
use common\models\PartnerSearch;
use Yii;
use yii\filters\VerbFilter;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\web\Response;

Missing file tags and class tags error in phpStorm.

rajwa766
  • 604
  • 13
  • 31

1 Answers1

1

Some parts of your code may be unable to conform to your coding standard. You can ignore file parts in the following way

$xmlPackage = new XMLPackage;
// phpcs:disable
$xmlPackage['error_code'] = get_default_error_code_value();
$xmlPackage->send();
// phpcs:enable

In your case you are trying to ignore the doc block for the page and the class, so you should start the // phpcs:disable before the namespace and then close it using // phpcs:enable right after the opening braces of the class {.

I am adding the sample code to ignore the docs block for the file and class below using my own code as you never added the actual code but the image

<?php
// phpcs:disable
namespace frontend\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\web\Response;

/**
 * ApiKeysController implements the CRUD actions for ApiKeys model.
 */
class ApiKeysController extends Controller
{
    // phpcs:enable

}

Note: Before PHP_CodeSniffer version 3.2.0, use // @codingStandardsIgnoreStart instead of // phpcs:disable, and use // @codingStandardsIgnoreEnd instead of // phpcs:enable. The @codingStandards syntax is deprecated and will be removed in PHP_CodeSniffer version 4.0.

Muhammad Omer Aslam
  • 22,976
  • 9
  • 42
  • 68