Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add attributes support & improve MatchingResult #196

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a60d03b
Add attributes support
rustamwin Mar 28, 2023
b328c82
Apply fixes from StyleCI
StyleCIBot Mar 28, 2023
3496866
Fix psalm annotation
rustamwin Mar 28, 2023
69d9832
Add tests
rustamwin Mar 28, 2023
bc421e9
Merge branch 'master' into add-attributes
xepozz May 29, 2023
875d7fd
Merge branch 'master' into add-attributes
xepozz Jun 8, 2023
777ff54
Add attributes registrar
rustamwin Jun 12, 2023
3959325
Apply fixes from StyleCI
StyleCIBot Jun 12, 2023
1651071
Add tests
rustamwin Jun 12, 2023
838bbc4
Fix tests & psalm issues
rustamwin Jun 15, 2023
4e63476
Apply fixes from StyleCI
StyleCIBot Jun 15, 2023
a0fb7a2
Add test cases
rustamwin Jun 15, 2023
ed2f60f
Apply fixes from StyleCI
StyleCIBot Jun 15, 2023
c239d53
Improve Route
rustamwin Aug 19, 2023
e8367aa
Add test
rustamwin Aug 19, 2023
2ab8dc2
Merge branch 'master' into add-attributes
xepozz Aug 19, 2023
2a60945
Increase coverage
rustamwin Aug 19, 2023
61eafb0
Merge remote-tracking branch 'origin/add-attributes' into add-attributes
rustamwin Aug 19, 2023
01665f4
Merge branch 'master' into add-attributes
xepozz Oct 9, 2023
e7d7a43
Add routes resource & attributes (#220)
rustamwin Oct 10, 2023
ab43b76
Fix AttributeRoutesProvider
rustamwin Oct 11, 2023
7a0e222
Allow attributes to use in classes
rustamwin Oct 15, 2023
2c38b06
Fix psalm annotation
rustamwin Oct 15, 2023
6a2bd4c
Add `RouteAttributeInterface` (#221)
vjik Oct 15, 2023
ab467d8
Adjust naming
rustamwin Oct 16, 2023
61cbc83
Minor improvements
rustamwin Oct 16, 2023
d85e667
Minor
rustamwin Oct 16, 2023
0ebcb5a
Move attribute collector it's own package
rustamwin Oct 23, 2023
3ff6921
Cleanup
rustamwin Oct 23, 2023
a81c91a
Minor
rustamwin Oct 23, 2023
5be62b4
Add changelog
rustamwin Nov 2, 2023
63467dc
Apply Rector changes (CI)
rustamwin Nov 2, 2023
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
7 changes: 3 additions & 4 deletions .phpstorm.meta.php/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
'host',
'hosts',
'corsMiddleware',
'items',
'middlewareDefinitions',
'hasDispatcher',
'routes',
'middlewares',
'hasCorsMiddleware'
);
}
}
4 changes: 1 addition & 3 deletions .phpstorm.meta.php/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
'methods',
'override',
'defaults',
'dispatcherWithMiddlewares',
'hasDispatcher',
'hasMiddlewares'
);
}
}
34 changes: 34 additions & 0 deletions src/Attribute/Delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Router\Attribute;

use Attribute;
use Yiisoft\Http\Method;
use Yiisoft\Router\Route;

#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
rustamwin marked this conversation as resolved.
Show resolved Hide resolved
final class Delete extends Route
{
public function __construct(
string $pattern,
?string $name = null,
array $middlewares = [],
array $defaults = [],
array $hosts = [],
bool $override = false,
array $disabledMiddlewares = []
) {
parent::__construct(
methods: [Method::DELETE],
pattern: $pattern,
name: $name,
middlewares: $middlewares,
defaults: $defaults,
hosts: $hosts,
override: $override,
disabledMiddlewares: $disabledMiddlewares
);
}
}
34 changes: 34 additions & 0 deletions src/Attribute/Get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Router\Attribute;

