Skip to content

Commit

Permalink
Enhancement: Synchronize with ergebnis/php-library-template
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Oct 23, 2020
1 parent a8c64fb commit 4036bf1
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/.github/ export-ignore
/.phive/ export-ignore
/test/ export-ignore
/tools/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @ergebnis-bot @localheinz
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ runs:
steps:
- name: "Determine composer cache directory"
shell: "bash"
run: "echo \"::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)\""
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV"
6 changes: 3 additions & 3 deletions .github/actions/composer/composer/install/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ dependencies="${COMPOSER_INSTALL_DEPENDENCIES}"
if [[ ${dependencies} == "lowest" ]]; then
composer update --no-interaction --no-progress --no-suggest --prefer-lowest

exit 0
exit $?
fi

if [[ ${dependencies} == "locked" ]]; then
composer install --no-interaction --no-progress --no-suggest

exit 0
exit $?
fi

if [[ ${dependencies} == "highest" ]]; then
composer update --no-interaction --no-progress --no-suggest

exit 0
exit $?
fi

echo "::error::The value for the \"dependencies\" input needs to be one of \"lowest\", \"locked\"', \"highest\"' - got \"${dependencies}\" instead."
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
dependencies: "${{ matrix.dependencies }}"

- name: "Run ergebnis/composer-normalize"
run: "tools/composer-normalize --dry-run"
run: ".phive/composer-normalize --dry-run"

- name: "Create cache directory for friendsofphp/php-cs-fixer"
run: "mkdir -p .build/php-cs-fixer"
Expand All @@ -74,7 +74,7 @@ jobs:
uses: "actions/cache@v2.1.2"
with:
path: ".build/php-cs-fixer"
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('composer.lock') }}"
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ github.sha }}"
restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-"

- name: "Run friendsofphp/php-cs-fixer"
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
dependencies: "${{ matrix.dependencies }}"

- name: "Run maglnet/composer-require-checker"
run: "tools/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json"
run: ".phive/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json"

static-code-analysis:
name: "Static Code Analysis"
Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:
restore-keys: "php-${{ matrix.php-version }}-psalm-"

- name: "Run vimeo/psalm"
run: "vendor/bin/psalm --config=psalm.xml --diff --diff-methods --shepherd --show-info=false --stats --threads=4"
run: "vendor/bin/psalm --config=psalm.xml --diff --shepherd --show-info=false --stats --threads=4"

tests:
name: "Tests"
Expand Down Expand Up @@ -287,7 +287,7 @@ jobs:
dependencies: "${{ matrix.dependencies }}"

- name: "Collect code coverage with pcov and phpunit/phpunit"
run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=.build/logs/clover.xml"
run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=.build/phpunit/logs/clover.xml"

- name: "Send code coverage report to Codecov.io"
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/renew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
uses: "actions/cache@v2.1.2"
with:
path: ".build/php-cs-fixer"
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('composer.lock') }}"
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ github.sha }}"
restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-"

- name: "Run friendsofphp/php-cs-fixer"
Expand Down
Binary file added .phive/composer-normalize
Binary file not shown.
File renamed without changes.
4 changes: 2 additions & 2 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ $config = PhpCsFixer\Config\Factory::fromRuleSet(new PhpCsFixer\Config\RuleSet\P
]);

$config->getFinder()
->ignoreDotFiles(false)
->in(__DIR__)
->exclude([
'.build/',
'.github/',
'.notes/',
])
->ignoreDotFiles(false)
->in(__DIR__)
->name('.php_cs');

$config->setCacheFile(__DIR__ . '/.build/php-cs-fixer/.php_cs.cache');
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ code-coverage: vendor ## Collects coverage from running unit tests with phpunit/

.PHONY: coding-standards
coding-standards: vendor ## Normalizes composer.json with ergebnis/composer-normalize, lints YAML files with yamllint and fixes code style issues with friendsofphp/php-cs-fixer
tools/composer-normalize
.phive/composer-normalize
yamllint -c .yamllint.yaml --strict .
mkdir -p .build/php-cs-fixer
vendor/bin/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --verbose

.PHONY: dependency-analysis
dependency-analysis: vendor ## Runs a dependency analysis with maglnet/composer-require-checker
tools/composer-require-checker check --config-file=$(shell pwd)/composer-require-checker.json
.phive/composer-require-checker check --config-file=$(shell pwd)/composer-require-checker.json

.PHONY: help
help: ## Displays this list of targets with descriptions
Expand All @@ -34,7 +34,7 @@ static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan
mkdir -p .build/phpstan
vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=-1
mkdir -p .build/psalm
vendor/bin/psalm --config=psalm.xml --diff --diff-methods --show-info=false --stats --threads=4
vendor/bin/psalm --config=psalm.xml --diff --show-info=false --stats --threads=4

