Skip to content

Commit

Permalink
Merge branch 'release/v0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
betterthanclay committed Aug 22, 2024
2 parents bfe4e15 + 5da2ac0 commit 65d4bd0
Show file tree
Hide file tree
Showing 25 changed files with 131 additions and 125 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ phpstan.neon export-ignore
phpunit.xml.dist export-ignore
docs/ export-ignore
tests/ export-ignore
stubs/ export-ignore
12 changes: 6 additions & 6 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
ini-values: "post_max_size=256M"

- name: "Checkout code"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: Install Effigy
run: |
composer global config --no-plugins allow-plugins.phpstan/extension-installer true
composer global require decodelabs/effigy
- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "highest"

Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
ini-values: "post_max_size=256M"

- name: "Checkout code"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: Install Effigy
run: |
Expand All @@ -83,7 +83,7 @@ jobs:
run: "composer validate --strict"

- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "highest"

Expand All @@ -106,7 +106,7 @@ jobs:
ini-values: "post_max_size=256M"

- name: "Checkout code"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Check EditorConfig configuration"
run: "test -f .editorconfig"
Expand All @@ -120,7 +120,7 @@ jobs:
composer global require decodelabs/effigy
- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "highest"

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v0.2.0 (2024-08-21)
* Converted consts to protected PascalCase
* Updated Tagged dependency
* Updated dependency list

## v0.1.1 (2024-01-19)
* Added Stringable support to Reference interface

Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"decodelabs/exceptional": "^0.4.4"
},
"require-dev": {
"decodelabs/glitch": "^0.18.11",
"decodelabs/tagged": "^0.14.12",
"decodelabs/tagged": "^0.15",
"decodelabs/phpstan-decodelabs": "^0.6.7"
},
"suggest": {
Expand All @@ -27,7 +26,7 @@
},
"extra": {
"branch-alias": {
"dev-develop": "0.1.x-dev"
"dev-develop": "0.2.x-dev"
}
}
}
13 changes: 8 additions & 5 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
declare(strict_types=1);

use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([__DIR__.'/src']);
$ecsConfig->sets([SetList::CLEAN_CODE, SetList::PSR_12]);
};
return ECSConfig::configure()
->withPaths([
__DIR__ . '/src'
])
->withPreparedSets(
cleanCode: true,
psr12: true
);
10 changes: 5 additions & 5 deletions src/Reference/AtHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class AtHandle implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^@([^@\s]+)$/';
public const CANONICAL_MAX_LENGTH = 256;
public const NORMAL_PATTERN = self::CANONICAL_PATTERN;
public const NORMAL_MAX_LENGTH = self::CANONICAL_MAX_LENGTH;
public const EXAMPLE = '@username';
protected const CanonicalPattern = '/^@([^@\s]+)$/';
protected const CanonicalMaxLength = 256;
protected const NormalPattern = self::CanonicalPattern;
protected const NormalMaxLength = self::CanonicalMaxLength;
protected const Example = '@username';

