Repository: symfony/symfony
File: src/Symfony/Component/Lock/Bridge/DynamoDb/Store/DynamoDbStore.php (PHP)

Code before:
    }

    public function delete(Key $key): void
    {
        $this->client->deleteItem(new DeleteItemInput([
            'TableName' => $this->tableName,
            'Key' => [
                $this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
            ],
        ]));
    }

    public function exists(Key $key): bool
    {
        $existingLock = $this->client->getItem(new GetItemInput([
            'TableName' => $this->tableName,
            'ConsistentRead' => true,
            'Key' => [
                $this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
            ],
        ]));

        $item = $existingLock->getItem();

        // Item not found at all
        if ([] === $item) {
            return false;
        }

        // We are not the owner
        if (!isset($item[$this->tokenAttr]) || $this->getUniqueToken($key) !== $item[$this->tokenAttr]->getS()) {
            return false;
        }

        // If item is expired, consider it doesn't exist
        return isset($item[$this->expirationAttr]) && ((float) $item[$this->expirationAttr]->getN()) > microtime(true);
    }

    public function putOffExpiration(Key $key, float $ttl): void
    {
        if ($ttl < 1) {
            throw new InvalidTtlException(\sprintf('"%s()" expects a TTL greater or equals to 1 second. Got "%s".', __METHOD__, $ttl));
        }

        $key->reduceLifetime($ttl);

        $uniqueToken = $this->getUniqueToken($key);

        try {
            $this->client->putItem(new PutItemInput([
                'TableName' => $this->tableName,

Review comment (suggestion):
we should have a cs-fixer rule about comparisons to empty values...
```suggestion
        if (!$item) {
```

Code after:
    }

    public function delete(Key $key): void
    {
        $this->client->deleteItem(new DeleteItemInput([
            'TableName' => $this->tableName,
            'Key' => [
                $this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
            ],
        ]));
    }

    public function exists(Key $key): bool
    {
        $existingLock = $this->client->getItem(new GetItemInput([
            'TableName' => $this->tableName,
            'ConsistentRead' => true,
            'Key' => [
                $this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
            ],
        ]));

        $item = $existingLock->getItem();

        // Item not found at all
        if (!$item) {
            return false;
        }

        // We are not the owner
        if (!isset($item[$this->tokenAttr]) || $this->getUniqueToken($key) !== $item[$this->tokenAttr]->getS()) {
            return false;
        }

        // If item is expired, consider it doesn't exist
        return isset($item[$this->expirationAttr]) && ((float) $item[$this->expirationAttr]->getN()) > microtime(true);
    }

    public function putOffExpiration(Key $key, float $ttl): void
    {
        if ($ttl < 1) {
            throw new InvalidTtlException(\sprintf('"%s()" expects a TTL greater or equals to 1 second. Got "%s".', __METHOD__, $ttl));
        }

        $key->reduceLifetime($ttl);

        $uniqueToken = $this->getUniqueToken($key);

        try {
            $this->client->putItem(new PutItemInput([
                'TableName' => $this->tableName,