.PHONY: static-code-analysis-baseline
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan and vimeo/psalm
Expand Down
4 changes: 2 additions & 2 deletions phive.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="composer-normalize" version="^2.5.1" installed="2.5.1" location="./tools/composer-normalize" copy="true"/>
<phar name="composer-require-checker" version="^2.1.0" installed="2.1.0" location="./tools/composer-require-checker" copy="true"/>
<phar name="composer-normalize" version="^2.9.0" installed="2.9.0" location="./.phive/composer-normalize" copy="true"/>
<phar name="composer-require-checker" version="^2.1.0" installed="2.1.0" location="./.phive/composer-require-checker" copy="true"/>
</phive>
32 changes: 16 additions & 16 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.14.2@3538fe1955d47f6ee926c0769d71af6db08aa488">
<files psalm-version="3.18.2@19aa905f7c3c7350569999a93c40ae91ae4e1626">
<file src="src/CallableNormalizer.php">
<MixedInferredReturnType occurrences="1">
<code>Json</code>
Expand All @@ -21,8 +21,8 @@
<code>$decoded</code>
</MissingParamType>
<MixedAssignment occurrences="2">
<code>$this-&gt;decoded</code>
<code>$decoded</code>
<code>$this-&gt;decoded</code>
</MixedAssignment>
<PropertyNotSetInConstructor occurrences="1">
<code>$format</code>
Expand All @@ -33,19 +33,19 @@
<code>$data</code>
</MissingParamType>
<MixedArgument occurrences="7">
<code>$data</code>
<code>$item</code>
<code>$item</code>
<code>$itemSchema</code>
<code>$oneOfSchema</code>
<code>$schema-&gt;properties</code>
<code>$value</code>
<code>$data</code>
<code>$oneOfSchema</code>
</MixedArgument>
<MixedAssignment occurrences="4">
<code>$itemSchema</code>
<code>$oneOfSchema</code>
<code>$value</code>
<code>$value</code>
<code>$oneOfSchema</code>
</MixedAssignment>
<PossiblyNullArgument occurrences="1">
<code>\get_object_vars($schema-&gt;properties)</code>
Expand Down Expand Up @@ -130,11 +130,11 @@
</MixedAssignment>
<MixedInferredReturnType occurrences="6">
<code>\Generator&lt;array&lt;int&gt;&gt;</code>
<code>\Generator&lt;array{0: int, 1: string, 2: string}&gt;</code>
<code>\Generator&lt;array&lt;string&gt;&gt;</code>
<code>\Generator&lt;array&lt;string&gt;&gt;</code>
<code>\Generator&lt;array&lt;string&gt;&gt;</code>
<code>\Generator&lt;array&lt;string&gt;&gt;</code>
<code>\Generator&lt;array{0: int, 1: string, 2: string}&gt;</code>
</MixedInferredReturnType>
<MoreSpecificReturnType occurrences="1">
<code>\Generator&lt;array{0: int, 1: string, 2: string}&gt;</code>
Expand Down Expand Up @@ -170,46 +170,46 @@
</file>
<file src="test/Unit/SchemaNormalizerTest.php">
<MixedArgument occurrences="6">
<code>$fileInfo-&gt;getPath()</code>
<code>$normalizedFile</code>
<code>$normalizedFile</code>
<code>$normalizedFile</code>
<code>$normalizedFile</code>
<code>$normalizedFile</code>
<code>$fileInfo-&gt;getPath()</code>
</MixedArgument>
<MixedAssignment occurrences="5">
<code>$schemaDecoded</code>
<code>$schemaDecoded</code>
<code>$decoded</code>
<code>$fileInfo</code>
<code>$normalizedFile</code>
<code>$decoded</code>
<code>$schemaDecoded</code>
<code>$schemaDecoded</code>
</MixedAssignment>
<MixedInferredReturnType occurrences="1">
<code>\Generator&lt;array&lt;string&gt;&gt;</code>
</MixedInferredReturnType>
<MixedMethodCall occurrences="4">
<code>isFile</code>
<code>getBasename</code>
<code>getRealPath</code>
<code>getPath</code>
<code>getRealPath</code>
<code>isFile</code>
</MixedMethodCall>
</file>
<file src="test/Unit/Validator/SchemaValidatorTest.php">
<MixedArgument occurrences="6">
<code>$data</code>
<code>$schema</code>
<code>$data</code>
<code>$schema</code>
<code>$data</code>
<code>$schema</code>
<code>$schema</code>
<code>$schema</code>
</MixedArgument>
<MixedAssignment occurrences="6">
<code>$data</code>
<code>$schema</code>
<code>$data</code>
<code>$schema</code>
<code>$data</code>
<code>$schema</code>
<code>$schema</code>
<code>$schema</code>
</MixedAssignment>
</file>
<file src="test/Unit/Vendor/Composer/AbstractComposerTestCase.php">
Expand Down
Binary file removed tools/composer-normalize
Binary file not shown.

0 comments on commit 4036bf1

Please sign in to comment.