package and depencies
This commit is contained in:
@@ -35,7 +35,7 @@ trait AddTrait
|
||||
*
|
||||
* @param string|array $path the path, or the localized paths of the route
|
||||
*/
|
||||
public function add(string $name, $path): RouteConfigurator
|
||||
public function add(string $name, string|array $path): RouteConfigurator
|
||||
{
|
||||
$parentConfigurator = $this instanceof CollectionConfigurator ? $this : ($this instanceof RouteConfigurator ? $this->parentConfigurator : null);
|
||||
$route = $this->createLocalizedRoute($this->collection, $name, $path, $this->name, $this->prefixes);
|
||||
@@ -53,7 +53,7 @@ trait AddTrait
|
||||
*
|
||||
* @param string|array $path the path, or the localized paths of the route
|
||||
*/
|
||||
public function __invoke(string $name, $path): RouteConfigurator
|
||||
public function __invoke(string $name, string|array $path): RouteConfigurator
|
||||
{
|
||||
return $this->add($name, $path);
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ use Symfony\Component\Routing\RouteCollection;
|
||||
*/
|
||||
trait HostTrait
|
||||
{
|
||||
final protected function addHost(RouteCollection $routes, $hosts)
|
||||
final protected function addHost(RouteCollection $routes, string|array $hosts)
|
||||
{
|
||||
if (!$hosts || !\is_array($hosts)) {
|
||||
$routes->setHost($hosts ?: '');
|
||||
|
@@ -27,7 +27,7 @@ trait LocalizedRouteTrait
|
||||
*
|
||||
* @param string|array $path the path, or the localized paths of the route
|
||||
*/
|
||||
final protected function createLocalizedRoute(RouteCollection $collection, string $name, $path, string $namePrefix = '', array $prefixes = null): RouteCollection
|
||||
final protected function createLocalizedRoute(RouteCollection $collection, string $name, string|array $path, string $namePrefix = '', array $prefixes = null): RouteCollection
|
||||
{
|
||||
$paths = [];
|
||||
|
||||
|
@@ -21,7 +21,7 @@ use Symfony\Component\Routing\RouteCollection;
|
||||
*/
|
||||
trait PrefixTrait
|
||||
{
|
||||
final protected function addPrefix(RouteCollection $routes, $prefix, bool $trailingSlashOnRoot)
|
||||
final protected function addPrefix(RouteCollection $routes, string|array $prefix, bool $trailingSlashOnRoot)
|
||||
{
|
||||
if (\is_array($prefix)) {
|
||||
foreach ($prefix as $locale => $localePrefix) {
|
||||
|
@@ -26,7 +26,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function defaults(array $defaults): self
|
||||
final public function defaults(array $defaults): static
|
||||
{
|
||||
$this->route->addDefaults($defaults);
|
||||
|
||||
@@ -38,7 +38,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function requirements(array $requirements): self
|
||||
final public function requirements(array $requirements): static
|
||||
{
|
||||
$this->route->addRequirements($requirements);
|
||||
|
||||
@@ -50,7 +50,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function options(array $options): self
|
||||
final public function options(array $options): static
|
||||
{
|
||||
$this->route->addOptions($options);
|
||||
|
||||
@@ -62,7 +62,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function utf8(bool $utf8 = true): self
|
||||
final public function utf8(bool $utf8 = true): static
|
||||
{
|
||||
$this->route->addOptions(['utf8' => $utf8]);
|
||||
|
||||
@@ -74,7 +74,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function condition(string $condition): self
|
||||
final public function condition(string $condition): static
|
||||
{
|
||||
$this->route->setCondition($condition);
|
||||
|
||||
@@ -86,7 +86,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function host(string $pattern): self
|
||||
final public function host(string $pattern): static
|
||||
{
|
||||
$this->route->setHost($pattern);
|
||||
|
||||
@@ -101,7 +101,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function schemes(array $schemes): self
|
||||
final public function schemes(array $schemes): static
|
||||
{
|
||||
$this->route->setSchemes($schemes);
|
||||
|
||||
@@ -116,7 +116,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function methods(array $methods): self
|
||||
final public function methods(array $methods): static
|
||||
{
|
||||
$this->route->setMethods($methods);
|
||||
|
||||
@@ -130,7 +130,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function controller($controller): self
|
||||
final public function controller(callable|string|array $controller): static
|
||||
{
|
||||
$this->route->addDefaults(['_controller' => $controller]);
|
||||
|
||||
@@ -142,7 +142,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function locale(string $locale): self
|
||||
final public function locale(string $locale): static
|
||||
{
|
||||
$this->route->addDefaults(['_locale' => $locale]);
|
||||
|
||||
@@ -154,7 +154,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function format(string $format): self
|
||||
final public function format(string $format): static
|
||||
{
|
||||
$this->route->addDefaults(['_format' => $format]);
|
||||
|
||||
@@ -166,7 +166,7 @@ trait RouteTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function stateless(bool $stateless = true): self
|
||||
final public function stateless(bool $stateless = true): static
|
||||
{
|
||||
$this->route->addDefaults(['_stateless' => $stateless]);
|
||||
|
||||
|
Reference in New Issue
Block a user