Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ jobs:
sca:
uses: zenstruck/.github/.github/workflows/php-stan.yml@main
with:
php: 8.2
php: 8.4

fixcs:
name: Run php-cs-fixer
needs: sync-with-template
if: (github.event_name == 'push' || github.event_name == 'schedule') && !startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: zenstruck/.github@php-cs-fixer
- uses: zenstruck/.github/actions/php-cs-fixer@main
with:
php: 8
key: ${{ secrets.GPG_PRIVATE_KEY }}
Expand All @@ -38,7 +38,7 @@ jobs:
if: (github.event_name == 'push' || github.event_name == 'schedule') && !startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: zenstruck/.github@sync-with-template
- uses: zenstruck/.github/actions/sync-with-template@main
with:
key: ${{ secrets.GPG_PRIVATE_KEY }}
token: ${{ secrets.COMPOSER_TOKEN }}
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"psr/link": "^1.0|^2.0"
},
"require-dev": {
"phpstan/phpstan": "^1.4",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^9.6.21",
"rize/uri-template": "^0.3.5",
"symfony/browser-kit": "^5.4|^6.0|^7.0",
"symfony/framework-bundle": "^5.4|^6.0|^7.0",
"symfony/phpunit-bridge": "^6.1|^7.0",
"symfony/twig-bundle": "^5.4|^6.0|^7.0",
"symfony/web-link": "^5.4|^6.0|^7.0",
"symfony/browser-kit": "^6.4|^7.0|^8.0",
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
"symfony/phpunit-bridge": "^6.4|^7.0|^8.0",
"symfony/twig-bundle": "^6.4|^7.0|^8.0",
"symfony/web-link": "^6.4|^7.0|^8.0",
"twig/twig": ">=2.16.1"
},
"provide": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
*/
final class ZenstruckUriExtension extends ConfigurableExtension implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
public function getConfigTreeBuilder(): TreeBuilder // @phpstan-ignore-line
{
$builder = new TreeBuilder('zenstruck_uri');

$builder->getRootNode() // @phpstan-ignore-line
$builder->getRootNode()
->children()
->scalarNode('secret')
->info('The secret key to sign/verify URIs with')
Expand Down
2 changes: 1 addition & 1 deletion src/Uri/Bridge/Symfony/Routing/SignedRouteLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function setResolver(LoaderResolverInterface $resolver): void
private static function parseSignedAttribute(Route $route): void
{
try {
$method = \method_exists(\ReflectionMethod::class, 'createFromMethodName') ? \ReflectionMethod::createFromMethodName($route->getDefault('_controller')) : new \ReflectionMethod($route->getDefault('_controller'));
$method = \method_exists(\ReflectionMethod::class, 'createFromMethodName') ? \ReflectionMethod::createFromMethodName($route->getDefault('_controller')) : new \ReflectionMethod($route->getDefault('_controller')); // @phpstan-ignore function.alreadyNarrowedType
} catch (\ReflectionException) {
return;
}
Expand Down
4 changes: 0 additions & 4 deletions src/Uri/Link/UriLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ public static function decode(string $encoded): self
$rels = [];

foreach ($matches as [, $key, $value]) {
/** @var string $key */
/** @var string $value */
if ('rel' !== $key) {
$attributes[$key] = $value;

Expand Down Expand Up @@ -157,8 +155,6 @@ public function withoutRel($rel): static
/**
* @param string $attribute
* @param float|int|\Stringable|bool|mixed[]|string $value
*
* @return $this
*/
public function withAttribute($attribute, $value): static
{
Expand Down
4 changes: 2 additions & 2 deletions src/Uri/Mailto.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ public function bcc(): array

public function subject(): ?string
{
return $this->uri->query()->get('subject');
return $this->uri->query()->getString('subject') ?: null;
}

public function body(): ?string
{
return $this->uri->query()->get('body');
return $this->uri->query()->getString('body') ?: null;
}

public function withTo(string ...$to): self
Expand Down
2 changes: 0 additions & 2 deletions src/Uri/Parameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @immutable
*/
final class Parameters
{
Expand Down
4 changes: 1 addition & 3 deletions src/Uri/ParsedUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
* Wrapper for PHP's native "parse_url()".
*
* @author Kevin Bond <kevinbond@gmail.com>
*
* @immutable
*/
final class ParsedUri extends BaseUri
{
Expand Down Expand Up @@ -86,7 +84,7 @@ public function normalize(): self

public function toString(): string
{
if (isset($this->value)) {
if (isset($this->value)) { // @phpstan-ignore isset.initializedProperty
return $this->value;
}

Expand Down
2 changes: 0 additions & 2 deletions src/Uri/Part/Authority.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @immutable
*/
final class Authority extends Part
{
Expand Down
2 changes: 0 additions & 2 deletions src/Uri/Part/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @immutable
*/
final class Path extends Part
{
Expand Down
2 changes: 0 additions & 2 deletions src/Uri/Part/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @immutable
*/
final class Query extends Part
{
Expand Down
2 changes: 0 additions & 2 deletions src/Uri/Signed/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @immutable
*/
final class Builder implements \Stringable
{
Expand Down
2 changes: 0 additions & 2 deletions src/Uri/TemplateUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @immutable
*/
final class TemplateUri extends WrappedUri
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Bridge/Symfony/Fixture/TestController1.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Zenstruck\Uri\Tests\Bridge\Symfony\Fixture;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;
use Twig\Environment;
use Zenstruck\Uri\Bridge\Symfony\Routing\Signed;
use Zenstruck\Uri\Bridge\Symfony\Routing\SignedUrlVerifier;
Expand Down
2 changes: 1 addition & 1 deletion tests/Bridge/Symfony/Fixture/TestController2.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Zenstruck\Uri\Tests\Bridge\Symfony\Fixture;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;

/**
* @author Kevin Bond <kevinbond@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion tests/Bridge/Symfony/Fixture/TestController3.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Zenstruck\Uri\Tests\Bridge\Symfony\Fixture;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;
use Zenstruck\Uri\Bridge\Symfony\Routing\Signed;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Bridge/Symfony/Fixture/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load

protected function configureRoutes(RoutingConfigurator $routes): void
{
$routes->import(__DIR__, self::MAJOR_VERSION < 6 ? 'annotation' : 'attribute');
$routes->import(__DIR__, 'attribute');
}
}
1 change: 0 additions & 1 deletion tests/SignedUriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ protected function uriFor(string $value): SignedUri
$class = new \ReflectionClass(SignedUri::class);
$uri = $class->newInstanceWithoutConstructor();
$prop = $class->getProperty('uri');
$prop->setAccessible(true);
$prop->setValue($uri, new ParsedUri($value));

return $uri;
Expand Down