Skip to content

Commit 1f0af95

Browse files
committed
Check tests with PHPStan
1 parent 936faba commit 1f0af95

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

.phpstan.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# SPDX-FileCopyrightText: 2015-2023 Artur Weigandt https://wlabs.de/kontakt
22
# SPDX-License-Identifier: GPL-3.0-or-later
33

4+
includes:
5+
- vendor/phpstan/phpstan-phpunit/extension.neon
6+
47
parameters:
58
level: 8
69

710
paths:
811
- src/
12+
- tests/
913

1014
scanDirectories:
1115
- vendor

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"require-dev": {
1919
"friendsofphp/php-cs-fixer": "^3.35",
2020
"phpstan/phpstan": "^1.10",
21+
"phpstan/phpstan-phpunit": "^1.3",
2122
"phpunit/phpunit": "^9 || ^10"
2223
},
2324
"autoload": {

tests/Fixtures/Factory.php

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

99
namespace Art4\JsonApiClient\Tests\Fixtures;
1010

11-
use Art4\JsonApiClient\Utils\FactoryInterface;
11+
use Art4\JsonApiClient\Factory as FactoryInterface;
1212

1313
final class Factory implements FactoryInterface
1414
{

tests/Fixtures/HelperTrait.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@
1212
use Art4\JsonApiClient\Factory;
1313
use Art4\JsonApiClient\Manager;
1414
use Art4\JsonApiClient\Tests\Fixtures\Factory as FixtureFactory;
15+
use PHPUnit\Framework\MockObject\MockObject;
1516

1617
/**
1718
* Helper Trait
1819
*/
1920
trait HelperTrait
2021
{
22+
/** @var Manager&MockObject */
2123
protected Manager $manager;
2224

25+
/** @var Factory&MockObject */
2326
protected Factory $factory;
2427

28+
/** @var Accessable&MockObject */
2529
protected Accessable $parent;
2630

2731
/**
2832
* Json Values Provider
2933
*
30-
* @see http://json.org/
34+
* @return array<array<mixed>>
3135
*/
3236
public static function jsonValuesProvider(): array
3337
{
@@ -47,7 +51,7 @@ public static function jsonValuesProvider(): array
4751
/**
4852
* Json Values Provider but without the object
4953
*
50-
* @see http://json.org/
54+
* @return array<array<mixed>>
5155
*/
5256
public static function jsonValuesProviderWithoutObject(): array
5357
{
@@ -61,7 +65,7 @@ public static function jsonValuesProviderWithoutObject(): array
6165
/**
6266
* Json Values Provider but without the array
6367
*
64-
* @see http://json.org/
68+
* @return array<array<mixed>>
6569
*/
6670
public static function jsonValuesProviderWithoutArray(): array
6771
{
@@ -75,7 +79,7 @@ public static function jsonValuesProviderWithoutArray(): array
7579
/**
7680
* Json Values Provider but without the string
7781
*
78-
* @see http://json.org/
82+
* @return array<array<mixed>>
7983
*/
8084
public static function jsonValuesProviderWithoutString(): array
8185
{
@@ -89,7 +93,7 @@ public static function jsonValuesProviderWithoutString(): array
8993
/**
9094
* Json Values Provider but without the object and string
9195
*
92-
* @see http://json.org/
96+
* @return array<array<mixed>>
9397
*/
9498
public static function jsonValuesProviderWithoutObjectAndString(): array
9599
{
@@ -104,7 +108,7 @@ public static function jsonValuesProviderWithoutObjectAndString(): array
104108
/**
105109
* Json Values as string Provider
106110
*
107-
* @see http://json.org/
111+
* @return array<array<string>>
108112
*/
109113
public static function jsonValuesAsStringProvider(): array
110114
{
@@ -124,7 +128,7 @@ public static function jsonValuesAsStringProvider(): array
124128
/**
125129
* Json Values as string Provider but without the object
126130
*
127-
* @see http://json.org/
131+
* @return array<array<string>>
128132
*/
129133
public static function jsonValuesAsStringProviderWithoutObject(): array
130134
{
@@ -145,7 +149,7 @@ public function buildManagerMock()
145149
$factory->testcase = $this;
146150

147151
// Mock Manager
148-
$manager = $this->createMock('Art4\JsonApiClient\Utils\FactoryManagerInterface');
152+
$manager = $this->createMock(Manager::class);
149153

150154
$manager->expects($this->any())
151155
->method('getFactory')

0 commit comments

Comments
 (0)