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

brick / postcode / 19098923587

05 Nov 2025 10:27AM UTC coverage: 81.782% (-17.6%) from 99.396%
19098923587

Pull #19

github

web-flow
Merge 79bf98178 into 8ef37e5aa
Pull Request #19: Add hint to formatter, so a hint can be provided if postcode is invalid

5 of 184 new or added lines in 183 files covered. (2.72%)

2 existing lines in 1 file now uncovered.

826 of 1010 relevant lines covered (81.78%)

15.02 hits per line

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

87.5
/src/Formatter/SHFormatter.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\Postcode\Formatter;
6

7
use Brick\Postcode\CountryPostcodeFormatter;
8

9
/**
10
 * Validates and formats postcodes in Saint Helena, Ascension and Tristan da Cunha.
11
 *
12
 * - Saint Helena uses one code STHL 1ZZ
13
 * - Ascension uses one code ASCN 1ZZ
14
 * - Tristan da Cunha uses one code TDCU 1ZZ.
15
 *
16
 * @see https://en.wikipedia.org/wiki/List_of_postal_codes
17
 */
18
final class SHFormatter implements CountryPostcodeFormatter
19
{
20
    public function hint(): string
21
    {
NEW
22
        return 'Saint Helena uses one code STHL 1ZZ';
×
23
    }
24

25
    public function format(string $postcode): ?string
26
    {
27
        if ($postcode === 'STHL1ZZ') {
14✔
28
            return 'STHL 1ZZ';
1✔
29
        }
30

31
        if ($postcode === 'ASCN1ZZ') {
13✔
32
            return 'ASCN 1ZZ';
1✔
33
        }
34

35
        if ($postcode === 'TDCU1ZZ') {
12✔
36
            return 'TDCU 1ZZ';
1✔
37
        }
38

39
        return null;
11✔
40
    }
41
}
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