8000 Leverage str_ends_with · symfony/symfony@371dfe2 · GitHub
[go: up one dir, main page]

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
  • Yaml
  • 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

    src/Symfony/Component/BrowserKit/CookieJar.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -46,7 +46,7 @@ public function get($name, $path = '/', $domain = null)
    4646
    foreach ($this->cookieJar as $cookieDomain => $pathCookies) {
    4747
    if ($cookieDomain && $domain) {
    4848
    $cookieDomain = '.'.ltrim($cookieDomain, '.');
    49-
    if ($cookieDomain !== substr('.'.$domain, -\strlen($cookieDomain))) {
    49+
    if (!str_ends_with('.'.$domain, $cookieDomain)) {
    5050
    continue;
    5151
    }
    5252
    }

    src/Symfony/Component/BrowserKit/composer.json

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -17,7 +17,8 @@
    1717
    ],
    1818
    "require": {
    1919
    "php": ">=7.1.3",
    20-
    "symfony/dom-crawler": "^3.4|^4.0|^5.0"
    20+
    "symfony/dom-crawler": "^3.4|^4.0|^5.0",
    21+
    "symfony/polyfill-php80": "^1.15"
    2122
    },
    2223
    "require-dev": {
    2324
    "symfony/css-selector": "^3.4|^4.0|^5.0",

    src/Symfony/Component/Config/Exception/FileLoaderLoadException.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -34,7 +34,7 @@ public function __construct(string $resource, string $sourceResource = null, ?in
    3434
    // Include the previous exception, to help the user see what might be the underlying cause
    3535

    3636
    // Trim the trailing period of the previous message. We only want 1 period remove so no rtrim...
    37-
    if ('.' === substr($previous->getMessage(), -1)) {
    37+
    if (str_ends_with($previous->getMessage(), '.')) {
    3838
    $trimmedMessage = substr($previous->getMessage(), 0, -1);
    3939
    $message .= sprintf('%s', $trimmedMessage).' in ';
    4040
    } else {

    src/Symfony/Component/Config/Resource/DirectoryResource.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -83,7 +83,7 @@ public function isFresh($timestamp)
    8383

    8484
    // always monitor directories for changes, except the .. entries
    8585
    // (otherwise deleted files wouldn't get detected)
    86-
    if ($file->isDir() && '/..' === substr($file, -3)) {
    86+
    if ($file->isDir() && str_ends_with($file, '/..')) {
    8787
    continue;
    8888
    }
    8989

    src/Symfony/Component/Config/composer.json

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -19,6 +19,7 @@
    1919
    "php": ">=7.1.3",
    2020
    "symfony/filesystem": "^3.4|^4.0|^5.0",
    2121
    "symfony/polyfill-ctype": "~1.8",
    22+
    "symfony/polyfill-php80": "^1.15",
    2223
    "symfony/polyfill-php81": "^1.22"
    2324
    },
    2425
    "require-dev": {

    src/Symfony/Component/Console/Formatter/OutputFormatter.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -54,7 +54,7 @@ public static function escape($text)
    5454
    */
    5555
    public static function escapeTrailingBackslash(string $text): string
    5656
    {
    57-
    if ('\\' === substr($text, -1)) {
    57+
    if (str_ends_with($text, '\\')) {
    5858
    $len = \strlen($text);
    5959
    $text = rtrim($text, '\\');
    6060
    $text = str_replace("\0", '', $text);

    src/Symfony/Component/Console/Style/SymfonyStyle.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -442,7 +442,7 @@ private function autoPrependText(): void
    442442
    {
    443443
    $fetched = $this->bufferedOutput->fetch();
    444444
    //Prepend new line if last char isn't EOL:
    445-
    if ("\n" !== substr($fetched, -1)) {
    445+
    if (!str_ends_with($fetched, "\n")) {
    446446
    $this->newLine();
    447447
    }
    448448
    }

    src/Symfony/Component/Debug/DebugClassLoader.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -61,7 +61,7 @@ public function __construct(callable $classLoader)
    6161
    if (false === $test || false === $i) {
    6262
    // filesystem is case sensitive
    6363
    self::$caseCheck = 0;
    64-
    } elseif (substr($test, -\strlen($file)) === $file) {
    64+
    } elseif (str_ends_with($test, $file)) {
    6565
    // filesystem is case insensitive and realpath() normalizes the case of characters
    6666
    self::$caseCheck = 1;
    6767
    } elseif (false !== stripos(\PHP_OS, 'darwin')) {

    src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -504,7 +504,7 @@ private function collectLineage(string $class, array &$lineage)
    504504
    return;
    505505
    }
    506506
    $file = $r->getFileName();
    507-
    if (') : eval()\'d code' === substr($file, -17)) {
    507+
    if (str_ends_with($file, ') : eval()\'d code')) {
    508508
    $file = substr($file, 0, strrpos($file, '(', -17));
    509509
    }
    510510
    if (!$file || $this->doExport($file) === $exportedFile = $this->export($file)) {
    @@ -2095,7 +2095,7 @@ private function doExport($value, bool $resolveEnv = false)
    20952095

    20962096
    if ($resolveEnv && "'" === $export[0] && $export !== $resolvedExport = $this->container->resolveEnvPlaceholders($export, "'.\$this->getEnv('string:%s').'")) {
    20972097
    $export = $resolvedExport;
    2098-
    if (".''" === substr($export, -3)) {
    2098+
    if (str_ends_with($export, ".''")) {
    20992099
    $export = substr($export, 0, -3);
    21002100
    if ("'" === $export[1]) {
    21012101
    $export = substr_replace($export, '', 18, 7);

    src/Symfony/Component/DependencyInjection/Extension/Extension.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -66,7 +66,7 @@ public function getNamespace()
    6666
    public function getAlias()
    6767
    {
    6868
    $className = static::class;
    69-
    if ('Extension' != substr($className, -9)) {
    69+
    if (!str_ends_with($className, 'Extension')) {
    7070
    throw new BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.');
    7171
    }
    7272
    $classBaseName = substr(strrchr($className, '\\'), 1, -9);

    src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -49,6 +49,6 @@ public function supports($resource, $type = null)
    4949
    return true;
    5050
    }
    5151

    52-
    return null === $type && \is_string($resource) && '/' === substr($resource, -1);
    52+
    return null === $type && \is_string($resource) && str_ends_with($resource, '/');
    5353
    }
    5454
    }

    src/Symfony/Component/DependencyInjection/Loader/FileLoader.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -91,7 +91,7 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
    9191
    */
    9292
    public function registerClasses(Definition $prototype, $namespace, $resource, $exclude = null)
    9393
    {
    94-
    if ('\\' !== substr($namespace, -1)) {
    94+
    if (!str_ends_with($namespace, '\\')) {
    9595
    throw new InvalidArgumentException(sprintf('Namespace prefix must end with a "\\": "%s".', $namespace));
    9696
    }
    9797
    if (!preg_match('/^(?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+\\\\)++$/', $namespace)) {

    src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -31,7 +31,7 @@ class EnvPlaceholderParameterBag extends ParameterBag
    3131
    */
    3232
    public function get($name)
    3333
    {
    34-
    if (0 === strpos($name, 'env(') && ')' === substr($name, -1) && 'env()' !== $name) {
    34+
    if (0 === strpos($name, 'env(') && str_ends_with($name, ')') && 'env()' !== $name) {
    3535
    $env = substr($name, 4, -1);
    3636

    3737
    if (isset($this->envPlaceholders[$env])) {

    src/Symfony/Component/DependencyInjection/composer.json

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -18,6 +18,7 @@
    1818
    "require": {
    1919
    "php": ">=7.1.3",
    2020
    "psr/container": "^1.0",
    21+
    "symfony/polyfill-php80": "^1.15",
    2122
    "symfony/service-contracts": "^1.1.6|^2"
    2223
    },
    2324
    "require-dev": {

    src/Symfony/Component/DomCrawler/AbstractUriElement.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -142,7 +142,7 @@ protected function canonicalizePath($path)
    142142
    return $path;
    143143
    }
    144144

    145-
    if ('.' === substr($path, -1)) {
    145+
    if (str_ends_with($path, '.')) {
    146146
    $path .= '/';
    147147
    }
    148148

    src/Symfony/Component/DomCrawler/composer.json

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -18,7 +18,8 @@
    1818
    "require": {
    1919
    "php": ">=7.1.3",
    2020
    "symfony/polyfill-ctype": "~1.8",
    21-
    "symfony/polyfill-mbstring": "~1.0"
    21+
    "symfony/polyfill-mbstring": "~1.0",
    22+
    "symfony/polyfill-php80": "^1.15"
    2223
    },
    2324
    "require-dev": {
    2425
    "symfony/css-selector": "^3.4|^4.0|^5.0",

    src/Symfony/Component/ErrorHandler/DebugClassLoader.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -205,7 +205,7 @@ public function __construct(callable $classLoader)
    205205
    if (false === $test || false === $i) {
    206206
    // filesystem is case sensitive
    207207
    self::$caseCheck = 0;
    208-
    } elseif (substr($test, -\strlen($file)) === $file) {
    208+
    } elseif (str_ends_with($test, $file)) {
    209209
    // filesystem is case insensitive and realpath() normalizes the case of characters
    210210
    self::$caseCheck = 1;
    211211
    } elseif (false !== stripos(\PHP_OS, 'darwin')) {

    src/Symfony/Component/Finder/Gitignore.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -78,6 +78,6 @@ private static function lineToRegex(string $gitignoreLine): string
    7878

    7979
    return ($isAbsolute ? '' : '(?:[^/]+/)*')
    8080
    .$regex
    81-
    .('/' !== substr($gitignoreLine, -1) ? '(?:$|/)' : '');
    81+
    .(!str_ends_with($gitignoreLine, '/') ? '(?:$|/)' : '');
    8282
    }
    8383
    }

    src/Symfony/Component/Finder/composer.json

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -16,7 +16,8 @@
    1616
    }
    1717
    ],
    1818
    "require": {
    19-
    "php": ">=7.1.3"
    19+
    "php": ">=7.1.3",
    20+
    "symfony/polyfill-php80": "^1.15"
    2021
    },
    2122
    "autoload": {
    2223
    "psr-4": { "Symfony\\Component\\Finder\\": "" },

    src/Symfony/Component/Form/Command/DebugCommand.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -167,7 +167,7 @@ private function getFqcnTypeClass(InputInterface $input, SymfonyStyle $io, strin
    167167
    $classes[] = $fqcn;
    168168
    } elseif (class_exists($fqcn = $namespace.'\\'.ucfirst($shortClassName).'Type')) {
    169169
    $classes[] = $fqcn;
    170-
    } elseif ('type' === substr($shortClassName, -4) && class_exists($fqcn = $namespace.'\\'.ucfirst(substr($shortClassName, 0, -4).'Type'))) {
    170+
    } elseif (str_ends_with($shortClassName, 'type') && class_exists($fqcn = $namespace.'\\'.ucfirst(substr($shortClassName, 0, -4).'Type'))) {
    171171
    $classes[] = $fqcn;
    172172
    }
    173173
    }

    src/Symfony/Component/Form/composer.json

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -22,6 +22,7 @@
    2222
    "symfony/options-resolver": "~4.3|^5.0",
    2323
    "symfony/polyfill-ctype": "~1.8",
    2424
    "symfony/polyfill-mbstring": "~1.0",
    25+
    "symfony/polyfill-php80": "^1.15",
    2526
    "symfony/property-access": "^3.4.40|^4.4.8|^5.0.8",
    2627
    "symfony/service-contracts": "^1.1|^2"
    2728
    },

    src/Symfony/Component/HttpClient/NativeHttpClient.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -460,7 +460,7 @@ private static function configureHeadersAndProxy($context, string $host, array $
    460460
    foreach ($noProxy as $rule) {
    461461
    $dotRule = '.'.ltrim($rule, '.');
    462462

    463-
    if ('*' === $rule || $host === $rule || substr($host, -\strlen($dotRule)) === $dotRule) {
    463+
    if ('*' === $rule || $host === $rule || str_ends_with($host, $dotRule)) {
    464464
    stream_context_set_option($context, 'http', 'proxy', null);
    465465
    stream_context_set_option($context, 'http', 'request_fulluri', false);
    466466
    stream_context_set_option($context, 'http', 'header', $requestHeaders);

    src/Symfony/Component/HttpClient/composer.json

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -25,6 +25,7 @@
    2525
    "psr/log": "^1.0",
    2626
    "symfony/http-client-contracts": "^1.1.10|^2",
    2727
    "symfony/polyfill-php73": "^1.11",
    28+
    "symfony/polyfill-php80": "^1.15",
    2829
    "symfony/service-contracts": "^1.0|^2"
    2930
    },
    3031
    "require-dev": {

    src/Symfony/Component/HttpFoundation/Request.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -2011,7 +2011,7 @@ private function getTrustedValues(int $type, string $ip = null): array
    20112011
    continue;
    20122012
    }
    20132013
    if (self::HEADER_X_FORWARDED_PORT === $type) {
    2014-
    if (']' === substr($v, -1) || false === $v = strrchr($v, ':')) {
    2014+
    if (str_ends_with($v, ']') || false === $v = strrchr($v, ':')) {
    20152015
    $v = $this->isSecure() ? ':443' : ':80';
    20162016
    }
    20172017
    $v = '0.0.0.0'.$v;

    src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -88,7 +88,7 @@ public function testGuessWithNonReadablePath()
    8888
    touch($path);
    8989
    @chmod($path, 0333);
    9090

    91-
    if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
    91+
    if (str_ends_with(sprintf('%o', fileperms($path)), '0333')) {
    9292
    $this->expectException(AccessDeniedException::class);
    9393
    MimeTypeGuesser::getInstance()->guess($path);
    9494
    } else {

    src/Symfony/Component/HttpKernel/DependencyInjection/AddAnnotatedClassesToCachePass.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -62,7 +62,7 @@ private function expandClasses(array $patterns, array $classes): array
    6262

    6363
    // Explicit classes declared in the patterns are returned directly
    6464
    foreach ($patterns as $key => $pattern) {
    65-
    if ('\\' !== substr($pattern, -1) && false === strpos($pattern, '*')) {
    65+
    if (!str_ends_with($pattern, '\\') && false === strpos($pattern, '*')) {
    6666
    unset($patterns[$key]);
    6767
    $expanded[] = ltrim($pattern, '\\');
    6868
    }

    src/Symfony/Component/Mime/Tests/AbstractMimeTypeGuesserTest.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -116,7 +116,7 @@ public function testGuessWithNonReadablePath()
    116116
    touch($path);
    117117
    @chmod($path, 0333);
    118118

    119-
    if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
    119+
    if (str_ends_with(sprintf('%o', fileperms($path)), '0333')) {
    120120
    $this->expectException(\InvalidArgumentException::class);
    121121
    $this->getGuesser()->guessMimeType($path);
    122122
    } else {

    src/Symfony/Component/Mime/composer.json

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -18,7 +18,8 @@
    1818
    "require": {
    1919
    "php": ">=7.1.3",
    2020
    "symfony/polyfill-intl-idn": "^1.10",
    21-
    "symfony/polyfill-mbstring": "^1.0"
    21+
    "symfony/polyfill-mbstring": "^1.0",
    22+
    "symfony/polyfill-php80": "^1.15"
    2223
    },
    2324
    "require-dev": {
    2425
    "egulias/email-validator": "^2.1.10|^3.1",

    src/Symfony/Component/OptionsResolver/OptionsResolver.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -927,7 +927,7 @@ public function offsetGet($option/*, bool $triggerDeprecation = true*/)
    927927
    $fmtAllowedTypes = implode('" or "', $this->allowedTypes[$option]);
    928928
    $fmtProvidedTypes = implode('|', array_keys($invalidTypes));
    929929
    $allowedContainsArrayType = \count(array_filter($this->allowedTypes[$option], static function ($item) {
    930-
    return '[]' === substr(self::TYPE_ALIASES[$item] ?? $item, -2);
    930+
    return str_ends_with(self::TYPE_ALIASES[$item] ?? $item, '[]');
    931931
    })) > 0;
    932932

    933933
    if (\is_array($value) && $allowedContainsArrayType) {

    src/Symfony/Component/OptionsResolver/composer.json

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -16,7 +16,8 @@
    1616
    }
    1717
    ],
    1818
    "require": {
    19-
    "php": ">=7.1.3"
    19+
    "php": ">=7.1.3",
    20+
    "symfony/polyfill-php80": "^1.15"
    2021
    },
    2122
    "autoload": {
    2223
    "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" },

    src/Symfony/Component/PropertyInfo/Util/PhpDocTypeHelper.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -108,7 +108,7 @@ private function createType(DocType $type, bool $nullable, string $docType = nul
    108108
    return null;
    109109
    }
    110110

    111-
    if ('[]' === substr($docType, -2)) {
    111+
    if (str_ends_with($docType, '[]')) {
    112112
    if ('mixed[]' === $docType) {
    113113
    $collectionKeyType = null;
    114114
    $collectionValueType = null;

    src/Symfony/Component/PropertyInfo/composer.json

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -24,7 +24,8 @@
    2424
    ],
    2525
    "require": {
    2626
    "php": ">=7.1.3",
    27-
    "symfony/inflector": "^3.4|^4.0|^5.0"
    27+
    "symfony/inflector": "^3.4|^4.0|^5.0",
    28+
    "symfony/polyfill-php80": "^1.15"
    2829
    },
    2930
    "require-dev": {
    3031
    "symfony/serializer": "^3.4|^4.0|^5.0",

    src/Symfony/Component/Routing/Generator/UrlGenerator.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -221,9 +221,9 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
    221221
    // so we need to encode them as they are not used for this purpose here
    222222
    // otherwise we would generate a URI that, when followed by a user agent (e.g. browser), does not match this route
    223223
    $url = strtr($url, ['/../' => '/%2E%2E/', '/./' => '/%2E/']);
    224-
    if ('/..' === substr($url, -3)) {
    224+
    if (str_ends_with($url, '/..')) {
    225225
    $url = substr($url, 0, -2).'%2E%2E';
    226-
    } elseif ('/.' === substr($url, -2)) {
    226+
    } elseif (str_ends_with($url, '/.')) {
    227227
    $url = substr($url, 0, -1).'%2E';
    228228
    }
    229229

    0 commit comments

    Comments
     (0)
    0