Skip to content

Commit a91e9d4

Browse files
minor #41973 Leverage str_ends_with (Tobion)
This PR was merged into the 4.4 branch. Discussion ---------- Leverage str_ends_with | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | | License | MIT | Doc PR | added the php80 polyfill to requirements when necessary. some components already had the requirement anyway. Related to #41576 Commits ------- 9d807298be Leverage str_ends_with
2 parents bd920dd + 1cc7935 commit a91e9d4

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

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);

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)) {

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.16",
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"

0 commit comments

Comments
 (0)