use Attribute;
use Yiisoft\Http\Method;
use Yiisoft\Router\Route;

#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class Get extends Route
{
public function __construct(
string $pattern,
?string $name = null,
array $middlewares = [],
array $defaults = [],
array $hosts = [],
bool $override = false,
array $disabledMiddlewares = []
) {
parent::__construct(
methods: [Method::GET],
pattern: $pattern,
name: $name,
middlewares: $middlewares,
defaults: $defaults,
hosts: $hosts,
override: $override,
disabledMiddlewares: $disabledMiddlewares
);
}
}
34 changes: 34 additions & 0 deletions src/Attribute/Head.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Router\Attribute;

use Attribute;
use Yiisoft\Http\Method;
use Yiisoft\Router\Route;

#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class Head extends Route
{
public function __construct(
string $pattern,
?string $name = null,
array $middlewares = [],
array $defaults = [],
array $hosts = [],
bool $override = false,
array $disabledMiddlewares = []
) {
parent::__construct(
methods: [Method::HEAD],
pattern: $pattern,
name: $name,
middlewares: $middlewares,
defaults: $defaults,
hosts: $hosts,
override: $override,
disabledMiddlewares: $disabledMiddlewares
);
}
}
34 changes: 34 additions & 0 deletions src/Attribute/Options.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Router\Attribute;

use Attribute;
use Yiisoft\Http\Method;
use Yiisoft\Router\Route;

#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class Options extends Route
{
public function __construct(
string $pattern,
?string $name = null,
array $middlewares = [],
array $defaults = [],
array $hosts = [],
bool $override = false,
array $disabledMiddlewares = []
) {
parent::__construct(
methods: [Method::OPTIONS],
pattern: $pattern,
name: $name,
middlewares: $middlewares,
defaults: $defaults,
hosts: $hosts,
override: $override,
disabledMiddlewares: $disabledMiddlewares
);
}
}
34 changes: 34 additions & 0 deletions src/Attribute/Patch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Router\Attribute;

use Attribute;
use Yiisoft\Http\Method;
use Yiisoft\Router\Route;

#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class Patch extends Route
{
public function __construct(
string $pattern,
?string $name = null,
array $middlewares = [],
array $defaults = [],
array $hosts = [],
bool $override = false,
array $disabledMiddlewares = []
) {
parent::__construct(
methods: [Method::PATCH],
pattern: $pattern,
name: $name,
middlewares: $middlewares,
defaults: $defaults,
hosts: $hosts,
override: $override,
disabledMiddlewares: $disabledMiddlewares
);
}
}
34 changes: 34 additions & 0 deletions src/Attribute/Post.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Router\Attribute;

use Attribute;
use Yiisoft\Http\Method;
use Yiisoft\Router\Route;

#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class Post extends Route
{
public function __construct(
string $pattern,
?string $name = null,
array $middlewares = [],
array $defaults = [],
array $hosts = [],
bool $override = false,
array $disabledMiddlewares = []
) {
parent::__construct(
methods: [Method::POST],
pattern: $pattern,
name: $name,
middlewares: $middlewares,
defaults: $defaults,
hosts: $hosts,
override: $override,
disabledMiddlewares: $disabledMiddlewares
);
}
}
34 changes: 34 additions & 0 deletions src/Attribute/Put.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Router\Attribute;

use Attribute;
use Yiisoft\Http\Method;
use Yiisoft\Router\Route;

#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class Put extends Route
{
public function __construct(
string $pattern,
?string $name = null,
array $middlewares = [],
array $defaults = [],
array $hosts = [],
bool $override = false,
array $disabledMiddlewares = []
) {
parent::__construct(
methods: [Method::PUT],
pattern: $pattern,
name: $name,
middlewares: $middlewares,
defaults: $defaults,
hosts: $hosts,
override: $override,
disabledMiddlewares: $disabledMiddlewares
);
}
}
Loading