Closed pavanyogi closed 2 years ago
Hi @pavanyogi ,
as you can see in the error trace, you're providing incorrect argument to the file you're trying to validate by phpcs
I see in there the following content:
C:\xampp\htdocs\my_work\PHP_CodeSniffer\C:\xampp\htdocs\my_work\csv_to_mysql\csv_to_mysql.php
that means you need to provide relative path, not an absolute one.
If you'll use instead the
phpcs --standard=PSR12 ..\csv_to_mysql\csv_to_mysql.php
it should just work.
Closing the issue.
C:\xampp\htdocs\my_work\PHP_CodeSniffer\bin>php phpcbf C:\xampp\htdocs\my_work\csv_to_mysql\csv_to_mysql.php
PHP Fatal error: Uncaught exception 'PHP_CodeSniffer\Exceptions\RuntimeException' with message 'file_put_contents(C:\xampp\htdocs\my_work\PHP_CodeSniffer\C:\xa mpp\htdocs\my_work\csv_to_mysql\csv_to_mysql.php): failed to open stream: Invalid argument in C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Reports\Cbf.php on lin e 90' in C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Runner.php:557 Stack trace:
0 [internal function]: PHP_CodeSniffer\Runner->handleErrors(2, 'file_put_conten...', 'C:\xampp\htdocs...', 90, Array)
1 C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Reports\Cbf.php(90): file_put_contents('C:\xampp\htdocs...', '<?php\n// import...')
2 C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Reporter.php(262): PHP_CodeSniffer\Reports\Cbf->generateFileReport(Array, Object(PHP_CodeSniffer\Files\LocalFile)
, false, 0)
3 C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Runner.php(606): PHP_CodeSniffer\Reporter->cacheFileReport(Object(PHP_CodeSniffer\Files\LocalFile), Object(PHP_Co
deSniffer\Config))
4 C:\xampp\htdocs\my_work\PHP_CodeS in C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Runner.php on line 557
Fatal error: Uncaught exception 'PHP_CodeSniffer\Exceptions\RuntimeException' with message 'file_put_contents(C:\xampp\htdocs\my_work\PHP_CodeSniffer\C:\xampp\h tdocs\my_work\csv_to_mysql\csv_to_mysql.php): failed to open stream: Invalid argument in C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Reports\Cbf.php on line 90' in C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Runner.php on line 557
PHP_CodeSniffer\Exceptions\RuntimeException: file_put_contents(C:\xampp\htdocs\my_work\PHP_CodeSniffer\C:\xampp\htdocs\my_work\csv_to_mysql\csv_to_mysql.php): f ailed to open stream: Invalid argument in C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Reports\Cbf.php on line 90 in C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\ Runner.php on line 557
Call Stack: 0.0003 119568 1. {main}() C:\xampp\htdocs\my_work\PHP_CodeSniffer\bin\phpcbf:0 0.0047 296608 2. PHP_CodeSniffer\Runner->runPHPCBF() C:\xampp\htdocs\my_work\PHP_CodeSniffer\bin\phpcbf:18 0.4920 4710528 3. PHP_CodeSniffer\Runner->run() C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Runner.php:193 0.5218 5384552 4. PHP_CodeSniffer\Runner->processFile() C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Runner.php:394 0.5640 5653168 5. PHP_CodeSniffer\Reporter->cacheFileReport() C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Runner.php:606 0.5641 5672216 6. PHP_CodeSniffer\Reports\Cbf->generateFileReport() C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Reporter.php:262 0.7576 5710456 7. file_put_contents() C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Reports\Cbf.php:90 0.7582 5713520 8. PHP_CodeSniffer\Runner->handleErrors() C:\xampp\htdocs\my_work\PHP_CodeSniffer\src\Reports\Cbf.php:90
C:\xampp\htdocs\my_work\PHP_CodeSniffer\bin>