Skip to content

Commit 85bbf81

Browse files
committed
add phpstan-symfony & phpstan-phpunit
1 parent 9341389 commit 85bbf81

File tree

2 files changed

+48
-11
lines changed

2 files changed

+48
-11
lines changed

composer.json

+10-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"symfony/deprecation-contracts": "^2.1|^3"
3131
},
3232
"require-dev": {
33-
"sensio/framework-extra-bundle": "^6.0",
3433
"symfony/asset": "^6.4|^7.0",
3534
"symfony/dom-crawler": "^6.4|^7.0",
3635
"symfony/browser-kit": "^6.4|^7.0",
@@ -47,15 +46,18 @@
4746
"symfony/security-csrf": "^6.4|^7.0",
4847

4948
"api-platform/core": "^2.7.0|^3",
50-
"friendsofsymfony/rest-bundle": "^2.8|^3.0",
5149
"willdurand/hateoas-bundle": "^1.0|^2.0",
5250
"jms/serializer-bundle": "^2.3|^3.0|^4.0|^5.0",
5351
"jms/serializer": "^1.14|^3.0",
5452
"composer/package-versions-deprecated": "1.11.99.1",
5553

5654
"phpunit/phpunit": "^9.6",
5755
"doctrine/annotations": "^2.0",
58-
"phpstan/phpstan": "^1.10"
56+
57+
"phpstan/phpstan": "^1.10",
58+
"phpstan/phpstan-symfony": "^1.3",
59+
"phpstan/phpstan-phpunit": "^1.3",
60+
"phpstan/extension-installer": "^1.3"
5961
},
6062
"suggest": {
6163
"api-platform/core": "For using an API oriented framework.",
@@ -95,5 +97,10 @@
9597
"phpunit": "phpunit",
9698
"phpstan": "phpstan analyse --memory-limit=2G",
9799
"phpstan-baseline": "phpstan analyse --generate-baseline --memory-limit=2G"
100+
},
101+
"config": {
102+
"allow-plugins": {
103+
"phpstan/extension-installer": true
104+
}
98105
}
99106
}

phpstan-baseline.neon

+38-8
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ parameters:
111111
path: src/Controller/YamlDocumentationController.php
112112

113113
-
114-
message: "#^Argument of an invalid type array\\|bool\\|float\\|int\\|string\\|UnitEnum\\|null supplied for foreach, only iterables are supported\\.$#"
114+
message: "#^Argument of an invalid type array\\|bool\\|float\\|int\\|string\\|null supplied for foreach, only iterables are supported\\.$#"
115115
count: 1
116116
path: src/DependencyInjection/Compiler/TagDescribersPass.php
117117

@@ -2100,11 +2100,6 @@ parameters:
21002100
count: 1
21012101
path: src/Util/ControllerReflector.php
21022102

2103-
-
2104-
message: "#^Comparison operation \"\\>\\=\" between 70004 and 40100 is always true\\.$#"
2105-
count: 1
2106-
path: src/Util/ControllerReflector.php
2107-
21082103
-
21092104
message: "#^Method Nelmio\\\\ApiDocBundle\\\\Util\\\\ControllerReflector\\:\\:getClassAndMethod\\(\\) has no return type specified\\.$#"
21102105
count: 1
@@ -2981,7 +2976,7 @@ parameters:
29812976
path: tests/Functional/Controller/UndocumentedController.php
29822977

29832978
-
2984-
message: "#^Call to an undefined method object\\:\\:generate\\(\\)\\.$#"
2979+
message: "#^Cannot call method generate\\(\\) on object\\|null\\.$#"
29852980
count: 1
29862981
path: tests/Functional/ControllerTest.php
29872982

@@ -4530,6 +4525,26 @@ parameters:
45304525
count: 1
45314526
path: tests/Functional/FOSRestTest.php
45324527

