Skip to content

Commit 58115e7

Browse files
committed
Leverage str_starts_with(), str_ends_with() and str_contains()
1 parent e11a3e2 commit 58115e7

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Command/DebugFirewallCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ private function formatCallable(mixed $callable): string
242242

243243
if ($callable instanceof \Closure) {
244244
$r = new \ReflectionFunction($callable);
245-
if (false !== strpos($r->name, '{closure}')) {
245+
if (str_contains($r->name, '{closure}')) {
246246
return 'Closure()';
247247
}
248248
if ($class = $r->getClosureScopeClass()) {

DependencyInjection/MainConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
255255
return $requiredBadge;
256256
}
257257

258-
if (false === strpos($requiredBadge, '\\')) {
258+
if (!str_contains($requiredBadge, '\\')) {
259259
$fqcn = 'Symfony\Component\Security\Http\Authenticator\Passport\Badge\\'.$requiredBadge;
260260
if (class_exists($fqcn)) {
261261
return $fqcn;

DependencyInjection/Security/Factory/RememberMeFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function createAuthenticator(ContainerBuilder $container, string $firewal
112112

113113
foreach ($container->findTaggedServiceIds('security.remember_me_aware') as $serviceId => $attributes) {
114114
// register ContextListener
115-
if ('security.context_listener' === substr($serviceId, 0, 25)) {
115+
if (str_starts_with($serviceId, 'security.context_listener')) {
116116
continue;
117117
}
118118

Tests/Functional/Bundle/AuthenticatorBundle/ApiAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function supports(Request $request): ?bool
4040
public function authenticate(Request $request): Passport
4141
{
4242
$email = $request->headers->get('X-USER-EMAIL');
43-
if (false === strpos($email, '@')) {
43+
if (!str_contains($email, '@')) {
4444
throw new BadCredentialsException('Email is not a valid email address.');
4545
}
4646

0 commit comments

Comments
 (0)