ronantakizawa/codereview-bench huggingface dataset:
Repository: symfony/symfony
File: src/Symfony/Component/Yaml/Tests/ParserTest.php (PHP)

Code before:
foobar: "foo
    \\"bar\\"
    baz"
YAML;
        $expected = [
            'foobar' => 'foo "bar" baz',
        ];

        $this->assertSame($expected, $this->parser->parse($yaml));
    }

    public function testBackslashInQuotedMultiLineString()
    {
        $yaml = <<<YAML
foobar: "foo
    bar\\\\"
YAML;
        $expected = [
            'foobar' => 'foo bar\\',
        ];

        $this->assertSame($expected, $this->parser->parse($yaml));
    }

    /**
     * @dataProvider WrappedUnquotedStrings
     */
    public function testWrappedUnquotedStringWithMultipleSpacesInValue(string $yaml, array $expected)
    {
        $this->assertSame($expected, $this->parser->parse($yaml));
    }
    public static function WrappedUnquotedStrings() {
        return [
            'CurlyBraces' => [
                '{ foo: bar  bar, fiz: cat      cat }',
                [
                    'foo' => 'bar  bar',
                    'fiz' => 'cat      cat',
                ]
            ],
            'SquareBraces' => [
                '[ bar  bar, cat      cat ]',
                [
                    'bar  bar',
                    'cat      cat',
                ]
            ],
        ];
    }

    public function testParseMultiLineUnquotedString()

Review comment (suggestion):
```suggestion
     * @dataProvider wrappedUnquotedStringsProvider
```

Code after:
foobar: "foo
    \\"bar\\"
    baz"
YAML;
        $expected = [
            'foobar' => 'foo "bar" baz',
        ];

        $this->assertSame($expected, $this->parser->parse($yaml));
    }

    public function testBackslashInQuotedMultiLineString()
    {
        $yaml = <<<YAML
foobar: "foo
    bar\\\\"
YAML;
        $expected = [
            'foobar' => 'foo bar\\',
        ];

        $this->assertSame($expected, $this->parser->parse($yaml));
    }

    /**
     * @dataProvider wrappedUnquotedStringsProvider
     */
    public function testWrappedUnquotedStringWithMultipleSpacesInValue(string $yaml, array $expected)
    {
        $this->assertSame($expected, $this->parser->parse($yaml));
    }

    public static function wrappedUnquotedStringsProvider() {
        return [
            'mapping' => [
                '{ foo: bar  bar, fiz: cat      cat }',
                [
                    'foo' => 'bar  bar',
                    'fiz' => 'cat      cat',
                ]
            ],
            'sequence' => [
                '[ bar  bar, cat      cat ]',
                [
                    'bar  bar',
                    'cat      cat',
                ]
            ],
        ];
    }
Repository: symfony/symfony
File: src/Symfony/Component/Security/Core/User/PasswordAuthenticatedUserInterface.php (PHP)

Code before:
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Security\Core\User;

/**
 * For users that can be authenticated using a password.
 *
 * @author Robin Chalas <robin.chalas@gmail.com>
 * @author Wouter de Jong <wouter@wouterj.nl>
 */
interface PasswordAuthenticatedUserInterface
{
    /**
     * Returns the hashed password used to authenticate the user.
     *
     * Usually on authentication, a plain-text password will be compared to this value.
     *
     * The __serialize/__unserialize() magic methods can be implemented on the user
     * class to hashed passwords from being put in the session storage.
     */
    public function getPassword(): ?string;
}


Review comment (suggestion):
```suggestion
     * class to prevent hashed passwords from being put in the session storage.
```


Code after:
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Security\Core\User;

/**
 * For users that can be authenticated using a password.
 *
 * @author Robin Chalas <robin.chalas@gmail.com>
 * @author Wouter de Jong <wouter@wouterj.nl>
 */
interface PasswordAuthenticatedUserInterface
{
    /**
     * Returns the hashed password used to authenticate the user.
     *
     * Usually on authentication, a plain-text password will be compared to this value.
     *
     * The __serialize/__unserialize() magic methods can be implemented on the user
     * class to prevent hashed passwords from being put in the session storage.
     */
    public function getPassword(): ?string;
}
Repository: symfony/symfony
File: src/Symfony/Component/Security/Http/Authentication/AuthenticatorManager.php (PHP)