4528+
-
4529+
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with '@OA\\\\\\\\Generator\\:…' and OpenApi\\\\Annotations\\\\Post will always evaluate to false\\.$#"
4530+
count: 1
4531+
path: tests/Functional/FunctionalTest.php
4532+
4533+
-
4534+
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with '@OA\\\\\\\\Generator\\:…' and array\\<OpenApi\\\\Annotations\\\\Property\\> will always evaluate to false\\.$#"
4535+
count: 4
4536+
path: tests/Functional/FunctionalTest.php
4537+
4538+
-
4539+
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with '@OA\\\\\\\\Generator\\:…' and array\\<string\\> will always evaluate to false\\.$#"
4540+
count: 1
4541+
path: tests/Functional/FunctionalTest.php
4542+
4543+
-
4544+
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with '@OA\\\\\\\\Generator\\:…' and bool will always evaluate to false\\.$#"
4545+
count: 3
4546+
path: tests/Functional/FunctionalTest.php
4547+
45334548
-
45344549
message: "#^Cannot access offset 'application/json' on array\\<OpenApi\\\\Annotations\\\\Attachable\\|OpenApi\\\\Annotations\\\\JsonContent\\|OpenApi\\\\Annotations\\\\MediaType\\|OpenApi\\\\Annotations\\\\XmlContent\\>\\|OpenApi\\\\Annotations\\\\Attachable\\|OpenApi\\\\Annotations\\\\JsonContent\\|OpenApi\\\\Annotations\\\\MediaType\\|OpenApi\\\\Annotations\\\\XmlContent\\.$#"
45354550
count: 2
@@ -4930,6 +4945,11 @@ parameters:
49304945
count: 1
49314946
path: tests/Functional/SwaggerUiTest.php
49324947

4948+
-
4949+
message: "#^You should use assertCount\\(\\$expectedCount, \\$variable\\) instead of assertSame\\(\\$expectedCount, \\$variable\\-\\>count\\(\\)\\)\\.$#"
4950+
count: 1
4951+
path: tests/Functional/SwaggerUiTest.php
4952+
49334953
-
49344954
message: "#^Cannot access offset 'parameters' on mixed\\.$#"
49354955
count: 4
@@ -5021,7 +5041,7 @@ parameters:
50215041
path: tests/Functional/WebTestCase.php
50225042

50235043
-
5024-
message: "#^Call to an undefined method object\\:\\:generate\\(\\)\\.$#"
5044+
message: "#^Cannot call method generate\\(\\) on object\\|null\\.$#"
50255045
count: 1
50265046
path: tests/Functional/WebTestCase.php
50275047

@@ -5780,6 +5800,11 @@ parameters:
57805800
count: 1
57815801
path: tests/ModelDescriber/Fixtures/SelfDescribingModel.php
57825802

5803+
-
5804+
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with '@OA\\\\\\\\Generator\\:…' and array\\<OpenApi\\\\Annotations\\\\Property\\> will always evaluate to false\\.$#"
5805+
count: 1
5806+
path: tests/ModelDescriber/FormModelDescriberTest.php
5807+
57835808
-
57845809
message: "#^Method Nelmio\\\\ApiDocBundle\\\\Tests\\\\ModelDescriber\\\\FormModelDescriberTest\\:\\:provideCsrfProtectionOptions\\(\\) return type has no value type specified in iterable type array\\.$#"
57855810
count: 1
@@ -6075,6 +6100,11 @@ parameters:
60756100
count: 1
60766101
path: tests/SwaggerPhp/UtilTest.php
60776102

6103+
-
6104+
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with array\\<string, mixed\\> and stdClass will always evaluate to false\\.$#"
6105+
count: 1
6106+
path: tests/SwaggerPhp/UtilTest.php
6107+
60786108
-
60796109
message: "#^Cannot access property \\$nested on OpenApi\\\\Context\\|null\\.$#"
60806110
count: 1

0 commit comments

Comments
 (0)