PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 4.0.26
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v4.0.26
4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 1.9.3 1.9.4 1.9.5 1.9.6 All 170 releases
searchpro / BerqWP / scoper.inc.php

scoper.inc.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 4.0.26, at BerqWP/scoper.inc.php

74 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 use Isolated\Symfony\Component\Finder\Finder;
6
7 return [
8 'prefix' => 'BerqWP_Deps',
9
10 'finders' => [
11 // Third-party vendor packages
12 Finder::create()
13 ->files()
14 ->in(__DIR__ . '/vendor')
15 ->name('*.php'),
16
17 // SDK source — so GuzzleHttp/voku use statements get rewritten automatically
18 Finder::create()
19 ->files()
20 ->in(__DIR__ . '/src')
21 ->name('*.php'),
22 ],
23
24 'exclude-namespaces' => [
25 'BerqWP', // plugin's own namespace — never prefix
26 'Composer', // composer internals
27 ],
28
29 'exclude-classes' => [
30 // polyfill-php80 global stubs
31 'Attribute',
32 'PhpToken',
33 'Stringable',
34 'UnhandledMatchError',
35 'ValueError',
36 ],
37
38 'exclude-functions' => [
39 'getallheaders', // ralouphie/getallheaders
40 'fdiv',
41 'preg_last_error_msg',
42 'str_contains',
43 'str_starts_with',
44 'str_ends_with',
45 'get_debug_type',
46 'get_resource_id', // symfony/polyfill-php80
47 'trigger_deprecation', // symfony/deprecation-contracts
48 ],
49
50 'exclude-constants' => [
51 'ABSPATH',
52 'WP_CONTENT_DIR',
53 ],
54
55 'patchers' => [
56 // Composer\InstalledVersions is declared by many plugins without a class_exists
57 // guard, causing "cannot redeclare class" fatals. Wrap our copy in a guard.
58 // Note: autoload_static.php is generated output by php-scoper, not an input file,
59 // so it cannot be patched here — it is fixed by fix-autoload-static.php in Makefile.
60 static function (string $filePath, string $prefix, string $content): string {
61 if (!str_ends_with($filePath, 'composer/InstalledVersions.php')) {
62 return $content;
63 }
64 $content = str_replace(
65 "class InstalledVersions\n{",
66 "if (!class_exists('Composer\\\\InstalledVersions', false)) {\nclass InstalledVersions\n{",
67 $content
68 );
69 $content = rtrim($content) . "\n} // end class_exists check\n";
70 return $content;
71 },
72 ],
73 ];
74