• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jorge07 / symfony-5-es-cqrs-boilerplate / #166

06 Feb 2026 10:12AM UTC coverage: 88.404% (+1.2%) from 87.168%
#166

push

web-flow
Merge c345ce76d into 847c843ce

36 of 45 new or added lines in 21 files covered. (80.0%)

9 existing lines in 4 files now uncovered.

587 of 664 relevant lines covered (88.4%)

8.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/App/User/Domain/ValueObject/Auth/HashedPassword.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\User\Domain\ValueObject\Auth;
6

7
use Assert\Assertion;
8
use Assert\AssertionFailedException;
9
use const PASSWORD_BCRYPT;
10
use function password_verify;
11

12
final class HashedPassword implements \Stringable
13
{
14
    public const COST = 12;
15

16
    private function __construct(private readonly string $hashedPassword)
17
    {
18
    }
34✔
19

20
    /**
21
     * @throws AssertionFailedException
22
     */
23
    public static function encode(string $plainPassword): self
24
    {
25
        return new self(self::hash($plainPassword));
31✔
26
    }
27

28
    public static function fromHash(string $hashedPassword): self
29
    {
30
        return new self($hashedPassword);
29✔
31
    }
32

33
    public function match(string $plainPassword): bool
34
    {
35
        return password_verify($plainPassword, $this->hashedPassword);
16✔
36
    }
37

38
    /**
39
     * @throws AssertionFailedException
40
     */
41
    private static function hash(string $plainPassword): string
42
    {
43
        Assertion::minLength($plainPassword, 6, 'Min 6 characters password');
31✔
44

45
        return \password_hash($plainPassword, PASSWORD_BCRYPT, ['cost' => self::COST]);
30✔
46
    }
47

48
    public function equals(self $other): bool
49
    {
NEW
50
        return $this->hashedPassword === $other->hashedPassword;
×
51
    }
52

53
    public function toString(): string
54
    {
55
        return $this->hashedPassword;
26✔
56
    }
57

58
    public function __toString(): string
59
    {
60
        return $this->hashedPassword;
1✔
61
    }
62
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc