Skip to content

Commit

Permalink
[BC BREAK] use zenstruck/uri 2.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond committed Nov 11, 2022
1 parent 5df45b2 commit 0931f66
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 61 deletions.
48 changes: 3 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,19 @@ on:
- cron: '0 0 1,16 * *'

jobs:
tests:
name: PHP ${{ matrix.php }}, SF ${{ matrix.symfony }} - ${{ matrix.deps }}
runs-on: ubuntu-latest
strategy:
matrix:
php: [8.0, 8.1]
deps: [hightest]
symfony: [5.4.*, 6.0.*]
include:
- php: 8.0
deps: lowest
symfony: '*'
- php: 8.1
deps: highest
symfony: 6.1.*
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: flex

- name: Restrict psr/simple-cache on Symfony 5.4
if: ${{ matrix.symfony == '5.4.*' }}
run: composer require --dev psr/simple-cache:"^1.0|^2.0" --no-update

- name: Install dependencies
uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.deps }}
composer-options: --prefer-dist
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

- name: Test
run: vendor/bin/phpunit -v
test:
uses: zenstruck/.github/.github/workflows/php-test-symfony.yml@main

code-coverage:
uses: zenstruck/.github/.github/workflows/php-coverage-codecov.yml@main
with:
php: 8.1

composer-validate:
uses: zenstruck/.github/.github/workflows/php-composer-validate.yml@main

cs-check:
uses: zenstruck/.github/.github/workflows/php-cs-fixer.yml@main
with:
php: 8.0
php: 8

sca:
uses: zenstruck/.github/.github/workflows/php-stan.yml@main
with:
php: 8.1
11 changes: 10 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,18 @@
'remove_inheritdoc' => true,
],
'phpdoc_to_comment' => false,
'function_declaration' => ['closure_function_spacing' => 'none'],
'function_declaration' => ['closure_function_spacing' => 'none', 'closure_fn_spacing' => 'none'],
'nullable_type_declaration_for_default_null_value' => true,
'phpdoc_types_order' => ['null_adjustment' => 'none', 'sort_algorithm' => 'none'],
'phpdoc_separation' => ['groups' => [
['test', 'dataProvider'],
['template', 'implements', 'extends'],
['phpstan-type', 'phpstan-import-type'],
['deprecated', 'link', 'see', 'since'],
['author', 'copyright', 'license', 'source'],
['category', 'package', 'subpackage'],
['property', 'property-read', 'property-write'],
]],
])
->setRiskyAllowed(true)
->setFinder($finder)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"require": {
"php": ">=8.0",
"zenstruck/uri": "^1.0"
"zenstruck/uri": "^2.0"
},
"require-dev": {
"phpstan/phpstan": "^1.4",
Expand Down
4 changes: 0 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@ parameters:
level: 8
paths:
- src
ignoreErrors:
- message: "#^Method Zenstruck\\\\Dsn\\:\\:parse\\(\\) should return Zenstruck\\\\Dsn\\\\Decorated\\|Zenstruck\\\\Dsn\\\\Group\\|Zenstruck\\\\Uri\\|Zenstruck\\\\Uri\\\\Mailto but returns Stringable\\.$#"
count: 1
path: src/Dsn.php
2 changes: 1 addition & 1 deletion src/Dsn.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ final class Dsn

public static function parse(string $value): Uri|Mailto|Group|Decorated
{
return (self::$defaultParser ??= new ChainParser())->parse($value);
return (self::$defaultParser ??= new ChainParser())->parse($value); // @phpstan-ignore-line
}
}
4 changes: 2 additions & 2 deletions src/Dsn/Decorated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Zenstruck\Dsn;

use Zenstruck\Uri\Query;
use Zenstruck\Uri\Scheme;
use Zenstruck\Uri\Part\Query;
use Zenstruck\Uri\Part\Scheme;

/**
* @author Kevin Bond <kevinbond@gmail.com>
Expand Down
4 changes: 2 additions & 2 deletions src/Dsn/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Zenstruck\Dsn;

use Zenstruck\Uri\Query;
use Zenstruck\Uri\Scheme;
use Zenstruck\Uri\Part\Query;
use Zenstruck\Uri\Part\Scheme;

/**
* @author Kevin Bond <kevinbond@gmail.com>
Expand Down
3 changes: 2 additions & 1 deletion src/Dsn/Parser/UriParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Zenstruck\Dsn\Exception\UnableToParse;
use Zenstruck\Dsn\Parser;
use Zenstruck\Uri;
use Zenstruck\Uri\ParsedUri;

/**
* @author Kevin Bond <kevinbond@gmail.com>
Expand All @@ -14,7 +15,7 @@ final class UriParser implements Parser
public function parse(string $dsn): Uri
{
try {
return Uri::new($dsn);
return ParsedUri::wrap($dsn)->normalize();
} catch (\InvalidArgumentException $e) {
throw UnableToParse::value($dsn, $e);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Dsn/Parser/WrappedParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Zenstruck\Dsn\Group;
use Zenstruck\Dsn\Parser;
use Zenstruck\Dsn\Wrapped;
use Zenstruck\Uri\Query;
use Zenstruck\Uri\Scheme;
use Zenstruck\Uri\Part\Query;
use Zenstruck\Uri\Part\Scheme;

/**
* Parses strings like "name(dsn1 dsn2)" into a "Group" dsn and
Expand Down
4 changes: 2 additions & 2 deletions src/Dsn/Wrapped.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Zenstruck\Dsn;

use Zenstruck\Uri\Query;
use Zenstruck\Uri\Scheme;
use Zenstruck\Uri\Part\Query;
use Zenstruck\Uri\Part\Scheme;

/**
* @author Kevin Bond <kevinbond@gmail.com>
Expand Down

0 comments on commit 0931f66

Please sign in to comment.