Skip to content

Commit 4b03934

Browse files
committed
Add type hints & remove unnecessary comment type hints
1 parent 73554c3 commit 4b03934

13 files changed

+21
-65
lines changed

phpcs.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
</properties>
7676
</rule>
7777
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
78+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint"/>
79+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint"/>
80+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
81+
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
7882
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
7983
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
8084
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>

src/Calculator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ public static function compare(ZodiacInterface $zodiac1, ZodiacInterface $zodiac
9797
/**
9898
* Normalze given date to Carbon object
9999
*
100-
* @param string|DateTimeInterface $date
101100
* @throws NotReadableException
102-
* @return ZodiacComparableDate
103101
*/
104102
private function normalizeDate(int|string|DateTimeInterface $date): ZodiacComparableDate
105103
{

src/Compatibility.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,6 @@ class Compatibility
196196

197197
/**
198198
* Calculate zodiac sign compatibility between two signs
199-
*
200-
* @param ZodiacInterface $a
201-
* @param ZodiacInterface $b
202-
* @return float
203199
*/
204200
public function __invoke(ZodiacInterface $a, ZodiacInterface $b): float
205201
{

src/Interfaces/CalculatorInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,11 @@ interface CalculatorInterface
1010
{
1111
/**
1212
* Get zodiac for given date
13-
*
14-
* @param int|string|DateTimeInterface $date
15-
* @return ZodiacInterface
1613
*/
1714
public static function zodiac(int|string|DateTimeInterface $date): ZodiacInterface;
1815

1916
/**
2017
* Calculate zodiac sign compatibility between given objects
21-
*
22-
* @param ZodiacInterface $zodiac1
23-
* @param ZodiacInterface $zodiac2
24-
* @return float
2518
*/
2619
public static function compare(ZodiacInterface $zodiac1, ZodiacInterface $zodiac2): float;
2720
}

src/Interfaces/TranslatableInterface.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,11 @@ interface TranslatableInterface
1010
{
1111
/**
1212
* Get translator for given locale
13-
*
14-
* @param null|string $locale
15-
* @return Translator
1613
*/
1714
public function translator(?string $locale = null): Translator;
1815

1916
/**
2017
* Set translator on current object
21-
*
22-
* @param Translator $translator
23-
* @return CalculatorInterface|ZodiacInterface
2418
*/
2519
public function setTranslator(Translator $translator): CalculatorInterface|ZodiacInterface;
2620
}

src/Interfaces/ZodiacInterface.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,28 @@ interface ZodiacInterface
1010
{
1111
/**
1212
* Return the start date of the current zodiac sign
13-
*
14-
* @return Carbon
1513
*/
1614
public function start(): Carbon;
1715

1816
/**
1917
* Return the end date of the current zodiac sign
20-
*
21-
* @return Carbon
2218
*/
2319
public function end(): Carbon;
2420

2521
/**
2622
* Return the name of the current zodiac. This is more a identification key
2723
* than a textual title.
28-
*
29-
* @return string
3024
*/
3125
public function name(): string;
3226

3327
/**
3428
* Return the HTML UTF-8 symbol code representing an icon of the current zodiac sign.
35-
*
36-
* @return string
3729
*/
3830
public function html(): string;
3931

4032
/**
4133
* Return the localized title of the current zodiac in the given locale.
4234
* The locale parameter is optional, by default the english language is returned.
43-
*
44-
* @param null|string $locale
45-
* @return null|string
4635
*/
4736
public function localized(?string $locale = null): ?string;
4837

@@ -51,16 +40,11 @@ public function localized(?string $locale = null): ?string;
5140
* where 0 means no match and a maximum of 10 is a total match.
5241
*
5342
* Completely made up :) Don't plan your life around it.
54-
*
55-
* @param ZodiacInterface $zodiac
56-
* @return float
5743
*/
5844
public function compatibility(self $zodiac): float;
5945

6046
/**
6147
* Cast current object to string
62-
*
63-
* @return string
6448
*/
6549
public function __toString(): string;
6650
}

src/Laravel/Traits/CanResolveZodiac.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
trait CanResolveZodiac
1212
{
13-
protected $birthdayAttribute = 'birthday';
13+
protected string $birthdayAttribute = 'birthday';
1414

1515
public function getZodiacAttribute(): ?ZodiacInterface
1616
{

src/Laravel/ZodiacBridge.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ public function __construct(protected Application $app)
2525
/**
2626
* Create zodiac from input date
2727
*
28-
* @param int|string|DateTimeInterface $date
2928
* @throws NotReadableException
3029
* @throws InvalidArgumentException
3130
* @throws ReflectionException
3231
* @throws RuntimeException
3332
* @throws BindingResolutionException
34-
* @return ZodiacInterface
3533
*/
3634
public function make(int|string|DateTimeInterface $date): ZodiacInterface
3735
{
@@ -44,7 +42,6 @@ public function make(int|string|DateTimeInterface $date): ZodiacInterface
4442
/**
4543
* @throws BindingResolutionException
4644
* @throws RuntimeException
47-
* @return Translator
4845
*/
4946
private function translator(): Translator
5047
{

src/Laravel/ZodiacFacade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
class ZodiacFacade extends Facade
1010
{
11+
/**
12+
* @return string
13+
*/
14+
// phpcs:ignore SlevomatCodingStandard.TypeHints.ReturnTypeHint
1115
protected static function getFacadeAccessor()
1216
{
1317
return 'zodiac';

src/Laravel/ZodiacServiceProvider.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,22 @@ class ZodiacServiceProvider extends ServiceProvider
1111
{
1212
/**
1313
* Indicates if loading of the provider is deferred.
14-
*
15-
* @var bool
1614
*/
17-
protected $defer = true;
15+
protected bool $defer = true;
1816

1917
/**
2018
* Bootstrap the application events.
21-
*
22-
* @return void
2319
*/
24-
public function boot()
20+
public function boot(): void
2521
{
2622
// load translation files
2723
$this->loadTranslationsFrom(__DIR__ . '/../lang', 'zodiacs');
2824
}
2925

3026
/**
3127
* Register the service provider.
32-
*
33-
* @return void
3428
*/
35-
public function register()
29+
public function register(): void
3630
{
3731
$this->app->singleton('zodiac', fn(Application $app): ZodiacBridge => new ZodiacBridge($app));
3832
}
@@ -42,6 +36,7 @@ public function register()
4236
*
4337
* @return array<string>
4438
*/
39+
// phpcs:ignore SlevomatCodingStandard.TypeHints.ReturnTypeHint
4540
public function provides()
4641
{
4742
return ['zodiac'];

0 commit comments

Comments
 (0)