Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit 0271bde

Browse files
authored
removed dependency on ext-mbstring (#94)
| Q | A | --------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Related tickets | - | License | MIT | Doc PR | -
1 parent aa853e0 commit 0271bde

26 files changed

Lines changed: 34 additions & 37 deletions

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
],
2727
"require": {
2828
"php": "^7.1",
29-
"ext-mbstring": "*",
3029
"ext-json": "*",
3130
"ext-tokenizer": "*",
3231
"composer-plugin-api": "^1.0"

src/Automatic/Automatic.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public function activate(Composer $composer, IOInterface $io): void
201201
// that way, we are sure to use all files from the same version.
202202
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(\dirname(__DIR__, 1), FilesystemIterator::SKIP_DOTS)) as $file) {
203203
/** @var \SplFileInfo $file */
204-
if (\mb_substr($file->getFilename(), -4) === '.php') {
204+
if (\substr($file->getFilename(), -4) === '.php') {
205205
require_once $file;
206206
}
207207
}
@@ -743,7 +743,7 @@ public function whatProvides(Pool $pool, $name, $bypassFilters = false)
743743
}, clone $pool, $pool)();
744744

745745
foreach ($event->getRequest()->getJobs() as $job) {
746-
if ($job['cmd'] !== 'install' || \mb_strpos($job['packageName'], '/') === false) {
746+
if ($job['cmd'] !== 'install' || \strpos($job['packageName'], '/') === false) {
747747
continue;
748748
}
749749

@@ -756,7 +756,7 @@ public function whatProvides(Pool $pool, $name, $bypassFilters = false)
756756
foreach ($pool->whatProvides($packageName, $constraint, true) as $package) {
757757
/** @var \Composer\Package\Link $link */
758758
foreach (\array_merge($package->getRequires(), $package->getConflicts(), $package->getReplaces()) as $link) {
759-
if (isset($listed[$link->getTarget()]) || \mb_strpos($link->getTarget(), '/') === false) {
759+
if (isset($listed[$link->getTarget()]) || \strpos($link->getTarget(), '/') === false) {
760760
continue;
761761
}
762762

@@ -838,7 +838,7 @@ private function addLegacyTags(IOInterface $io, array $requires, LegacyTagsManag
838838
continue;
839839
}
840840

841-
if (\mb_strpos($name, '/') === false) {
841+
if (\strpos($name, '/') === false) {
842842
$io->writeError(\sprintf('Constrain [%s] skipped, package name [%s] without a slash is not supported', $version, $name));
843843

844844
continue;

src/Automatic/Configurator/EnvConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function configure(PackageContract $package): void
3535
$data = '';
3636

3737
foreach ((array) $package->getConfig(ConfiguratorContract::TYPE, self::getName()) as $key => $value) {
38-
if (\mb_strpos($key, '#') === 0 && \is_numeric(\mb_substr($key, 1))) {
38+
if (\strpos($key, '#') === 0 && \is_numeric(\substr($key, 1))) {
3939
$data .= '# ' . $value . \PHP_EOL;
4040

4141
continue;

src/Automatic/Installer/InstallationManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function install(array $requires, array $devRequires = []): void
3030
$rootPackages = [];
3131

3232
foreach ($this->getRootRequires() as $link) {
33-
$rootPackages[\mb_strtolower($link->getTarget())] = (string) $link->getConstraint();
33+
$rootPackages[\strtolower($link->getTarget())] = (string) $link->getConstraint();
3434
}
3535

3636
$requiresToInstall = $this->preparePackagesToInstall($requires, $rootPackages);
@@ -124,7 +124,7 @@ protected function preparePackagesToInstall(array $requires, array $rootPackages
124124
// Check if package is currently installed, if so, use installed constraint.
125125
if (isset($toInstall[$packageName])) {
126126
$version = $toInstall[$packageName];
127-
$constraint = \mb_strpos($version, 'dev') === false ? '^' . $version : $version;
127+
$constraint = \strpos($version, 'dev') === false ? '^' . $version : $version;
128128

129129
$toInstall[$packageName] = $constraint;
130130

src/Automatic/LegacyTagsManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function hasProvider(string $file): bool
7373
foreach ($this->legacyTags as $name => $constraint) {
7474
[$namespace, $packageName] = \explode('/', $name, 2);
7575

76-
if (\mb_strpos($file, \sprintf('provider-%s$', $namespace)) !== false) {
76+
if (\strpos($file, \sprintf('provider-%s$', $namespace)) !== false) {
7777
return true;
7878
}
7979
}

src/Automatic/Operation/AbstractOperation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ protected function findClassesInAutomaticFolder(PackageContract $package, string
155155
if (\count($composerAutoload) !== 0) {
156156
$classes = $this->classFinder->setComposerAutoload($name, $composerAutoload)
157157
->setFilter(function (\SplFileInfo $fileInfo) use ($name) {
158-
return \mb_strpos((string) \mb_strstr($fileInfo->getPathname(), $name), \DIRECTORY_SEPARATOR . 'Automatic' . \DIRECTORY_SEPARATOR) !== false;
158+
return \strpos((string) \strstr($fileInfo->getPathname(), $name), \DIRECTORY_SEPARATOR . 'Automatic' . \DIRECTORY_SEPARATOR) !== false;
159159
})
160160
->find()
161161
->getAll();

src/Automatic/Operation/Install.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private function getPackageVersion(PackageInterface $package): string
9999
$version = $package->getPrettyVersion();
100100
$extra = $package->getExtra();
101101

102-
if (isset($extra['branch-alias']) && \mb_strpos($version, 'dev-') === 0) {
102+
if (isset($extra['branch-alias']) && \strpos($version, 'dev-') === 0) {
103103
$branchAliases = $extra['branch-alias'];
104104

105105
if (
@@ -131,7 +131,7 @@ private function createAutomaticPackage(PackageInterface $composerPackage, strin
131131
foreach ($composerPackage->getRequires() as $link) {
132132
$target = $link->getTarget();
133133

134-
if ($target === 'php' || \mb_strpos($target, 'ext-') === 0) {
134+
if ($target === 'php' || \strpos($target, 'ext-') === 0) {
135135
continue;
136136
}
137137

src/Automatic/Prefetcher/CurlDownloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function get(string $url, $context, ?string $file): array
123123
} else {
124124
$headers[] = 'Connection: keep-alive';
125125

126-
if (\mb_strpos($url, 'https://') === 0 && \defined('CURL_VERSION_HTTP2') && \defined('CURL_HTTP_VERSION_2_0') && (\CURL_VERSION_HTTP2 & \curl_version()['features'])) {
126+
if (\strpos($url, 'https://') === 0 && \defined('CURL_VERSION_HTTP2') && \defined('CURL_HTTP_VERSION_2_0') && (\CURL_VERSION_HTTP2 & \curl_version()['features'])) {
127127
\curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2_0);
128128
}
129129
}

src/Automatic/Prefetcher/ParallelDownloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function download(array &$nextArgs, callable $nextCallback, bool $quiet =
176176
$this->io->writeError('<warning>Enable the "cURL" PHP extension for faster downloads</warning>');
177177
}
178178

179-
$note = \DIRECTORY_SEPARATOR === '\\' ? '' : (\mb_stripos(\PHP_OS, 'darwin') !== false ? '🎵' : '🎶');
179+
$note = \DIRECTORY_SEPARATOR === '\\' ? '' : (\stripos(\PHP_OS, 'darwin') !== false ? '🎵' : '🎶');
180180
$note .= $this->downloader !== null ? (\DIRECTORY_SEPARATOR !== '\\' ? ' 💨' : '') : '';
181181

182182
$this->io->writeError('');

src/Automatic/Prefetcher/Prefetcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function prefetchComposerRepositories(RemoteFilesystem $remoteFilesystem)
113113

114114
if ($pluginManager instanceof PluginManager) {
115115
foreach ($pluginManager->getPlugins() as $plugin) {
116-
if (\mb_strpos(\get_class($plugin), PrestissimoPlugin::class) === 0) {
116+
if (\strpos(\get_class($plugin), PrestissimoPlugin::class) === 0) {
117117
if (\method_exists($remoteFilesystem, 'getRemoteContents')) {
118118
$plugin->disable();
119119
} else {

0 commit comments

Comments
 (0)