packages/sql-semantics-mysql/src/Statement/Account/Problem/RejectedPasswordHash.php

1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\MySql\Statement\Account\Problem;
6
7use SqlSemantics\Platform\MySql\Model\Statement\Fact\Diagnostic;
8use SqlSemantics\Platform\MySql\Model\Statement\Snapshot;
9
10/**
11 * `IDENTIFIED BY PASSWORD 'hash'` in a MySQL 5.7 ALTER USER.
12 *
13 * The 5.7 grammar shares the account list of GRANT and CREATE USER with
14 * ALTER USER, and the server rejects this form there with a syntax error.
15 * Source: https://dev.mysql.com/doc/refman/5.7/en/alter-user.html.
16 *
17 * @visibility public
18 * @example Describing the problem
19 *     (new \SqlSemantics\Platform\MySql\Statement\Account\Problem\RejectedPasswordHash())->message() // => 'ALTER USER does not accept IDENTIFIED BY PASSWORD.'
20 */
21final class RejectedPasswordHash implements Diagnostic
22{
23    use Snapshot;
24
25    /**
26     * Describes the problem.
27     */
28    public function message(): string
29    {
30        return 'ALTER USER does not accept IDENTIFIED BY PASSWORD.';
31    }
32}
33