Skip to content

[9.x] Document that model encrypter can also be null #45574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2023
Merged

[9.x] Document that model encrypter can also be null #45574

merged 1 commit into from
Jan 9, 2023

Conversation

axlon
Copy link
Contributor

@axlon axlon commented Jan 9, 2023

When using a custom encrypter for tests, you need to manually unset the encrypter after use (otherwise it might affect other tests). Since static properties cannot be unset with unset() the encrypter needs to be set to null (which is fine because models use ?? to use either a custom encrypter or the default).

This PR changes the documented type of the custom encrypter so PHPStan allows this:

protected function tearDown(): void
{
    MyModel::encryptUsing(null);
    parent::tearDown();
}

@taylorotwell taylorotwell merged commit cb6d257 into laravel:9.x Jan 9, 2023
@axlon axlon deleted the unset-model-encrypter branch January 9, 2023 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants