PHP code example of 22h / code-analyser

1. Go to this page and download the library: Download 22h/code-analyser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

22h / code-analyser example snippets

shell
$ php code-analyser code-analyser:namespaces
 
Lookup autoload paths
---------------------
 
 ------ ------------------------------- --------
  env    namespace                       folder
 ------ ------------------------------- --------
  prod   TwentyTwo\CodeAnalyser\         src
  dev    TwentyTwo\CodeAnalyser\Tests\   tests
 ------ ------------------------------- --------
 
Search matching files
---------------------
 
 Find 11 matching files in directories
 
Search incorrect namespaces
---------------------------
 
 11/11 [============================] 100%
 
List incorrect namespaces
-------------------------
 
 ------------------- ------------------------------------
  File                tests/\Test\Wrang.php
  Current Namespace   TwentyTwo\CodeAnalyserA\Tests\Test
  New Namespace       TwentyTwo\CodeAnalyser\Tests\Test
 ------------------- ------------------------------------
 
 ------------------- -------------------------------
  File                tests/\Wrong.php
  Current Namespace   TwentyTwo\CodeAnalyser2\Tests
  New Namespace       TwentyTwo\CodeAnalyser\Tests
 ------------------- -------------------------------
shell
$ php code-analyser code-analyser:exceptions
 
Lookup autoload paths
---------------------
 
 ------ ------------------------------- --------
  env    namespace                       folder
 ------ ------------------------------- --------
  prod   TwentyTwo\CodeAnalyser\         src
  dev    TwentyTwo\CodeAnalyser\Tests\   tests
 ------ ------------------------------- --------
 
Search matching files
---------------------
 
 Find 12 matching files in directories
 
Search exceptions
-----------------
 
 12/12 [============================] 100%
 
List founded exceptions
-----------------------
 
 ------------------------------- ----------------------------------
  exception                       files
 ------------------------------- ----------------------------------
  ComposerFileNotFoundException   src\Composer.php
  ComposerFileNotFoundException   tests/\Test\Wrang.php
  FileNotFoundException           src\Autoload\CheckFile.php
  FileNotFoundException           src\FindExceptions\CheckFile.php
  Exception                       tests/\Test\Wrang.php
 ------------------------------- ----------------------------------
 
List grouped exceptions
-----------------------
 
 ------------------------------- -------
  exception                       count
 ------------------------------- -------
  ComposerFileNotFoundException   2
  FileNotFoundException           2
  Exception                       1
 ------------------------------- -------
 
 [OK] find 5 exceptions