Skip to content

Commit 90aec97

Browse files
committed
Start using github workflow
1 parent 1fead6a commit 90aec97

File tree

8 files changed

+81
-56
lines changed

8 files changed

+81
-56
lines changed

.github/main.workflow

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
workflow "Qa workflow" {
2+
on = "push"
3+
resolves = [
4+
"PHPStan",
5+
"composer-require-checker",
6+
"Code style check",
7+
]
8+
}
9+
10+
action "composer" {
11+
uses = "docker://composer"
12+
secrets = ["GITHUB_TOKEN"]
13+
args = "install --no-interaction --prefer-dist --optimize-autoloader"
14+
}
15+
16+
action "PHPStan" {
17+
uses = "docker://oskarstark/phpstan-ga"
18+
args = "analyse src tests --level max --configuration phpstan.neon"
19+
secrets = ["GITHUB_TOKEN"]
20+
needs = ["composer"]
21+
}
22+
23+
action "composer-require-checker" {
24+
uses = "docker://phpga/composer-require-checker-ga"
25+
secrets = ["GITHUB_TOKEN"]
26+
args = "check --config-file ./composer-require-config.json composer.json"
27+
needs = ["composer"]
28+
}
29+
30+
action "Code style check" {
31+
uses = "docker://oskarstark/phpcs-ga"
32+
secrets = ["GITHUB_TOKEN"]
33+
args = "-d memory_limit=1024M"
34+
needs = ["composer"]
35+
}

.travis.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,6 @@ jobs:
2626
- travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose
2727
- travis_retry wget --no-verbose https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
2828

29-
- stage: analysis
30-
php: 7.1
31-
before_script:
32-
- travis_retry wget --no-verbose https://phar.io/releases/phive.phar
33-
- travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan
34-
script:
35-
- ./tools/phpstan analyse src --level max --configuration phpstan.neon
36-
37-
- stage: analysis
38-
php: 7.1
39-
script:
40-
- composer create-project symplify/easy-coding-standard temp/ecs ^3 && temp/ecs/bin/ecs check src tests
41-
4229
cache:
4330
directories:
4431
- $HOME/.composer

composer-require-config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"symbol-whitelist" : [
3+
"null", "true", "false",
4+
"static", "self", "parent",
5+
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "XSLTProcessor"
6+
],
7+
"php-core-extensions" : [
8+
"Core",
9+
"pcre",
10+
"Reflection",
11+
"tokenizer",
12+
"SPL",
13+
"standard"
14+
]
15+
}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
},
1717
"require-dev": {
1818
"mockery/mockery": "~1",
19-
"phpunit/phpunit": "~6"
19+
"phpunit/phpunit": "~6",
20+
"ext-tokenizer": "^7.1"
2021
},
2122
"autoload": {
2223
"psr-4": {

composer.lock

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

easy-coding-standard.neon

Lines changed: 0 additions & 37 deletions
This file was deleted.

phpcs.xml.dist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="phpDocumentor">
3+
<description>The coding standard for phpDocumentor.</description>
4+
5+
<file>src</file>
6+
<file>tests/unit</file>
7+
<exclude-pattern>*/tests/unit/Types/ContextFactoryTest.php</exclude-pattern>
8+
<arg value="p"/>
9+
<rule ref="PSR2">
10+
<include-pattern>*\.php</include-pattern>
11+
</rule>
12+
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
13+
<exclude-pattern>*/src/*_.php</exclude-pattern>
14+
</rule>
15+
</ruleset>

src/TypeResolver.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,13 @@ public function resolve($type, Context $context = null)
115115
}
116116

117117
// split the type string into tokens `|`, `?`, `(`, `)[]`, '<', '>' and type names
118-
$tokens = preg_split('/(\\||\\?|<|>|,|\\(|\\)(?:\\[\\])+)/', $type, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
118+
$tokens = preg_split(
119+
'/(\\||\\?|<|>|,|\\(|\\)(?:\\[\\])+)/',
120+
$type,
121+
-1,
122+
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
123+
);
124+
119125
if (false === $tokens) {
120126
throw new \InvalidArgumentException('Unable to split the type string "' . $type . '" into tokens');
121127
}
@@ -200,7 +206,7 @@ private function parseTypes(\ArrayIterator $tokens, Context $context, $parserCon
200206
}
201207

202208
$classType = array_pop($types);
203-
if ($classType) {
209+
if ($classType !== null) {
204210
$types[] = $this->resolveCollection($tokens, $classType, $context);
205211
}
206212

0 commit comments

Comments
 (0)