Code before:
    {
        if (!$token || !method_exists($token, 'eraseCredentials')) {
            return null;
        }

        static $genericImplementations = [];
        $m = null;

        if (!isset($genericImplementations[$token::class])) {
            $m = new \ReflectionMethod($token, 'eraseCredentials');
            $genericImplementations[$token::class] = AbstractToken::class === $m->getDeclaringClass()->name;
        }

        if ($genericImplementations[$token::class]) {
            return self::checkEraseCredentials($token->getUser());
        }

        static $deprecatedImplementations = [];

        if (!isset($deprecatedImplementations[$token::class])) {
            $m ??= new \ReflectionMethod($token, 'eraseCredentials');
            $deprecatedImplementations[$token::class] = !$m->getAttributes(\Deprecated::class);
        }

        if ($deprecatedImplementations[$token::class]) {
            trigger_deprecation('symfony/security-core', '7.3', 'Implementing "%s::eraseCredentials()" is deprecated since Symfony 7.3; add the #[\Deprecated] attribute on the method to signal its either empty or that you moved the logic elsewhere, typically to the "__serialize()" method.', get_debug_type($token));

            return $token;
        }

        return null;
    }
}


Review comment (bug):
```suggestion
            trigger_deprecation('symfony/security-http', '7.3', 'Implementing "%s::eraseCredentials()" is deprecated since Symfony 7.3; add the #[\Deprecated] attribute on the method to signal its either empty or that you moved the logic elsewhere, typically to the "__serialize()" method.', get_debug_type($token));
```


Code after:
    {
        if (!$token || !method_exists($token, 'eraseCredentials')) {
            return null;
        }

        static $genericImplementations = [];
        $m = null;

        if (!isset($genericImplementations[$token::class])) {
            $m = new \ReflectionMethod($token, 'eraseCredentials');
            $genericImplementations[$token::class] = AbstractToken::class === $m->class;
        }

        if ($genericImplementations[$token::class]) {
            return self::checkEraseCredentials($token->getUser());
        }

        static $deprecatedImplementations = [];

        if (!isset($deprecatedImplementations[$token::class])) {
            $m ??= new \ReflectionMethod($token, 'eraseCredentials');
            $deprecatedImplementations[$token::class] = !$m->getAttributes(\Deprecated::class);
        }

        if ($deprecatedImplementations[$token::class]) {
            trigger_deprecation('symfony/security-http', '7.3', 'Implementing "%s::eraseCredentials()" is deprecated since Symfony 7.3; add the #[\Deprecated] attribute on the method to signal its either empty or that you moved the logic elsewhere, typically to the "__serialize()" method.', get_debug_type($token));

            return $token;
        }

        return null;
    }
}
Repository: symfony/symfony
File: src/Symfony/Component/Ldap/Security/LdapUser.php (PHP)

