Skip to content

Commit

Permalink
Merge pull request #14 from matomo-org/prefix-other-pear-classes
Browse files Browse the repository at this point in the history
make sure to prefix other PEAR classes
  • Loading branch information
diosmosis authored Mar 5, 2024
2 parents 2255426 + 246500d commit 51ac8d4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ jobs:
git submodule update -q --init --recursive --depth 1
cd ${{ github.workspace }}
- name: Install package ripgrep
run: sudo apt-get install ripgrep
- name: running tests
uses: matomo-org/github-action-tests@main
with:
Expand Down
14 changes: 12 additions & 2 deletions resources/core-scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
->files()
->in(__DIR__)
->exclude('build')
->exclude('vendor')
->exclude('vendor/prefixed')
->exclude('vendor/composer')
->exclude('node_modules')
->exclude('tmp')
->exclude('@types')
Expand Down Expand Up @@ -84,7 +85,14 @@ static function (string $filePath, string $prefix, string $content) use ($isRena
return $content;
}

$content = preg_replace('/([^\\\\A-Za-z0-9_])\\\\PEAR_/', '$1\\Matomo\\Dependencies\\PEAR_', $content);
if (!preg_match('/\\.php$/', $filePath)) {
return $content;
}

$content = preg_replace('/([^\\\\A-Za-z0-9_])\\\\?PEAR(?!\\/)/', '$1\\Matomo\\Dependencies\\PEAR', $content);
$content = preg_replace('/([^\\\\A-Za-z0-9_])\\\\?Archive_Tar(?!\\/)/', '$1\\Matomo\\Dependencies\\Archive_Tar', $content);
$content = preg_replace('/([^\\\\A-Za-z0-9_])\\\\?Console_Getopt(?!\\/)/', '$1\\Matomo\\Dependencies\\Console_Getopt', $content);
$content = preg_replace('/([^\\\\A-Za-z0-9_])\\\\?OS_Guess(?!\\/)/', '$1\\Matomo\\Dependencies\\OS_Guess', $content);
return $content;
},

Expand Down Expand Up @@ -144,6 +152,8 @@ static function (string $filePath, string $prefix, string $content) use ($isRena
|| preg_match('%symfony/string/AbstractUnicodeString\\.php$%', $filePath)
|| preg_match('%plugins/ImageGraph/StaticGraph\\.php$%', $filePath)
|| preg_match('%symfony/polyfill-intl-normalizer/Resources/unidata/compatibilityDecomposition\\.php$%', $filePath)
|| preg_match('%symfony/yaml/Escaper\\.php$%', $filePath)
|| preg_match('%symfony/yaml/Unescaper\\.php$%', $filePath)
) {
$content = str_replace(html_entity_decode(' '), "\\xC2\\xA0", $content);
}
Expand Down
1 change: 0 additions & 1 deletion src/Prefixers/CorePrefixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class CorePrefixer extends Prefixer
'pear/archive_tar',
'pear/console_getopt',
'pear/pear-core-minimal',
'pear/pear_exception',
];

const DEPENDENCIES_TO_IGNORE = [
Expand Down

0 comments on commit 51ac8d4

Please sign in to comment.