PhpDeprecationDetector
2.0.33: 8.2 fix and 8.0 rules change
PHPDEPRECATIONDETECTOR- PHP代碼的分析儀搜索新解釋器版本中棄用功能的用法 - 折舊檢測器。
phpdeprecationdetector檢測:
從字面上看,它可以幫助您找到在遷移到更新的PHP版本後可能會失敗的代碼。
chmod +x phpdd-x.x.x.phar一個。本地安裝:從當前文件夾中使用它:
. /phpdd-x.x.x.phar -h b。全局安裝:將其輸入到您的$PATH中列出的一個文件夾中,然後從任何文件夾中運行:
sudo mv phpdd-x.x.x.phar /usr/local/bin/phpdd
phpdd -h安裝PHPDD的另一種方法是通過作曲家。
curl -sS https://getcomposer.org/installer | php./composer.phar global require wapmorgan/php-deprecation-detector dev-masterphpdd -h要掃描您的文件或文件夾啟動phpdd並傳遞文件或目錄名稱。
Description:
Analyzes PHP code and searches issues with deprecated functionality in newer interpreter versions.
Usage:
scan [options] [--] <files>...
Arguments:
files Which files you want to analyze (separate multiple names with a space)?
Options:
-t, --target[=TARGET] Sets target PHP interpreter version. [default: "8.0"]
-a, --after[=AFTER] Sets initial PHP interpreter version for checks. [default: "5.3"]
-e, --exclude[=EXCLUDE] Sets excluded file or directory names for scanning. If need to pass few names, join it with comma.
-s, --max-size[=MAX-SIZE] Sets max size of php file. If file is larger, it will be skipped. [default: "1mb"]
--file-extensions[=FILE-EXTENSIONS] Sets file extensions to be parsed. [default: "php, php5, phtml"]
--skip-checks[=SKIP-CHECKS] Skip all checks containing any of the given values. Pass a comma-separated list for multiple values.
--output[=OUTPUT] The output type required. Options: stdout, json, junit. Defaults to stdout.
--output-file[=OUTPUT-FILE] File path to store results where output is not stdout.
-h, --help Display help for the given command. When no command is given display help for the scan command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--target您可以指定PHP版本以更少的檢查。可用的目標版本:5.3、5.4、5.5、5.6、7.0、7.1、7.2、7.3、7.4、8.0。較大的版本包括從所有以前的檢查規則。--exclude選項,您可以從分析中排除特定文件夾或文件。例如, --exclude vendor將阻止檢查第三方庫。--skip-checks選項,您可以將特定的支票排除在分析中。--file-extensions選項指定所有Exts。默認情況下,它使用php , phtml和php5 。--output-file選項來指定按照--output (JSON或JUNIT)指定的輸出文件的路徑。 > ./bin/phpdd tests/
Max file size set to: 1.000 MiB
Folder /media/wapmorgan/Локальный диск/Документы/PhpDeprecationDetector/tests
- PHP 5.3 (3) - your version is greater or equal
+------------+---------+---------------------------------------------------------------------+
| File:Line | Type | Issue |
+------------+---------+---------------------------------------------------------------------+
| /5.3.php:2 | removed | Function dl() is removed. |
| /5.3.php:3 | removed | Ini define_syslog_variables is removed. |
| /5.3.php:5 | changed | Function usage piet() (@call_with_passing_by_reference) is changed. |
| | | Call with passing by reference is deprecated. Problem is "&$hoho" |
+------------+---------+---------------------------------------------------------------------+
- PHP 5.4 (2) - your version is greater or equal
+------------+---------+-----------------------------------------------+
| File:Line | Type | Issue |
+------------+---------+-----------------------------------------------+
| /5.4.php:2 | removed | Function mcrypt_generic_end() is removed. |
| | | Consider replace with mcrypt_generic_deinit() |
| /5.4.php:3 | removed | Function magic_quotes_runtime() is removed. |
+------------+---------+-----------------------------------------------+
...
...
...
另外,您可以以JSON格式存儲分析以進行自動檢查。通過--output-file=FILENAME結果寫入文件名文件或未設置為輸出到stdout 。
另外,您可以以Junit格式存儲分析結果以進行自動檢查。通過--output-file=FILENAME結果寫入文件名文件或未設置為輸出到stdout 。
JSON的格式- 帶有項目的字典:
項目描述:
magic_quotes_runtime或preg_replace() (@preg_replace_e_modifier) )preg_replace() (@preg_replace_e_modifier)或parse_str() (@parse_str_without_argument) )Usage of "e" modifier in preg_replace is deprecated: "asdasdsd~ie"或Call to parse_str() without second argument is deprecated )docker run --rm --interactive --tty --volume $PWD :/app composer:2.2.4 sh
# and inside a container:
docker-php-ext-install bcmath
composer require macfja/phar-builder
echo phar.readonly=0 >> /usr/local/etc/php/php-cli.ini
composer run-script build