0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PHPCompatibilityがインストールされてないと怒られた時の解決法

Posted at

はじめに

php5からphp7に移行するため、PHOCoompatilibilityを使って古い関数などをチェックしようとしたところ、インストールしてないと怒られたので対処法を記録。

ERROR: the "PHPCompatibility" coding standard is not installed. 

手順

1.phpcsがすでにインストールされているマシンにPHPCompatibilityをインストール

composer require --dev phpcompatibility/php-compatibility

Using version ^9.3 for phpcompatibility/php-compatibility
./composer.json has been updated
Running composer update phpcompatibility/php-compatibility
Loading composer repositories with package information
Updating dependencies                                 
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking phpcompatibility/php-compatibility (9.3.5)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing phpcompatibility/php-compatibility (9.3.5): Extracting archive
1 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files

2.動作確認 => インストールされてないよエラー

vendor/bin/phpcs --standard=PHPCompatibility
ERROR: the "PHPCompatibility" coding standard is not installed. The installed coding standards are PEAR, Zend, PSR2, MySource, Squiz, PSR1 and PSR12

3.PHPCompatibilityをオプションとして認識できるようにpathを設定

vendor/bin/phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility
Using config file: /Users/honoka.arai/WORKSPACE/docker-boilerplate/data-host/batch/vendor/squizlabs/php_codesniffer/CodeSniffer.conf

Config value "installed_paths" added successfully

4.動作確認2 => filenameないよエラーなので、動いてるっぽい🥳

vendor/bin/phpcs --standard=PHPCompatibility
ERROR: You must supply at least one file or directory to process.

Run "phpcs --help" for usage information

最後に

意外と簡単に解決できてよかったです...
参考になれば幸いです🍎

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?