/**
* Prepare canonical string
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Banking/Iban.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class Iban implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = self::NORMAL_PATTERN;
public const CANONICAL_MAX_LENGTH = self::NORMAL_MAX_LENGTH;
public const NORMAL_PATTERN = '/^([A-Z]{2}[ \-]?[0-9]{2})(?=(?:[ \-]?[A-Z0-9]){9,30}$)((?:[ \-]?[A-Z0-9]{3,5}){2,7})([ \-]?[A-Z0-9]{1,3})?$/';
public const NORMAL_MAX_LENGTH = 50;
public const EXAMPLE = 'BE71 0961 2345 6769 45';
protected const CanonicalPattern = self::NormalPattern;
protected const CanonicalMaxLength = self::NormalMaxLength;
protected const NormalPattern = '/^([A-Z]{2}[ \-]?[0-9]{2})(?=(?:[ \-]?[A-Z0-9]){9,30}$)((?:[ \-]?[A-Z0-9]{3,5}){2,7})([ \-]?[A-Z0-9]{1,3})?$/';
protected const NormalMaxLength = 50;
protected const Example = 'BE71 0961 2345 6769 45';

/**
* Combine match parts
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Banking/RoutingNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class RoutingNumber implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([0-9]{4})([0-9]{4})([0-9]{1})$/';
public const CANONICAL_MAX_LENGTH = 9;
public const NORMAL_PATTERN = '/^([0-9]{4}) ?([0-9]{4}) ?([0-9]{1})$/';
public const NORMAL_MAX_LENGTH = 11;
public const EXAMPLE = '061000104';
protected const CanonicalPattern = '/^([0-9]{4})([0-9]{4})([0-9]{1})$/';
protected const CanonicalMaxLength = 9;
protected const NormalPattern = '/^([0-9]{4}) ?([0-9]{4}) ?([0-9]{1})$/';
protected const NormalMaxLength = 11;
protected const Example = '061000104';


/**
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Banking/Swift.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class Swift implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([a-zA-Z]{4})([a-zA-Z]{2})([0-9a-zA-Z]{2})([0-9a-zA-Z]{3})?$/';
public const CANONICAL_MAX_LENGTH = 11;
public const NORMAL_PATTERN = self::CANONICAL_PATTERN;
public const NORMAL_MAX_LENGTH = self::CANONICAL_MAX_LENGTH;
public const EXAMPLE = 'BOFAUS3N';
protected const CanonicalPattern = '/^([a-zA-Z]{4})([a-zA-Z]{2})([0-9a-zA-Z]{2})([0-9a-zA-Z]{3})?$/';
protected const CanonicalMaxLength = 11;
protected const NormalPattern = self::CanonicalPattern;
protected const NormalMaxLength = self::CanonicalMaxLength;
protected const Example = 'BOFAUS3N';


/**
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Banking/UkSortCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class UkSortCode implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([0-9]{2})([0-9]{2})([0-9]{2})$/';
public const CANONICAL_MAX_LENGTH = 6;
public const NORMAL_PATTERN = '/^([0-9]{2})[ -]?([0-9]{2})[ -]?([0-9]{2})$/';
public const NORMAL_MAX_LENGTH = 8;
public const EXAMPLE = '12-34-56';
protected const CanonicalPattern = '/^([0-9]{2})([0-9]{2})([0-9]{2})$/';
protected const CanonicalMaxLength = 6;
protected const NormalPattern = '/^([0-9]{2})[ -]?([0-9]{2})[ -]?([0-9]{2})$/';
protected const NormalMaxLength = 8;
protected const Example = '12-34-56';

/**
* Combine match parts
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Commerce/Upc.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class Upc implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([0-9]{12,13})$/';
public const CANONICAL_MAX_LENGTH = 13;
public const NORMAL_PATTERN = self::CANONICAL_PATTERN;
public const NORMAL_MAX_LENGTH = self::CANONICAL_MAX_LENGTH;
public const EXAMPLE = '0799439112766';
protected const CanonicalPattern = '/^([0-9]{12,13})$/';
protected const CanonicalMaxLength = 13;
protected const NormalPattern = self::CanonicalPattern;
protected const NormalMaxLength = self::CanonicalMaxLength;
protected const Example = '0799439112766';

/**
* Convert canonical to html value
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class Domain implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([^@\s\.]+\.[^@\s]{2,})$/';
public const CANONICAL_MAX_LENGTH = 2048;
public const NORMAL_PATTERN = self::CANONICAL_PATTERN;
public const NORMAL_MAX_LENGTH = self::CANONICAL_MAX_LENGTH;
public const EXAMPLE = 'example.com';
protected const CanonicalPattern = '/^([^@\s\.]+\.[^@\s]{2,})$/';
protected const CanonicalMaxLength = 2048;
protected const NormalPattern = self::CanonicalPattern;
protected const NormalMaxLength = self::CanonicalMaxLength;
protected const Example = 'example.com';

/**
* Prepare canonical string
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class Email implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([^@\s]+)(@)([^@\s\.]+\.[^@\s]+)$/';
public const CANONICAL_MAX_LENGTH = 2048;
public const NORMAL_PATTERN = self::CANONICAL_PATTERN;
public const NORMAL_MAX_LENGTH = self::CANONICAL_MAX_LENGTH;
public const EXAMPLE = '[email protected]';
protected const CanonicalPattern = '/^([^@\s]+)(@)([^@\s\.]+\.[^@\s]+)$/';
protected const CanonicalMaxLength = 2048;
protected const NormalPattern = self::CanonicalPattern;
protected const NormalMaxLength = self::CanonicalMaxLength;
protected const Example = '[email protected]';

/**
* Prepare canonical string
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Guid.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class Guid implements Reference
ReferenceTrait::format as parentFormat;
}

public const CANONICAL_PATTERN = '/^([a-z0-9]{8})-?([a-z0-9]{4})-?([a-z0-9]{4})-?([a-z0-9]{4})-?([a-z0-9]{12})$/';
public const CANONICAL_MAX_LENGTH = 36;
public const NORMAL_PATTERN = self::CANONICAL_PATTERN;
public const NORMAL_MAX_LENGTH = self::CANONICAL_MAX_LENGTH;
public const EXAMPLE = 'd2516786-28da-c4d4-f701-30df4b2159d9';
protected const CanonicalPattern = '/^([a-z0-9]{8})-?([a-z0-9]{4})-?([a-z0-9]{4})-?([a-z0-9]{4})-?([a-z0-9]{12})$/';
protected const CanonicalMaxLength = 36;
protected const NormalPattern = self::CanonicalPattern;
protected const NormalMaxLength = self::CanonicalMaxLength;
protected const Example = 'd2516786-28da-c4d4-f701-30df4b2159d9';



Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Identity/UkNationalInsurance.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class UkNationalInsurance implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([A-Z]{2})([0-9]{2})([0-9]{2})([0-9]{2})([A-Z])$/';
public const CANONICAL_MAX_LENGTH = 9;
public const NORMAL_PATTERN = '/^([a-zA-Z]{2}) ?([0-9]{2}) ?([0-9]{2}) ?([0-9]{2}) ?([a-zA-Z])$/';
public const NORMAL_MAX_LENGTH = 13;
public const EXAMPLE = 'TN311258F';
protected const CanonicalPattern = '/^([A-Z]{2})([0-9]{2})([0-9]{2})([0-9]{2})([A-Z])$/';
protected const CanonicalMaxLength = 9;
protected const NormalPattern = '/^([a-zA-Z]{2}) ?([0-9]{2}) ?([0-9]{2}) ?([0-9]{2}) ?([a-zA-Z])$/';
protected const NormalMaxLength = 13;
protected const Example = 'TN311258F';

/**
* Combine match parts
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/InitialKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class InitialKey implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([A-Z])([A-Z0-9]{2,})$/';
public const CANONICAL_MAX_LENGTH = 12;
public const NORMAL_PATTERN = self::CANONICAL_PATTERN;
public const NORMAL_MAX_LENGTH = self::CANONICAL_MAX_LENGTH;
public const EXAMPLE = 'MTR1';
protected const CanonicalPattern = '/^([A-Z])([A-Z0-9]{2,})$/';
protected const CanonicalMaxLength = 12;
protected const NormalPattern = self::CanonicalPattern;
protected const NormalMaxLength = self::CanonicalMaxLength;
protected const Example = 'MTR1';

/**
* Convert canonical to html value
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Music/CatalogueNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class CatalogueNumber implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([A-Z])([A-Z0-9 ]{2,})$/';
public const CANONICAL_MAX_LENGTH = 32;
public const NORMAL_PATTERN = self::CANONICAL_PATTERN;
public const NORMAL_MAX_LENGTH = self::CANONICAL_MAX_LENGTH;
public const EXAMPLE = 'XCD023';
protected const CanonicalPattern = '/^([A-Z])([A-Z0-9 ]{2,})$/';
protected const CanonicalMaxLength = 32;
protected const NormalPattern = self::CanonicalPattern;
protected const NormalMaxLength = self::CanonicalMaxLength;
protected const Example = 'XCD023';

/**
* Prepare canonical string
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Music/GenericTrackReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class GenericTrackReference implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([A-Z0-9]{3,})$/';
public const CANONICAL_MAX_LENGTH = 32;
public const NORMAL_PATTERN = self::CANONICAL_PATTERN;
public const NORMAL_MAX_LENGTH = self::CANONICAL_MAX_LENGTH;
public const EXAMPLE = '123456';
protected const CanonicalPattern = '/^([A-Z0-9]{3,})$/';
protected const CanonicalMaxLength = 32;
protected const NormalPattern = self::CanonicalPattern;
protected const NormalMaxLength = self::CanonicalMaxLength;
protected const Example = '123456';

/**
* Convert canonical to html value
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Music/Isrc.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class Isrc implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([A-Z]{2})([A-Z0-9]{3})([0-9]{2})([A-Z0-9]{5})$/';
public const CANONICAL_MAX_LENGTH = 12;
public const NORMAL_PATTERN = '/^[a-zA-Z]{2}\-?[a-zA-Z0-9]{3}\-?[0-9]{2}\-?[a-zA-Z0-9]{3}\-?[a-zA-Z0-9]{2}$/';
public const NORMAL_MAX_LENGTH = 16;
public const EXAMPLE = 'USRC17607839';
protected const CanonicalPattern = '/^([A-Z]{2})([A-Z0-9]{3})([0-9]{2})([A-Z0-9]{5})$/';
protected const CanonicalMaxLength = 12;
protected const NormalPattern = '/^[a-zA-Z]{2}\-?[a-zA-Z0-9]{3}\-?[0-9]{2}\-?[a-zA-Z0-9]{3}\-?[a-zA-Z0-9]{2}$/';
protected const NormalMaxLength = 16;
protected const Example = 'USRC17607839';

/**
* Combine match parts
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Music/IsrcRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class IsrcRange implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([A-Z]{2})([A-Z0-9]{3})$/';
public const CANONICAL_MAX_LENGTH = 5;
public const NORMAL_PATTERN = '/^[a-zA-Z]{2}\-?[a-zA-Z0-9]{3}\*?$/';
public const NORMAL_MAX_LENGTH = 7;
public const EXAMPLE = 'GBMYV';
protected const CanonicalPattern = '/^([A-Z]{2})([A-Z0-9]{3})$/';
protected const CanonicalMaxLength = 5;
protected const NormalPattern = '/^[a-zA-Z]{2}\-?[a-zA-Z0-9]{3}\*?$/';
protected const NormalMaxLength = 7;
protected const Example = 'GBMYV';

/**
* Combine match parts
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Music/Iswc.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class Iswc implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([A-Z])([0-9]{3})([0-9]{3})([0-9]{3})([0-9])$/';
public const CANONICAL_MAX_LENGTH = 11;
public const NORMAL_PATTERN = '/^([a-zA-Z])\-?([0-9]{3})\.?([0-9]{3})\.?([0-9]{3})\-?([0-9])$/';
public const NORMAL_MAX_LENGTH = 15;
public const EXAMPLE = 'T3452468001';
protected const CanonicalPattern = '/^([A-Z])([0-9]{3})([0-9]{3})([0-9]{3})([0-9])$/';
protected const CanonicalMaxLength = 11;
protected const NormalPattern = '/^([a-zA-Z])\-?([0-9]{3})\.?([0-9]{3})\.?([0-9]{3})\-?([0-9])$/';
protected const NormalMaxLength = 15;
protected const Example = 'T3452468001';

/**
* Combine match parts
Expand Down
10 changes: 5 additions & 5 deletions src/Reference/Music/PrsTunecode.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class PrsTunecode implements Reference
{
use ReferenceTrait;

public const CANONICAL_PATTERN = '/^([0-9]{4,6})([a-zA-Z0-9])([a-zA-Z])$/';
public const CANONICAL_MAX_LENGTH = 8;
public const NORMAL_PATTERN = self::CANONICAL_PATTERN;
public const NORMAL_MAX_LENGTH = self::CANONICAL_MAX_LENGTH;
public const EXAMPLE = '083657CV';
protected const CanonicalPattern = '/^([0-9]{4,6})([a-zA-Z0-9])([a-zA-Z])$/';
protected const CanonicalMaxLength = 8;
protected const NormalPattern = self::CanonicalPattern;
protected const NormalMaxLength = self::CanonicalMaxLength;
protected const Example = '083657CV';

/**
* Prepare canonical string
Expand Down
Loading

0 comments on commit 65d4bd0

Please sign in to comment.