Skip to content

Commit c037dde

Browse files
authored
Add PHPStan (#171)
Add PHPStan analysis
1 parent a4a8317 commit c037dde

30 files changed

+162
-8
lines changed

.phpstan.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parameters:
2+
level: 0
3+
paths:
4+
- src
5+
- tests

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ before_script:
1717
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi
1818

1919
script:
20+
- ./vendor/bin/phpstan analyse -c .phpstan.neon
2021
- ./vendor/bin/phpunit -c phpunit.xml.dist --verbose

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"mockery/mockery": "^1.0",
5555
"orchestra/database": "~3.7.0|~3.8.0|^4.0|^5.0",
5656
"orchestra/testbench": "~3.7.0|~3.8.0|^4.0|^5.0",
57+
"phpstan/phpstan": "^0.12.29",
5758
"phpunit/phpunit": "^7.5|^8.0|^9.0"
5859
},
5960
"autoload": {

src/Console/Commands/ReactionTypeAdd.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public function handle(): int
7373
return 0;
7474
}
7575

76+
/**
77+
* @return array[]
78+
*/
7679
protected function getOptions(): array
7780
{
7881
return [

src/Console/Commands/Recount.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class Recount extends Command
4747
/**
4848
* Get the console command options.
4949
*
50-
* @return array
50+
* @return array[]
5151
*/
5252
protected function getOptions(
5353
): array {

src/Console/Commands/RegisterReactants.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ final class RegisterReactants extends Command
3535
*/
3636
protected $description = 'Register Reactable models as Reactants';
3737

38+
/**
39+
* @return array[]
40+
*/
3841
protected function getOptions(): array
3942
{
4043
return [

src/Console/Commands/RegisterReacters.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ final class RegisterReacters extends Command
3535
*/
3636
protected $description = 'Register Reacterable models as Reacters';
3737

38+
/**
39+
* @return array[]
40+
*/
3841
protected function getOptions(): array
3942
{
4043
return [

src/Console/Commands/SetupReactable.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,19 @@ final class SetupReactable extends Command
4242
*/
4343
protected $description = 'Set up reactable model';
4444

45+
/**
46+
* @var Filesystem
47+
*/
4548
private $files;
4649

50+
/**
51+
* @var MigrationCreator
52+
*/
4753
private $creator;
4854

55+
/**
56+
* @var Composer
57+
*/
4958
private $composer;
5059

5160
public function __construct(Filesystem $files, MigrationCreator $creator, Composer $composer)
@@ -133,6 +142,9 @@ public function handle(): int
133142
return 0;
134143
}
135144

145+
/**
146+
* @return array[]
147+
*/
136148
protected function getOptions(): array
137149
{
138150
return [

src/Console/Commands/SetupReacterable.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,19 @@ final class SetupReacterable extends Command
4242
*/
4343
protected $description = 'Set up reacterable model';
4444

45+
/**
46+
* @var Filesystem
47+
*/
4548
private $files;
4649

50+
/**
51+
* @var MigrationCreator
52+
*/
4753
private $creator;
4854

55+
/**
56+
* @var Composer
57+
*/
4958
private $composer;
5059

5160
public function __construct(Filesystem $files, MigrationCreator $creator, Composer $composer)
@@ -133,6 +142,9 @@ public function handle(): int
133142
return 0;
134143
}
135144

145+
/**
146+
* @return array[]
147+
*/
136148
protected function getOptions(): array
137149
{
138150
return [

src/Reactant/Facades/Reactant.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,27 @@
2323
final class Reactant implements
2424
ReacterFacadeContract
2525
{
26+
/**
27+
* @var ReactantContract
28+
*/
2629
private $reactant;
2730

2831
public function __construct(ReactantContract $reactant)
2932
{
3033
$this->reactant = $reactant;
3134
}
3235

36+
/**
37+
* @return iterable|\Cog\Contracts\Love\Reaction\Models\Reaction[]
38+
*/
3339
public function getReactions(): iterable
3440
{
3541
return $this->reactant->getReactions();
3642
}
3743

44+
/**
45+
* @return iterable|\Cog\Contracts\Love\Reactant\ReactionCounter\Models\ReactionCounter[]
46+
*/
3847
public function getReactionCounters(): iterable
3948
{
4049
return $this->reactant->getReactionCounters();

0 commit comments

Comments
 (0)