How to lint Namespace based on folder's name?

143 views Asked by At

I know PHP CS Fixer and Psalm to lint PHP. I've been using both of them. But I can't find a way to lint / validate my namespace name based on the folder.

For example, in folder Tests/Controllers/V1, I have MyControllerTest.php, and it has the following codes:

<?php

// I should have correct namespace based on folder name not V2 but V1
namespace Tests\Controllers\V2;


.. ... my code

How can I lint the above code with correct namespace?

NOTE: I am using PHP 7.3.

0

There are 0 answers