Code before:
        return $this->roles;
    }

    public function getPassword(): ?string
    {
        return $this->password;
    }

    public function getSalt(): ?string
    {
        return null;
    }

    public function getUserIdentifier(): string
    {
        return $this->identifier;
    }

    /**
     * @deprecated since Symfony 7.3
     */
    #[\Deprecated(since: 'symfony/security-core 7.3')]
    public function eraseCredentials(): void
    {
        if (\PHP_VERSION_ID < 80400) {
            @trigger_error(\sprintf('Method %s::eraseCredentials() is deprecated since symfony/security-core 7.3', self::class), \E_USER_DEPRECATED);
        }

        $this->password = null;
    }

    public function getExtraFields(): array
    {
        return $this->extraFields;
    }

    public function setPassword(#[\SensitiveParameter] ?string $password): void
    {
        $this->password = $password;
    }

    public function isEqualTo(UserInterface $user): bool
    {
        if (!$user instanceof self) {
            return false;
        }

        if ($this->getPassword() !== $user->getPassword()) {
            return false;
        }


Review comment (security):
```suggestion
            @trigger_error(\sprintf('Method %s::eraseCredentials() is deprecated since symfony/ldap 7.3', self::class), \E_USER_DEPRECATED);
```


Code after:
        return $this->roles;
    }

    public function getPassword(): ?string
    {
        return $this->password;
    }

    public function getSalt(): ?string
    {
        return null;
    }

    public function getUserIdentifier(): string
    {
        return $this->identifier;
    }

    /**
     * @deprecated since Symfony 7.3
     */
    #[\Deprecated(since: 'symfony/ldap 7.3')]
    public function eraseCredentials(): void
    {
        if (\PHP_VERSION_ID < 80400) {
            @trigger_error(\sprintf('Method %s::eraseCredentials() is deprecated since symfony/ldap 7.3', self::class), \E_USER_DEPRECATED);
        }

        $this->password = null;
    }

    public function getExtraFields(): array
    {
        return $this->extraFields;
    }

    public function setPassword(#[\SensitiveParameter] ?string $password): void
    {
        $this->password = $password;
    }

    public function isEqualTo(UserInterface $user): bool
    {
        if (!$user instanceof self) {
            return false;
        }

        if ($this->getPassword() !== $user->getPassword()) {
            return false;
        }
Repository: symfony/symfony
File: src/Symfony/Component/Ldap/Security/LdapUser.php (PHP)

Code before:
    }

    public function getRoles(): array
    {
        return $this->roles;
    }

    public function getPassword(): ?string
    {
        return $this->password;
    }

    public function getSalt(): ?string
    {
        return null;
    }

    public function getUserIdentifier(): string
    {
        return $this->identifier;
    }

    /**
     * @deprecated since Symfony 7.3
     */
    #[\Deprecated(since: 'symfony/security-core 7.3')]
    public function eraseCredentials(): void
    {
        if (\PHP_VERSION_ID < 80400) {
            @trigger_error(\sprintf('Method %s::eraseCredentials() is deprecated since symfony/security-core 7.3', self::class), \E_USER_DEPRECATED);
        }

        $this->password = null;
    }

    public function getExtraFields(): array
    {
        return $this->extraFields;
    }

    public function setPassword(#[\SensitiveParameter] ?string $password): void
    {
        $this->password = $password;
    }

    public function isEqualTo(UserInterface $user): bool
    {
        if (!$user instanceof self) {
            return false;
        }


Review comment (suggestion):
```suggestion
    #[\Deprecated(since: 'symfony/ldap 7.3')]
```


Code after:
    }

    public function getRoles(): array
    {
        return $this->roles;
    }

    public function getPassword(): ?string
    {
        return $this->password;
    }

    public function getSalt(): ?string
    {
        return null;
    }

    public function getUserIdentifier(): string
    {
        return $this->identifier;
    }

    /**
     * @deprecated since Symfony 7.3
     */
    #[\Deprecated(since: 'symfony/ldap 7.3')]
    public function eraseCredentials(): void
    {
        if (\PHP_VERSION_ID < 80400) {
            @trigger_error(\sprintf('Method %s::eraseCredentials() is deprecated since symfony/ldap 7.3', self::class), \E_USER_DEPRECATED);
        }

        $this->password = null;
    }

    public function getExtraFields(): array
    {
        return $this->extraFields;
    }

    public function setPassword(#[\SensitiveParameter] ?string $password): void
    {
        $this->password = $password;
    }

    public function isEqualTo(UserInterface $user): bool
    {
        if (!$user instanceof self) {
            return false;
        }
Repository: symfony/symfony
File: src/Symfony/Component/DependencyInjection/Definition.php (PHP)

Code before:
    {
        return $this->tags;
    }

    /**
     * Gets a tag by name.
     */
    public function getTag(string $name): array
    {
        return $this->tags[$name] ?? [];
    }

    /**
     * Adds a tag for this definition.
     *
     * @return $this
     */
    public function addTag(string $name, array $attributes = []): static
    {
        $this->tags[$name][] = $attributes;

        return $this;
    }

    /**
     * Add a tag to the definition and marks it as a value object.
     *
     * @return $this
     */
    public function tagAsValueObject(string $name, array $attributes = []): static
    {
        return $this->addTag($name, $attributes)
            ->addTag('container.excluded', ['source' => \sprintf('by tag "%s"', $name)])
            ->setAbstract(true);
    }

    /**
     * Whether this definition has a tag with the given name.
     */
    public function hasTag(string $name): bool
    {
        return isset($this->tags[$name]);
    }

    /**
     * Clears all tags for a given name.
     *
     * @return $this
     */
    public function clearTag(string $name): static
    {

Review comment (suggestion):
```suggestion
     * Adds a tag to the definition and marks it as a value object.
```

Code after:
    {
        return $this->tags;
    }

    /**
     * Gets a tag by name.
     */
    public function getTag(string $name): array
    {
        return $this->tags[$name] ?? [];
    }

    /**
     * Adds a tag for this definition.
     *
     * @return $this
     */
    public function addTag(string $name, array $attributes = []): static
    {
        $this->tags[$name][] = $attributes;

        return $this;
    }

    /**
     * Adds a tag to the definition and marks it as excluded.
     *
     * These definitions should be processed using {@see ContainerBuilder::findExcludedServiceIds()}
     *
     * @return $this
     */
    public function addExcludeTag(string $name, array $attributes = []): static
    {
        return $this->addTag($name, $attributes)
            ->addTag('container.excluded', ['source' => \sprintf('by tag "%s"', $name)])
            ->setAbstract(true);
    }

    /**
     * Whether this definition has a tag with the given name.
     */
    public function hasTag(string $name): bool
    {
        return isset($this->tags[$name]);
    }

    /**
     * Clears all tags for a given name.
     *
     * @return $this
     */
Repository: symfony/symfony
File: src/Symfony/Component/DependencyInjection/Definition.php (PHP)

Code before:
    {
        return $this->tags;
    }

    /**
     * Gets a tag by name.
     */
    public function getTag(string $name): array
    {
        return $this->tags[$name] ?? [];
    }

    /**
     * Adds a tag for this definition.
     *
     * @return $this
     */
    public function addTag(string $name, array $attributes = []): static
    {
        $this->tags[$name][] = $attributes;

        return $this;
    }

    /**
     * Add a tag to the definition and marks it as a value object.
     *
     * @return $this
     */
    public function tagAsValueObject(string $name, array $attributes = []): static
    {
        return $this->addTag($name, $attributes)
            ->addTag('container.excluded', ['source' => \sprintf('by tag "%s"', $name)])
            ->setAbstract(true);
    }

    /**
     * Whether this definition has a tag with the given name.
     */
    public function hasTag(string $name): bool
    {
        return isset($this->tags[$name]);
    }

    /**
     * Clears all tags for a given name.
     *
     * @return $this
     */
    public function clearTag(string $name): static
    {

Review comment (suggestion):
```suggestion
     * Add a tag to the definition and mark it as a value object.
```

Code after:
    {
        return $this->tags;
    }

    /**
     * Gets a tag by name.
     */
    public function getTag(string $name): array
    {
        return $this->tags[$name] ?? [];
    }

    /**
     * Adds a tag for this definition.
     *
     * @return $this
     */
    public function addTag(string $name, array $attributes = []): static
    {
        $this->tags[$name][] = $attributes;

        return $this;
    }

    /**
     * Adds a tag to the definition and marks it as excluded.
     *
     * These definitions should be processed using {@see ContainerBuilder::findExcludedServiceIds()}
     *
     * @return $this
     */
    public function addExcludeTag(string $name, array $attributes = []): static
    {
        return $this->addTag($name, $attributes)
            ->addTag('container.excluded', ['source' => \sprintf('by tag "%s"', $name)])
            ->setAbstract(true);
    }

    /**
     * Whether this definition has a tag with the given name.
     */
    public function hasTag(string $name): bool
    {
        return isset($this->tags[$name]);
    }

    /**
     * Clears all tags for a given name.
     *
     * @return $this
     */
Repository: symfony/symfony
File: src/Symfony/Component/DependencyInjection/Definition.php (PHP)

Code before:
    }

    /**
     * Gets a tag by name.
     */
    public function getTag(string $name): array
    {
        return $this->tags[$name] ?? [];
    }

    /**
     * Adds a tag for this definition.
     *
     * @return $this
     */
    public function addTag(string $name, array $attributes = []): static
    {
        $this->tags[$name][] = $attributes;

        return $this;
    }

    /**
     * Adds a tag to the definition and marks it as excluded.
     *
     * This definitions must be processed using {@see ContainerBuilder::findExcludedServiceIds()}
     *
     * @return $this
     */
    public function addExcludeTag(string $name, array $attributes = []): static
    {
        return $this->addTag($name, $attributes)
            ->addTag('container.excluded', ['source' => \sprintf('by tag "%s"', $name)])
            ->setAbstract(true);
    }

    /**
     * Whether this definition has a tag with the given name.
     */
    public function hasTag(string $name): bool
    {
        return isset($this->tags[$name]);
    }

    /**
     * Clears all tags for a given name.
     *
     * @return $this
     */
    public function clearTag(string $name): static
    {

Review comment (suggestion):
```suggestion
     * This definitions should be processed using {@see ContainerBuilder::findExcludedServiceIds()}
```

Code after:
    }

    /**
     * Gets a tag by name.
     */
    public function getTag(string $name): array
    {
        return $this->tags[$name] ?? [];
    }

    /**
     * Adds a tag for this definition.
     *
     * @return $this
     */
    public function addTag(string $name, array $attributes = []): static
    {
        $this->tags[$name][] = $attributes;

        return $this;
    }

    /**
     * Adds a tag to the definition and marks it as excluded.
     *
     * These definitions should be processed using {@see ContainerBuilder::findExcludedServiceIds()}
     *
     * @return $this
     */
    public function addExcludeTag(string $name, array $attributes = []): static
    {
        return $this->addTag($name, $attributes)
            ->addTag('container.excluded', ['source' => \sprintf('by tag "%s"', $name)])
            ->setAbstract(true);
    }

    /**
     * Whether this definition has a tag with the given name.
     */
    public function hasTag(string $name): bool
    {
        return isset($this->tags[$name]);
    }

    /**
     * Clears all tags for a given name.
     *
     * @return $this
     */
    public function clearTag(string $name): static
    {
Repository: symfony/symfony
File: src/Symfony/Component/DependencyInjection/Definition.php (PHP)

Code before:
    }

    /**
     * Gets a tag by name.
     */
    public function getTag(string $name): array
    {
        return $this->tags[$name] ?? [];
    }

    /**
     * Adds a tag for this definition.
     *
     * @return $this
     */
    public function addTag(string $name, array $attributes = []): static
    {
        $this->tags[$name][] = $attributes;

        return $this;
    }

    /**
     * Adds a tag to the definition and marks it as excluded.
     *
     * This definitions should be processed using {@see ContainerBuilder::findExcludedServiceIds()}
     *
     * @return $this
     */
    public function addExcludeTag(string $name, array $attributes = []): static
    {
        return $this->addTag($name, $attributes)
            ->addTag('container.excluded', ['source' => \sprintf('by tag "%s"', $name)])
            ->setAbstract(true);
    }

    /**
     * Whether this definition has a tag with the given name.
     */
    public function hasTag(string $name): bool
    {
        return isset($this->tags[$name]);
    }

    /**
     * Clears all tags for a given name.
     *
     * @return $this
     */
    public function clearTag(string $name): static
    {

Review comment (suggestion):

```suggestion
     * These definitions should be processed using {@see ContainerBuilder::findExcludedServiceIds()}
```


Code after:
    }

    /**
     * Gets a tag by name.
     */
    public function getTag(string $name): array
    {
        return $this->tags[$name] ?? [];
    }

    /**
     * Adds a tag for this definition.
     *
     * @return $this
     */
    public function addTag(string $name, array $attributes = []): static
    {
        $this->tags[$name][] = $attributes;

        return $this;
    }

    /**
     * Adds a tag to the definition and marks it as excluded.
     *
     * These definitions should be processed using {@see ContainerBuilder::findExcludedServiceIds()}
     *
     * @return $this
     */
    public function addExcludeTag(string $name, array $attributes = []): static
    {
        return $this->addTag($name, $attributes)
            ->addTag('container.excluded', ['source' => \sprintf('by tag "%s"', $name)])
            ->setAbstract(true);
    }

    /**
     * Whether this definition has a tag with the given name.
     */
    public function hasTag(string $name): bool
    {
        return isset($this->tags[$name]);
    }

    /**
     * Clears all tags for a given name.
     *
     * @return $this
     */
    public function clearTag(string $name): static
    {