8000 Leverage str_contains/str_starts_with · symfony/symfony@79a37f3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 79a37f3

Browse files
committed
Leverage str_contains/str_starts_with
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent a850da5 commit 79a37f3

File tree

302 files changed

+569
-527
lines changed
  • Validator
  • VarDumper
  • VarExporter
  • Yaml
  • Some content is hidden

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

    302 files changed

    +569
    -527
    lines changed

    composer.json

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -49,7 +49,7 @@
    4949
    "symfony/polyfill-mbstring": "~1.0",
    5050
    "symfony/polyfill-php72": "~1.5",
    5151
    "symfony/polyfill-php73": "^1.11",
    52-
    "symfony/polyfill-php80": "^1.15",
    52+
    "symfony/polyfill-php80": "^1.16",
    5353
    "symfony/polyfill-php81": "^1.22"
    5454
    },
    5555
    "replace": {

    src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -208,7 +208,7 @@ protected function registerMappingDrivers($objectManager, ContainerBuilder $cont
    208208
    ]);
    209209
    }
    210210
    $mappingDriverDef->setPublic(false);
    211-
    if (false !== strpos($mappingDriverDef->getClass(), 'yml') || false !== strpos($mappingDriverDef->getClass(), 'xml')) {
    211+
    if (str_contains($mappingDriverDef->getClass(), 'yml') || str_contains($mappingDriverDef->getClass(), 'xml')) {
    212212
    $mappingDriverDef->setArguments([array_flip($driverPaths)]);
    213213
    $mappingDriverDef->addMethodCall('setGlobalBasename', ['mapping']);
    214214
    }

    src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -68,7 +68,7 @@ public function getProperties($class, array $context = [])
    6868

    6969
    if ($metadata instanceof ClassMetadataInfo && class_exists(\Doctrine\ORM\Mapping\Embedded::class) && $metadata->embeddedClasses) {
    7070
    $properties = array_filter($properties, function ($property) {
    71-
    return false === strpos($property, '.');
    71+
    return !str_contains($property, '.');
    7272
    });
    7373

    7474
    $properties = array_merge($properties, array_keys($metadata->embeddedClasses));

    src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -144,7 +144,7 @@ private function getClass(): string
    144144
    if (null === $this->class) {
    145145
    $class = $this->classOrAlias;
    146146

    147-
    if (false !== strpos($class, ':')) {
    147+
    if (str_contains($class, ':')) {
    148148
    $class = $this->getClassMetadata()->getName();
    149149
    }
    150150

    src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -104,7 +104,7 @@ public function loadClassMetadata(ClassMetadata $metadata): bool
    104104
    }
    105105

    106106
    if (null === $lengthConstraint) {
    107-
    if (isset($mapping['originalClass']) && false === strpos($mapping['declaredField'], '.')) {
    107+
    if (isset($mapping['originalClass']) && !str_contains($mapping['declaredField'], '.')) {
    108108
    $metadata->addPropertyConstraint($mapping['declaredField'], new Valid());
    109109
    $loaded = true;
    110110
    } elseif (property_exists($className, $mapping['fieldName'])) {

    src/Symfony/Bridge/Doctrine/composer.json

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -21,6 +21,7 @@
    2121
    "doctrine/persistence": "^1.3|^2",
    2222
    "symfony/polyfill-ctype": "~1.8",
    2323
    "symfony/polyfill-mbstring": "~1.0",
    24+
    "symfony/polyfill-php80": "^1.16",
    2425
    "symfony/service-contracts": "^1.1|^2"
    2526
    },
    2627
    "require-dev": {

    src/Symfony/Bridge/Monolog/Command/ServerLogCommand.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
    9797
    'multiline' => OutputInterface::VERBOSITY_DEBUG <= $output->getVerbosity(),
    9898
    ]));
    9999

    100-
    if (false === strpos($host = $input->getOption('host'), '://')) {
    100+
    if (!str_contains($host = $input->getOption('host'), '://')) {
    101101
    $host = 'tcp://'.$host;
    102102
    }
    103103

    src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -163,7 +163,7 @@ private function replacePlaceHolder(array $record): array
    163163
    {
    164164
    $message = $record['message'];
    165165

    166-
    if (false === strpos($message, '{')) {
    166+
    if (!str_contains($message, '{')) {
    167167
    return $record;
    168168
    }
    169169

    src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -32,7 +32,7 @@ public function __construct(string $host, $level = Logger::DEBUG, bool $bubble =
    3232
    {
    3333
    parent::__construct($level, $bubble);
    3434

    35-
    if (false === strpos($host, '://')) {
    35+
    if (!str_contains($host, '://')) {
    3636
    $host = 'tcp://'.$host;
    3737
    }
    3838

    src/Symfony/Bridge/Monolog/composer.json

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -19,7 +19,8 @@
    1919
    "php": ">=7.1.3",
    2020
    "monolog/monolog": "^1.25.1",
    2121
    "symfony/service-contracts": "^1.1|^2",
    22-
    "symfony/http-kernel": "^4.3"
    22+
    "symfony/http-kernel": "^4.3",
    23+
    "symfony/polyfill-php80": "^1.16"
    2324
    },
    2425
    "require-dev": {
    2526
    "symfony/console": "^3.4|^4.0|^5.0",

    src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -28,12 +28,12 @@ public function generate(\ReflectionClass $originalClass, ClassGenerator $classG
    2828
    parent::generate($originalClass, $classGenerator, $proxyOptions);
    2929

    3030
    foreach ($classGenerator->getMethods() as $method) {
    31-
    if (0 === strpos($originalClass->getFilename(), __FILE__)) {
    31+
    if (str_starts_with($originalClass->getFilename(), __FILE__)) {
    3232
    $method->setBody(str_replace(var_export($originalClass->name, true), '__CLASS__', $method->getBody()));
    3333
    }
    3434
    }
    3535

    36-
    if (0 === strpos($originalClass->getFilename(), __FILE__)) {
    36+
    if (str_starts_with($originalClass->getFilename(), __FILE__)) {
    3737
    $interfaces = $classGenerator->getImplementedInterfaces();
    3838
    array_pop($interfaces);
    3939
    $classGenerator->setImplementedInterfaces(array_merge($interfaces, $originalClass->getInterfaceNames()));

    src/Symfony/Bridge/ProxyManager/composer.json

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -19,7 +19,8 @@
    1919
    "php": ">=7.1.3",
    2020
    "composer/package-versions-deprecated": "^1.8",
    2121
    "friendsofphp/proxy-manager-lts": "^1.0.2",
    22-
    "symfony/dependency-injection": "^4.0|^5.0"
    22+
    "symfony/dependency-injection": "^4.0|^5.0",
    23+
    "symfony/polyfill-php80": "^1.16"
    2324
    },
    2425
    "require-dev": {
    2526
    "symfony/config": "^3.4|^4.0|^5.0"

    src/Symfony/Bridge/Twig/Command/DebugCommand.php

    Lines changed: 6 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -225,7 +225,7 @@ private function displayGeneralText(SymfonyStyle $io, string $filter = null)
    225225
    foreach ($types as $index => $type) {
    226226
    $items = [];
    227227
    foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) {
    228-
    if (!$filter || false !== strpos($name, $filter)) {
    228+
    if (!$filter || str_contains($name, $filter)) {
    229229
    $items[$name] = $name.$this->getPrettyMetadata($type, $entity, $decorated);
    230230
    }
    231231
    }
    @@ -259,7 +259,7 @@ private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
    259259
    $data = [];
    260260
    foreach ($types as $type) {
    261261
    foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) {
    262-
    if (!$filter || false !== strpos($name, $filter)) {
    262+
    if (!$filter || str_contains($name, $filter)) {
    263263
    $data[$type][$name] = $this->getMetadata($type, $entity);
    264264
    }
    265265
    }
    @@ -409,7 +409,7 @@ private function findWrongBundleOverrides(): array
    409409
    $folders = glob($this->rootDir.'/Resources/*/views', \GLOB_ONLYDIR);
    410410
    $relativePath = ltrim(substr($this->rootDir.\DIRECTORY_SEPARATOR.'Resources/', \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
    411411
    $bundleNames = array_reduce($folders, function ($carry, $absolutePath) use ($relativePath) {
    412-
    if (0 === strpos($absolutePath, $this->projectDir)) {
    412+
    if (str_starts_with($absolutePath, $this->projectDir)) {
    413413
    $name = basename(\dirname($absolutePath));
    414414
    $path = ltrim($relativePath.$name, \DIRECTORY_SEPARATOR);
    415415
    $carry[$name] = $path;
    @@ -425,7 +425,7 @@ private function findWrongBundleOverrides(): array
    425425
    $folders = glob($this->twigDefaultPath.'/bundles/*', \GLOB_ONLYDIR);
    426426
    $relativePath = ltrim(substr($this->twigDefaultPath.'/bundles/', \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
    427427
    $bundleNames = array_reduce($folders, function ($carry, $absolutePath) use ($relativePath) {
    428-
    if (0 === strpos($absolutePath, $this->projectDir)) {
    428+
    if (str_starts_with($absolutePath, $this->projectDir)) {
    429429
    $name = basename($absolutePath);
    430430
    $path = ltrim($relativePath.$name, \DIRECTORY_SEPARATOR);
    431431
    $carry[$name] = $path;
    @@ -555,7 +555,7 @@ private function findAlternatives(string $name, array $collection): array
    555555
    $alternatives = [];
    556556
    foreach ($collection as $item) {
    557557
    $lev = levenshtein($name, $item);
    558-
    if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
    558+
    if ($lev <= \strlen($name) / 3 || str_contains($item, $name)) {
    559559
    $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
    560560
    }
    561561
    }
    @@ -569,7 +569,7 @@ private function findAlternatives(string $name, array $collection): array
    569569

    570570
    private function getRelativePath(string $path): string
    571571
    {
    572-
    if (null !== $this->projectDir && 0 === strpos($path, $this->projectDir)) {
    572+
    if (null !== $this->projectDir && str_starts_with($path, $this->projectDir)) {
    573573
    return ltrim(substr($path, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
    574574
    }
    575575

    src/Symfony/Bridge/Twig/Extension/CodeExtension.php

    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -71,7 +71,7 @@ public function abbrClass($class)
    7171

    7272
    public function abbrMethod($method)
    7373
    {
    74-
    if (false !== strpos($method, '::')) {
    74+
    if (str_contains($method, '::')) {
    7575
    [$class, $method] = explode('::', $method, 2);
    7676
    $result = sprintf('%s::%s()', $this->abbrClass($class), $method);
    7777
    } elseif ('Closure' === $method) {
    @@ -219,7 +219,7 @@ public function getFileRelative(string $file): ?string
    219219
    {
    220220
    $file = str_replace('\\', '/', $file);
    221221

    222-
    if (null !== $this->projectDir && 0 === strpos($file, $this->projectDir)) {
    222+
    if (null !== $this->projectDir && str_starts_with($file, $this->projectDir)) {
    223223
    return ltrim(substr($file, \strlen($this->projectDir)), '/');
    224224
    }
    225225

    @@ -238,7 +238,7 @@ public function formatFileFromText($text)
    238238
    */
    239239
    public function formatLogMessage(string $message, array $context): string
    240240
    {
    241-
    if ($context && false !== strpos($message, '{')) {
    241+
    if ($context && str_contains($message, '{')) {
    242242
    $replacements = [];
    243243
    foreach ($context as $key => $val) {
    244244
    if (is_scalar($val)) {

    src/Symfony/Bridge/Twig/composer.json

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -17,6 +17,7 @@
    1717
    ],
    1818
    "require": {
    1919
    "php": ">=7.1.3",
    20+
    "symfony/polyfill-php80": "^1.16",
    2021
    "symfony/translation-contracts": "^1.1|^2",
    2122
    "twig/twig": "^1.43|^2.13|^3.0.4"
    2223
    },

    src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -59,7 +59,7 @@ public function load(array $configs, ContainerBuilder $container)
    5959
    $container->getDefinition('var_dumper.command.server_dump')
    6060
    ->setClass(ServerDumpPlaceholderCommand::class)
    6161
    ;
    62-
    } elseif (0 === strpos($config['dump_destination'], 'tcp://')) {
    62+
    } elseif (str_starts_with($config['dump_destination'], 'tcp://')) {
    6363
    $container->getDefinition('debug.dump_listener')
    6464
    ->replaceArgument(2, new Reference('var_dumper.server_connection'))
    6565
    ;

    src/Symfony/Bundle/DebugBundle/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
    "ext-xml": "*",
    2121
    "symfony/http-kernel": "^3.4|^4.0|^5.0",
    22+
    "symfony/polyfill-php80": "^1.16",
    2223
    "symfony/twig-bridge": "^3.4|^4.0|^5.0",
    2324
    "symfony/var-dumper": "^4.1.1|^5.0"
    2425
    },

    src/Symfony/Bundle/FrameworkBundle/Client.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -167,7 +167,7 @@ protected function getScript($request)
    167167

    168168
    $requires = '';
    169169
    foreach (get_declared_classes() as $class) {
    170-
    if (0 === strpos($class, 'ComposerAutoloaderInit')) {
    170+
    if (str_starts_with($class, 'ComposerAutoloaderInit')) {
    171171
    $r = new \ReflectionClass($class);
    172172
    $file = \dirname($r->getFileName(), 2).'/autoload.php';
    173173
    if (file_exists($file)) {

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

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -142,7 +142,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
    142142
    }
    143143
    $mount = implode(' ', $mount).'/';
    144144

    145-
    if (0 === strpos($realCacheDir, $mount)) {
    145+
    if (str_starts_with($realCacheDir, $mount)) {
    146146
    $io->note('For better performances, you should move the cache and log directories to a non-shared folder of the VM.');
    147147
    $oldCacheDir = false;
    148148
    break;

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

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -270,7 +270,7 @@ private function findServiceIdsContaining(ContainerBuilder $builder, string $nam
    270270
    $serviceIds = $builder->getServiceIds();
    271271
    $foundServiceIds = $foundServiceIdsIgnoringBackslashes = [];
    272272
    foreach ($serviceIds as $serviceId) {
    273-
    if (!$showHidden && 0 === strpos($serviceId, '.')) {
    273+
    if (!$showHidden && str_starts_with($serviceId, '.')) {
    274274
    continue;
    275275
    }
    276276
    if (false !== stripos(str_replace('\\', '', $serviceId), $name)) {
    @@ -295,7 +295,7 @@ public function filterToServiceTypes(string $serviceId): bool
    295295
    }
    296296

    297297
    // if the id has a \, assume it is a class
    298-
    if (false !== strpos($serviceId, '\\')) {
    298+
    if (str_contains($serviceId, '\\')) {
    299299
    return true;
    300300
    }
    301301

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

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -104,7 +104,7 @@ private function getContainerBuilder(): ContainerBuilder
    104104

    105105
    $skippedIds = [];
    106106
    foreach ($container->getServiceIds() as $serviceId) {
    107-
    if (0 === strpos($serviceId, '.errored.')) {
    107+
    if (str_starts_with($serviceId, '.errored.')) {
    108108
    $skippedIds[$serviceId] = true;
    109109
    }
    110110
    }

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

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
    8080

    8181
    if ($search = $input->getArgument('search')) {
    8282
    $serviceIds = array_filter($serviceIds, function ($serviceId) use ($search) {
    83-
    return false !== stripos(str_replace('\\', '', $serviceId), $search) && 0 !== strpos($serviceId, '.');
    83+
    return false !== stripos(str_replace('\\', '', $serviceId), $search) && !str_starts_with($serviceId, '.');
    8484
    });
    8585

    8686
    if (empty($serviceIds)) {
    @@ -104,7 +104,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
    104104
    foreach ($serviceIds as $serviceId) {
    105105
    $text = [];
    106106
    $resolvedServiceId = $serviceId;
    107-
    if (0 !== strpos($serviceId, $previousId)) {
    107+
    if (!str_starts_with($serviceId, $previousId)) {
    108108
    $text[] = '';
    109109
    if ('' !== $description = Descriptor::getClassDescription($serviceId, $resolvedServiceId)) {
    110110
    if (isset($hasAlias[$serviceId])) {

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

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -37,7 +37,7 @@ public function __construct()
    3737
    };
    3838

    3939
    $isReadableProvider = function ($fileOrDirectory, $default) {
    40-
    return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
    40+
    return str_starts_with($fileOrDirectory, '@') || $default($fileOrDirectory);
    4141
    };
    4242

    4343
    parent::__construct(null, $directoryIteratorProvider, $isReadableProvider);

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

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -36,7 +36,7 @@ public function __construct()
    3636
    };
    3737

    3838
    $isReadableProvider = function ($fileOrDirectory, $default) {
    39-
    return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
    39+
    return str_starts_with($fileOrDirectory, '@') || $default($fileOrDirectory);
    4040
    };
    4141

    4242
    parent::__construct(null, $directoryIteratorProvider, $isReadableProvider);

    src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -286,7 +286,7 @@ private function getCallableData($callable): array
    286286
    $data['name'] = $callable[1];
    287287
    $data['class'] = \get_class($callable[0]);
    288288
    } else {
    289-
    if (0 !== strpos($callable[1], 'parent::')) {
    289+
    if (!str_starts_with($callable[1], 'parent::')) {
    290290
    $data['name'] = $callable[1];
    291291
    $data['class'] = $callable[0];
    292292
    $data['static'] = true;
    @@ -304,7 +304,7 @@ private function getCallableData($callable): array
    304304
    if (\is_string($callable)) {
    305305
    $data['type'] = 'function';
    306306

    307-
    if (false === strpos($callable, '::')) {
    307+
    if (!str_contains($callable, '::')) {
    308308
    $data['name'] = $callable;
    309309
    } else {
    310310
    $callableParts = explode('::', $callable);
    @@ -321,7 +321,7 @@ private function getCallableData($callable): array
    321321
    $data['type'] = 'closure';
    322322

    323323
    $r = new \ReflectionFunction($callable);
    324-
    if (false !== strpos($r->name, '{closure}')) {
    324+
    if (str_contains($r->name, '{closure}')) {
    325325
    return $data;
    326326
    }
    327327
    $data['name'] = $r->name;

    src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -300,7 +300,7 @@ protected function describeCallable($callable, array $options = [])
    300300
    $string .= "\n".sprintf('- Name: `%s`', $callable[1]);
    301301
    $string .= "\n".sprintf('- Class: `%s`', \get_class($callable[0]));
    302302
    } else {
    303-
    if (0 !== strpos($callable[1], 'parent::')) {
    303+
    if (!str_starts_with($callable[1], 'parent::')) {
    304304
    $string .= "\n".sprintf('- Name: `%s`', $callable[1]);
    305305
    $string .= "\n".sprintf('- Class: `%s`', $callable[0]);
    306306
    $string .= "\n- Static: yes";
    @@ -318,7 +318,7 @@ protected function describeCallable($callable, array $options = [])
    318318
    if (\is_string($callable)) {
    319319
    $string .= "\n- Type: `function`";
    320320

    321-
    if (false === strpos($callable, '::')) {
    321+
    if (!str_contains($callable, '::')) {
    322322
    $string .= "\n".sprintf('- Name: `%s`', $callable);
    323323
    } else {
    324324
    $callableParts = explode('::', $callable);
    @@ -335,7 +335,7 @@ protected function describeCallable($callable, array $options = [])
    335335
    $string .= "\n- Type: `closure`";
    336336

    337337
    $r = new \ReflectionFunction($callable);
    338-
    if (false !== strpos($r->name, '{closure}')) {
    338+
    if (str_contains($r->name, '{closure}')) {
    339339
    return $this->write($string."\n");
    340340
    }
    341341
    $string .= "\n".sprintf('- Name: `%s`', $r->name);

    src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -514,7 +514,7 @@ private function formatControllerLink($controller, string $anchorText): string
    514514
    $r = new \ReflectionMethod($controller, '__invoke');
    515515
    } elseif (!\is_string($controller)) {
    516516
    return $anchorText;
    517-
    } elseif (false !== strpos($controller, '::')) {
    517+
    } elseif (str_contains($controller, '::')) {
    518518
    $r = new \ReflectionMethod($controller);
    519519
    } else {
    520520
    $r = new \ReflectionFunction($controller);
    @@ -547,7 +547,7 @@ private function formatCallable($callable): string
    547547

    548548
    if ($callable instanceof \Closure) {
    549549
    $r = new \ReflectionFunction($callable);
    550-
    if (false !== strpos($r->name, '{closure}')) {
    550+
    if (str_contains($r->name, '{closure}')) {
    551551
    return 'Closure()';
    552552
    }
    553553
    if ($class = $r->getClosureScopeClass()) {

    0 commit comments

    Comments
     (0)
    0