Skip to content

Commit 371dfe2

Browse files
committed
Leverage str_ends_with
added the php80 polyfill to requirements when necessary
1 parent 44f08fa commit 371dfe2

File tree

59 files changed

+73
-55
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+73
-55
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected function findExtension($name)
9696
}
9797
}
9898

99-
if ('Bundle' !== substr($name, -6)) {
99+
if (!str_ends_with($name, 'Bundle')) {
100100
$message = sprintf('No extensions with configuration available for "%s".', $name);
101101
} else {
102102
$message = sprintf('No extension with alias "%s" is enabled.', $name);

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8181
$realCacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir');
8282
// the old cache dir name must not be longer than the real one to avoid exceeding
8383
// the maximum length of a directory or file path within it (esp. Windows MAX_PATH)
84-
$oldCacheDir = substr($realCacheDir, 0, -1).('~' === substr($realCacheDir, -1) ? '+' : '~');
84+
$oldCacheDir = substr($realCacheDir, 0, -1).(str_ends_with($realCacheDir, '~') ? '+' : '~');
8585
$fs->remove($oldCacheDir);
8686

8787
if (!is_writable($realCacheDir)) {

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"symfony/http-foundation": "^4.4|^5.0",
2626
"symfony/http-kernel": "^4.4",
2727
"symfony/polyfill-mbstring": "~1.0",
28+
"symfony/polyfill-php80": "^1.15",
2829
"symfony/filesystem": "^3.4|^4.0|^5.0",
2930
"symfony/finder": "^3.4|^4.0|^5.0",
3031
"symfony/routing": "^4.4.12|^5.1.4"

src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private function getBundleTemplatePaths(ContainerBuilder $container, array $conf
201201

202202
private function normalizeBundleName(string $name): string
203203
{
204-
if ('Bundle' === substr($name, -6)) {
204+
if (str_ends_with($name, 'Bundle')) {
205205
$name = substr($name, 0, -6);
206206
}
207207

src/Symfony/Bundle/TwigBundle/TemplateIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function getIterator()
6161
}
6262
foreach ($this->kernel->getBundles() as $bundle) {
6363
$name = $bundle->getName();
64-
if ('Bundle' === substr($name, -6)) {
64+
if (str_ends_with($name, 'Bundle')) {
6565
$name = substr($name, 0, -6);
6666
}
6767

src/Symfony/Bundle/TwigBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"symfony/http-foundation": "^4.3|^5.0",
2222
"symfony/http-kernel": "^4.4",
2323
"symfony/polyfill-ctype": "~1.8",
24+
"symfony/polyfill-php80": "^1.15",
2425
"twig/twig": "^1.43|^2.13|^3.0.4"
2526
},
2627
"require-dev": {

src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private function authorizesInline(array $directivesSet, string $type): bool
221221
private function hasHashOrNonce(array $directives): bool
222222
{
223223
foreach ($directives as $directive) {
224-
if ('\'' !== substr($directive, -1)) {
224+
if (!str_ends_with($directive, '\'')) {
225225
continue;
226226
}
227227
if ('\'nonce-' === substr($directive, 0, 7)) {

src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function getNames(Profile $profile)
8282
continue;
8383
}
8484

85-
if ('.html.twig' === substr($template, -10)) {
85+
if (str_ends_with($template, '.html.twig')) {
8686
$template = substr($template, 0, -10);
8787
}
8888

src/Symfony/Bundle/WebProfilerBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"symfony/config": "^4.2|^5.0",
2121
"symfony/framework-bundle": "^4.4|^5.0",
2222
"symfony/http-kernel": "^4.4",
23+
"symfony/polyfill-php80": "^1.15",
2324
"symfony/routing": "^4.3|^5.0",
2425
"symfony/twig-bundle": "^4.2|^5.0",
2526
"twig/twig": "^1.43|^2.13|^3.0.4"

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ protected function getAbsoluteUri($uri)
688688
if ('/' !== $uri[0]) {
689689
$path = parse_url($currentUri, \PHP_URL_PATH);
690690

691-
if ('/' !== substr($path, -1)) {
691+
if (!str_ends_with($path, '/')) {
692692
$path = substr($path, 0, strrpos($path, '/') + 1);
693693
}
694694

0 commit comments

Comments
 (0)