From 7624b08beca3c6fbbbef8d2d465ea33ba28cbbae Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Thu, 22 May 2025 10:09:54 -0300 Subject: [PATCH] Config: remove code related to the now unsupported PEAR installation PR 4 dropped support for installing PHPCS via PEAR. This commit removes code related to a PEAR placeholder called `@data_dir@` as it is not necessary anymore. The original version of this code was added in https://github.com/PHPCSStandards/PHP_CodeSniffer/commit/980c835c2a4ec35de43e5b67ad88dbdb7dd50860#diff-c36ecedca179eab0b3cd245e872a96ab26fa08e567437e167f4eda1779c15c89R1370-R1372. Two methods were added that use the `@data_dir@` placeholder in that commit: `setConfigData()` and `getAllConfigData()`. A subsequent commit changed `setConfigData()` to only use the PEAR path for the config file if the `@data_dir@` placeholder was replaced with something else: https://github.com/PHPCSStandards/PHP_CodeSniffer/commit/7bb73831f5d8bbb269e626bc28f8cb5d47c9b191. A later commit did the same for `getAllConfigData()` together with other unrelated changes: https://github.com/PHPCSStandards/PHP_CodeSniffer/commit/9392185cf09dde201a36fc97cdef84049fc17ece. It seems that the PEAR file package.xml was responsible for replacing `@data_dir@` with an actual path: https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/6d22f38f6c846512d321f3d5ac15c8805c694084/package.xml#L293-L295. PR 4 removed the `@data_dir@` related code from `setConfigData()`, but not from `getAllConfigData()`. Closes 1101 --- src/Config.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Config.php b/src/Config.php index 25b3971039..879e7e26a6 100644 --- a/src/Config.php +++ b/src/Config.php @@ -1704,11 +1704,6 @@ public static function getAllConfigData() $configFile = dirname($path).DIRECTORY_SEPARATOR.'CodeSniffer.conf'; } else { $configFile = dirname(__DIR__).DIRECTORY_SEPARATOR.'CodeSniffer.conf'; - if (is_file($configFile) === false - && strpos('@data_dir@', '@data_dir') === false - ) { - $configFile = '@data_dir@/PHP_CodeSniffer/CodeSniffer.conf'; - } } if (is_file($configFile) === false) {