PHPDeprecationDetector - ตัววิเคราะห์รหัส PHP เพื่อค้นหาการใช้งานของฟังก์ชั่นที่เลิกใช้งานในเวอร์ชันล่ามที่ใหม่กว่า - เครื่องตรวจจับการเสื่อมราคา
PHPDeprecationDetector ตรวจพบ:
มันช่วยให้คุณค้นหารหัสที่อาจล้มเหลวหลังจากการโยกย้ายไปยังเวอร์ชัน PHP รุ่นใหม่
chmod +x phpdd-x.x.x.phar. การติดตั้งในพื้นที่ : ใช้จากโฟลเดอร์ปัจจุบัน:
. /phpdd-x.x.x.phar -h ข. การติดตั้งทั่วโลก : ย้ายไปยังหนึ่งในโฟลเดอร์ที่ระบุไว้ใน $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 โดยค่าเริ่มต้นจะใช้ 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 สำหรับการตรวจสอบอัตโนมัติ PASS --output-file=FILENAME เพื่อเขียนผลลัพธ์ไปยังไฟล์ ชื่อไฟล์ หรือไม่ได้ตั้งค่าเป็นเอาต์พุตเป็น stdout
นอกจากนี้คุณสามารถจัดเก็บการวิเคราะห์ผลลัพธ์ในรูปแบบ Junit สำหรับการตรวจสอบอัตโนมัติ PASS --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