Skip to content

Commit fc7bcc5

Browse files
authored
Merge pull request #94 from lingoda/github-workflow
GitHub workflow and dependabot
2 parents 18e26ff + c133503 commit fc7bcc5

File tree

6 files changed

+275
-4
lines changed

6 files changed

+275
-4
lines changed

.github/dependabot.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: '/'
5+
schedule:
6+
interval: weekly
7+
pull-request-branch-name:
8+
separator: '-'
9+
- package-ecosystem: composer
10+
directory: '/'
11+
versioning-strategy: widen
12+
schedule:
13+
interval: weekly
14+
pull-request-branch-name:
15+
separator: '-'

.github/workflows/test.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: test
2+
on:
3+
pull_request: ~
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
name: test
12+
strategy:
13+
matrix:
14+
install-args: ['', '--prefer-lowest']
15+
php-version: ['7.2', '7.3', '7.4', '8.0']
16+
steps:
17+
# Cancel previous runs of the same branch
18+
- name: cancel
19+
uses: styfle/[email protected]
20+
with:
21+
access_token: ${{ github.token }}
22+
23+
- name: checkout
24+
uses: actions/checkout@v2
25+
26+
- name: php
27+
uses: shivammathur/[email protected]
28+
with:
29+
php-version: ${{ matrix.php-version }}
30+
31+
- name: composer-cache-dir
32+
id: composercache
33+
run: |
34+
echo "::set-output name=dir::$(composer config cache-files-dir)"
35+
36+
- name: composer-cache
37+
uses: actions/[email protected]
38+
with:
39+
path: ${{ needs.prepare.outputs.composercachedir }}
40+
key: composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }}
41+
restore-keys: |
42+
composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }}
43+
composer-${{ hashFiles('**/composer.json') }}-
44+
composer-
45+
46+
- name: composer
47+
run: |
48+
composer check-platform-reqs --no-interaction
49+
composer update ${{ matrix.install-args }} --no-interaction --no-progress --prefer-dist
50+
51+
- name: phpunit
52+
run: |
53+
vendor/bin/phpunit
54+
55+
- name: phpstan-cache
56+
uses: actions/[email protected]
57+
with:
58+
key: phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-${{ github.sha }}
59+
path: .phpstan-cache
60+
restore-keys: |
61+
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-
62+
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-
63+
phpstan-${{ matrix.php-version }}-
64+
phpstan-
65+
66+
- name: phpstan
67+
run: |
68+
mkdir -p .phpstan-cache
69+
APP_ENV=dev bin/console cache:clear
70+
vendor/bin/phpstan analyse --no-progress --no-interaction --memory-limit=1G

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
/composer.lock
33
/build
44
/var
5-
/cache
5+
/cache
6+
.phpunit.result.cache
7+
.phpstan-cache

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"phpstan/phpstan": "^0.12.25",
3838
"beberlei/porpaginas": "^1.2",
3939
"php-coveralls/php-coveralls": "^2.1.0",
40-
"symfony/phpunit-bridge": "^4.1.9 | ^5.1"
40+
"symfony/phpunit-bridge": "^4.1.9 | ^5.1",
41+
"thecodingmachine/phpstan-strict-rules": "^0.12.1"
4142
},
4243
"scripts": {
4344
"phpstan": "phpstan analyse GraphqliteBundle.php DependencyInjection/ Controller/ Resources/ Security/ -c phpstan.neon --level=7 --no-progress"

phpstan.baseline.neon

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Anonymous function should have native return typehint \"array\"\\.$#"
5+
count: 1
6+
path: Controller/GraphqliteController.php
7+
8+
-
9+
message: "#^Instanceof between GraphQL\\\\Executor\\\\Promise\\\\Promise and GraphQL\\\\Executor\\\\Promise\\\\Promise will always evaluate to true\\.$#"
10+
count: 1
11+
path: Controller/GraphqliteController.php
12+
13+
-
14+
message: "#^Anonymous function should have native return typehint \"array\"\\.$#"
15+
count: 1
16+
path: DependencyInjection/GraphqliteCompilerPass.php
17+
18+
-
19+
message: "#^Argument of an invalid type array\\|bool\\|float\\|int\\|string\\|null supplied for foreach, only iterables are supported\\.$#"
20+
count: 3
21+
path: DependencyInjection/GraphqliteCompilerPass.php
22+
23+
-
24+
message: "#^Binary operation \"\\.\" between 'security\\.firewall…' and array\\|bool\\|float\\|int\\|string\\|null results in an error\\.$#"
25+
count: 2
26+
path: DependencyInjection/GraphqliteCompilerPass.php
27+
28+
-
29+
message: "#^Cannot cast \\(array&nonEmpty\\)\\|float\\|int\\<min, \\-1\\>\\|int\\<1, max\\>\\|string\\|true to int\\.$#"
30+
count: 2
31+
path: DependencyInjection/GraphqliteCompilerPass.php
32+
33+
-
34+
message: "#^Negated boolean expression is always true\\.$#"
35+
count: 1
36+
path: DependencyInjection/GraphqliteCompilerPass.php
37+
38+
-
39+
message: "#^Property TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\DependencyInjection\\\\GraphqliteCompilerPass\\:\\:\\$cacheDir \\(string\\) does not accept array\\|bool\\|float\\|int\\|string\\|null\\.$#"
40+
count: 1
41+
path: DependencyInjection/GraphqliteCompilerPass.php
42+
43+
-
44+
message: "#^Anonymous function should have native return typehint \"string\"\\.$#"
45+
count: 2
46+
path: DependencyInjection/GraphqliteExtension.php
47+
48+
-
49+
message: "#^Method TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\DependencyInjection\\\\GraphqliteExtension\\:\\:getNamespaceDir\\(\\) is unused\\.$#"
50+
count: 1
51+
path: DependencyInjection/GraphqliteExtension.php
52+
53+
-
54+
message: "#^Class Overblog\\\\GraphiQLBundle\\\\Config\\\\GraphQLEndpoint\\\\RootResolver referenced with incorrect case\\: Overblog\\\\GraphiQLBundle\\\\Config\\\\GraphqlEndpoint\\\\RootResolver\\.$#"
55+
count: 1
56+
path: DependencyInjection/OverblogGraphiQLEndpointWiringPass.php
57+
58+
-
59+
message: "#^Call to static method forSchemaAndResolver\\(\\) on an unknown class TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\GraphiQL\\\\GraphQLEndpointInvalidSchemaException\\.$#"
60+
count: 1
61+
path: GraphiQL/EndpointResolver.php
62+
63+
-
64+
message: "#^Property TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\GraphiQL\\\\EndpointResolver\\:\\:\\$requestStack has no typehint specified\\.$#"
65+
count: 1
66+
path: GraphiQL/EndpointResolver.php
67+
68+
-
69+
message: "#^Call to an undefined method ReflectionType\\:\\:getName\\(\\)\\.$#"
70+
count: 1
71+
path: Mappers/RequestParameterMiddleware.php
72+
73+
-
74+
message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, array\\<GraphQL\\\\Validator\\\\Rules\\\\ValidationRule\\>\\|\\(callable\\) given\\.$#"
75+
count: 1
76+
path: Server/ServerConfig.php
77+
78+
-
79+
message: "#^Method TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\Tests\\\\Fixtures\\\\Controller\\\\TestGraphqlController\\:\\:contacts\\(\\) return type has no value type specified in iterable type Porpaginas\\\\Arrays\\\\ArrayResult\\.$#"
80+
count: 1
81+
path: Tests/Fixtures/Controller/TestGraphqlController.php
82+
83+
-
84+
message: "#^PHPDoc tag @return with type array\\<TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\Tests\\\\Fixtures\\\\Entities\\\\Contact\\> is incompatible with native type Porpaginas\\\\Arrays\\\\ArrayResult\\.$#"
85+
count: 1
86+
path: Tests/Fixtures/Controller/TestGraphqlController.php
87+
88+
-
89+
message: "#^Method TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\Tests\\\\Fixtures\\\\Entities\\\\Contact\\:\\:injectServicePrefetch\\(\\) has parameter \\$prefetchData with no typehint specified\\.$#"
90+
count: 1
91+
path: Tests/Fixtures/Entities/Contact.php
92+
93+
-
94+
message: "#^Method TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\Tests\\\\Fixtures\\\\Entities\\\\Contact\\:\\:prefetchData\\(\\) has no return typehint specified\\.$#"
95+
count: 1
96+
path: Tests/Fixtures/Entities/Contact.php
97+
98+
-
99+
message: "#^Method TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\Tests\\\\Fixtures\\\\Entities\\\\Contact\\:\\:prefetchData\\(\\) has parameter \\$iterable with no value type specified in iterable type iterable\\.$#"
100+
count: 1
101+
path: Tests/Fixtures/Entities/Contact.php
102+
103+
-
104+
message: "#^Cannot call method assertValid\\(\\) on object\\|null\\.$#"
105+
count: 2
106+
path: Tests/FunctionalTest.php
107+
108+
-
109+
message: "#^Cannot call method handleRequest\\(\\) on object\\|null\\.$#"
110+
count: 1
111+
path: Tests/FunctionalTest.php
112+
113+
-
114+
message: "#^Method TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\Tests\\\\FunctionalTest\\:\\:logIn\\(\\) has no return typehint specified\\.$#"
115+
count: 1
116+
path: Tests/FunctionalTest.php
117+
118+
-
119+
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
120+
count: 15
121+
path: Tests/FunctionalTest.php
122+
123+
-
124+
message: "#^Parameter \\#3 \\$message of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) expects string, string\\|false given\\.$#"
125+
count: 1
126+
path: Tests/FunctionalTest.php
127+
128+
-
129+
message: "#^Anonymous function should have native return typehint \"void\"\\.$#"
130+
count: 1
131+
path: Tests/GraphqliteTestingKernel.php
132+
133+
-
134+
message: "#^Method TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\Tests\\\\GraphqliteTestingKernel\\:\\:configureContainer\\(\\) has no return typehint specified\\.$#"
135+
count: 1
136+
path: Tests/GraphqliteTestingKernel.php
137+
138+
-
139+
message: "#^Method TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\Tests\\\\GraphqliteTestingKernel\\:\\:configureRoutes\\(\\) has no return typehint specified\\.$#"
140+
count: 1
141+
path: Tests/GraphqliteTestingKernel.php
142+
143+
-
144+
message: "#^Method TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\Tests\\\\GraphqliteTestingKernel\\:\\:configureRoutes\\(\\) has parameter \\$routes with no typehint specified\\.$#"
145+
count: 1
146+
path: Tests/GraphqliteTestingKernel.php
147+
148+
-
149+
message: "#^Property TheCodingMachine\\\\Graphqlite\\\\Bundle\\\\Tests\\\\GraphqliteTestingKernel\\:\\:\\$enableLogin \\(string\\) does not accept string\\|null\\.$#"
150+
count: 1
151+
path: Tests/GraphqliteTestingKernel.php
152+
153+
-
154+
message: "#^Cannot call method assertValid\\(\\) on object\\|null\\.$#"
155+
count: 1
156+
path: Tests/NoSecurityBundleTest.php
157+
158+
-
159+
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
160+
count: 1
161+
path: Tests/NoSecurityBundleTest.php
162+

phpstan.neon

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1+
includes:
2+
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
3+
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
4+
- phpstan.baseline.neon
15
parameters:
6+
tmpDir: .phpstan-cache
7+
paths:
8+
- .
9+
excludePaths:
10+
- vendor
11+
- cache
12+
- .phpstan-cache
13+
level: max
14+
polluteScopeWithLoopInitialAssignments: false
15+
polluteScopeWithAlwaysIterableForeach: false
16+
checkAlwaysTrueCheckTypeFunctionCall: true
17+
checkAlwaysTrueInstanceof: true
18+
checkAlwaysTrueStrictComparison: true
19+
checkExplicitMixedMissingReturn: true
20+
checkFunctionNameCase: true
21+
checkInternalClassCaseSensitivity: true
22+
checkMissingClosureNativeReturnTypehintRule: true
23+
checkTooWideReturnTypesInProtectedAndPublicMethods: true
24+
treatPhpDocTypesAsCertain: false
225
ignoreErrors:
326
- "#Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition::children\\(\\)#"
4-
#includes:
5-
# - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon

0 commit comments

Comments
 (0)