Skip to content

Commit 9a75c33

Browse files
author
Andrey Helldar
authored
Merge pull request #18 from TheDragonCode/5.x
Bump `dragon-code/support` to 6.1
2 parents fc63580 + f63ddbf commit 9a75c33

File tree

17 files changed

+98
-327
lines changed

17 files changed

+98
-327
lines changed

.github/workflows/laravel-6.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/laravel-7.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: true
1010
matrix:
11-
php: [ "7.3", "7.4", "8.0" ]
11+
php: [ "8.0" ]
1212
laravel: [ "7.0" ]
1313

1414
name: PHP ${{ matrix.php }}

.github/workflows/laravel-8.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: true
1010
matrix:
11-
php: [ "7.3", "7.4", "8.0", "8.1" ]
11+
php: [ "8.0", "8.1" ]
1212
laravel: [ "8.0" ]
1313

1414
name: PHP ${{ matrix.php }}

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ The core of applications for working with routes:
1313
[![Github Workflow Status][badge_build]][link_build]
1414
[![License][badge_license]][link_license]
1515

16-
## Upgrade from `andrey-helldar/laravel-routes-core`
17-
18-
1. Replace `"andrey-helldar/laravel-routes-core": "^3.0"` with `"dragon-code/laravel-routes-core": "^4.0"` in the `composer.json` file;
19-
2. Replace `Helldar\LaravelRoutesCore` with `DragonCode\LaravelRoutesCore`;
20-
3. Run the `composer update` console command.
2116

2217
## License
2318

composer.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@
1919
"source": "https://github.com/TheDragonCode/laravel-routes-core"
2020
},
2121
"require": {
22-
"php": "^7.3 || ^8.0",
22+
"php": "^8.0",
2323
"dragon-code/contracts": "^2.6",
24-
"dragon-code/laravel-support": "^3.2",
25-
"dragon-code/support": "^5.6",
26-
"illuminate/routing": "^6.0 || ^7.0 || ^8.0 || ^9.0",
27-
"illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0",
24+
"dragon-code/support": "^6.1",
25+
"illuminate/routing": "^7.0 || ^8.0 || ^9.0",
26+
"illuminate/support": "^7.0 || ^8.0 || ^9.0",
2827
"phpdocumentor/reflection-docblock": "^5.0"
2928
},
3029
"require-dev": {
3130
"mockery/mockery": "^1.0",
32-
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0",
33-
"phpunit/phpunit": "^8.0 || ^9.0"
31+
"orchestra/testbench": "^5.0 || ^6.0 || ^7.0",
32+
"phpunit/phpunit": "^9.0"
3433
},
3534
"conflict": {
3635
"andrey-helldar/laravel-routes-core": "*"

src/Facades/Annotation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
class Annotation extends Facade
1818
{
19-
protected static function getFacadeAccessor()
19+
protected static function getFacadeAccessor(): string
2020
{
2121
return Support::class;
2222
}

src/Facades/Routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class Routes extends Facade
2323
{
24-
protected static function getFacadeAccessor()
24+
protected static function getFacadeAccessor(): string
2525
{
2626
return Support::class;
2727
}

src/Models/Reader.php

Lines changed: 16 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,25 @@
22

33
namespace DragonCode\LaravelRoutesCore\Models;
44

5-
use DragonCode\LaravelRoutesCore\Traits\Makeable;
6-
use Illuminate\Support\Str;
5+
use DragonCode\Support\Concerns\Makeable;
6+
use DragonCode\Support\Facades\Helpers\Str;
77
use phpDocumentor\Reflection\DocBlock;
88
use phpDocumentor\Reflection\DocBlockFactory;
99
use ReflectionClass;
10-
use ReflectionException;
1110
use ReflectionMethod;
1211
use Reflector;
1312

1413
class Reader
1514
{
1615
use Makeable;
1716

18-
protected $controller;
19-
20-
protected $method;
21-
22-
public function __construct(string $controller, ?string $method = null)
23-
{
24-
$this->controller = $controller;
25-
$this->method = $method;
17+
public function __construct(
18+
protected string $controller,
19+
protected ?string $method = null
20+
) {
2621
}
2722

28-
/**
29-
* @throws ReflectionException
30-
*
31-
* @return \phpDocumentor\Reflection\DocBlock|null
32-
*/
33-
public function forClass()
23+
public function forClass(): ?DocBlock
3424
{
3525
[$controller, $method] = $this->parse();
3626

@@ -39,12 +29,7 @@ public function forClass()
3929
);
4030
}
4131

42-
/**
43-
* @throws ReflectionException
44-
*
45-
* @return \phpDocumentor\Reflection\DocBlock|null
46-
*/
47-
public function forMethod()
32+
public function forMethod(): ?DocBlock
4833
{
4934
[$controller, $method] = $this->parse();
5035

@@ -54,11 +39,6 @@ public function forMethod()
5439
) : null;
5540
}
5641

57-
/**
58-
* @param Reflector|null $reflection
59-
*
60-
* @return \phpDocumentor\Reflection\DocBlock|null
61-
*/
6242
protected function get(?Reflector $reflection = null): ?DocBlock
6343
{
6444
if ($reflection && $comment = $reflection->getDocComment()) {
@@ -71,42 +51,23 @@ protected function get(?Reflector $reflection = null): ?DocBlock
7151
protected function parse(): array
7252
{
7353
if (is_null($this->method)) {
74-
return Str::contains($this->controller, '@')
75-
? [Str::before($this->controller, '@'), Str::after($this->controller, '@')]
76-
: [$this->controller, null];
54+
if (Str::contains($this->controller, '@')) {
55+
return [Str::before($this->controller, '@'), Str::after($this->controller, '@')];
56+
}
57+
58+
return [$this->controller, null];
7759
}
7860

7961
return [$this->controller, $this->method];
8062
}
8163

82-
/**
83-
* Getting class reflection instance.
84-
*
85-
* @param string $class
86-
*
87-
* @throws ReflectionException
88-
*
89-
* @return ReflectionClass
90-
*/
91-
protected function reflectionClass(string $class)
64+
protected function reflectionClass(string $class): ReflectionClass
9265
{
9366
return new ReflectionClass($class);
9467
}
9568

96-
/**
97-
* Getting method reflection instance from reflection class.
98-
*
99-
* @param ReflectionClass $class
100-
* @param string $method
101-
*
102-
* @throws ReflectionException
103-
*
104-
* @return ReflectionMethod|null
105-
*/
106-
protected function reflectionMethod(ReflectionClass $class, string $method)
69+
protected function reflectionMethod(ReflectionClass $class, string $method): ?ReflectionMethod
10770
{
108-
return $class->hasMethod($method)
109-
? $class->getMethod($method)
110-
: null;
71+
return $class->hasMethod($method) ? $class->getMethod($method) : null;
11172
}
11273
}

0 commit comments

Comments
 (0)