Skip to content

Upgrading from 3.x to 4.x: migrating ValidationData with $currentTime #812

@ozahorulia

Description

@ozahorulia

Hello! I'm migrating code written by another developer, and I can see several validation calls, which look like this:

    $validationData = new ValidationData($this->getNowTime() + self::TTL_TIME_LIMIT);
    if (!$token->validate($validationData)) {
        // ...
    }

    $validationData = new ValidationData($this->getNowTime());
    if (!$token->validate($validationData)) {
        // ...
    }

From the upgrading steps I can see that validation is now done like this:

!$this->configuration->validator()->validate($token, ...$this->configuration->validationConstraints())

But I can not see how can I pass the $currentTime argument with new API. And as you can see, in the old code it's not always an actual current time as in the first call (as I understand it's done to see if token will be expired during the next hour).

Any solution for smooth migration in this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions