Skip to content

Commit

Permalink
Start using github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapio committed Mar 29, 2019
1 parent 1fead6a commit 90aec97
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 56 deletions.
35 changes: 35 additions & 0 deletions .github/main.workflow
@@ -0,0 +1,35 @@
workflow "Qa workflow" {
on = "push"
resolves = [
"PHPStan",
"composer-require-checker",
"Code style check",
]
}

action "composer" {
uses = "docker://composer"
secrets = ["GITHUB_TOKEN"]
args = "install --no-interaction --prefer-dist --optimize-autoloader"
}

action "PHPStan" {
uses = "docker://oskarstark/phpstan-ga"
args = "analyse src tests --level max --configuration phpstan.neon"
secrets = ["GITHUB_TOKEN"]
needs = ["composer"]
}

action "composer-require-checker" {
uses = "docker://phpga/composer-require-checker-ga"
secrets = ["GITHUB_TOKEN"]
args = "check --config-file ./composer-require-config.json composer.json"
needs = ["composer"]
}

action "Code style check" {
uses = "docker://oskarstark/phpcs-ga"
secrets = ["GITHUB_TOKEN"]
args = "-d memory_limit=1024M"
needs = ["composer"]
}
13 changes: 0 additions & 13 deletions .travis.yml
Expand Up @@ -26,19 +26,6 @@ jobs:
- travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose
- travis_retry wget --no-verbose https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml

- stage: analysis
php: 7.1
before_script:
- travis_retry wget --no-verbose https://phar.io/releases/phive.phar
- travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan
script:
- ./tools/phpstan analyse src --level max --configuration phpstan.neon

- stage: analysis
php: 7.1
script:
- composer create-project symplify/easy-coding-standard temp/ecs ^3 && temp/ecs/bin/ecs check src tests

cache:
directories:
- $HOME/.composer
Expand Down
15 changes: 15 additions & 0 deletions composer-require-config.json
@@ -0,0 +1,15 @@
{
"symbol-whitelist" : [
"null", "true", "false",
"static", "self", "parent",
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "XSLTProcessor"
],
"php-core-extensions" : [
"Core",
"pcre",
"Reflection",
"tokenizer",
"SPL",
"standard"
]
}
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -16,7 +16,8 @@
},
"require-dev": {
"mockery/mockery": "~1",
"phpunit/phpunit": "~6"
"phpunit/phpunit": "~6",
"ext-tokenizer": "^7.1"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 6 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 0 additions & 37 deletions easy-coding-standard.neon

This file was deleted.

15 changes: 15 additions & 0 deletions phpcs.xml.dist
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<ruleset name="phpDocumentor">
<description>The coding standard for phpDocumentor.</description>

<file>src</file>
<file>tests/unit</file>
<exclude-pattern>*/tests/unit/Types/ContextFactoryTest.php</exclude-pattern>
<arg value="p"/>
<rule ref="PSR2">
<include-pattern>*\.php</include-pattern>
</rule>
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>*/src/*_.php</exclude-pattern>
</rule>
</ruleset>
10 changes: 8 additions & 2 deletions src/TypeResolver.php
Expand Up @@ -115,7 +115,13 @@ public function resolve($type, Context $context = null)
}

// split the type string into tokens `|`, `?`, `(`, `)[]`, '<', '>' and type names
$tokens = preg_split('/(\\||\\?|<|>|,|\\(|\\)(?:\\[\\])+)/', $type, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
$tokens = preg_split(
'/(\\||\\?|<|>|,|\\(|\\)(?:\\[\\])+)/',
$type,
-1,
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
);

if (false === $tokens) {
throw new \InvalidArgumentException('Unable to split the type string "' . $type . '" into tokens');
}
Expand Down Expand Up @@ -200,7 +206,7 @@ private function parseTypes(\ArrayIterator $tokens, Context $context, $parserCon
}

$classType = array_pop($types);
if ($classType) {
if ($classType !== null) {
$types[] = $this->resolveCollection($tokens, $classType, $context);
}

Expand Down

0 comments on commit 90aec97

Please sign in to comment.