Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,21 @@ jobs:
- php-version: 8.2
phing_tasks: "phpunitfast"
- php-version: 8.3
phing_tasks: "phpunitfast phpcs-console php-cs-fixer-dryrun phpstan-console"
phing_tasks: "phpunitfast phpcs-console php-cs-fixer-dryrun phpstan-console rector-console"

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: intl, xsl

- name: Cache rector data
uses: actions/cache@v4
with:
path: .rector
key: "php-${{ matrix.php-version }}-rector-${{ github.sha }}"
restore-keys: "php-${{ matrix.php-version }}-rector-"

- name: Checkout
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ composer.lock
.php_cs_cache
.phpstan_cache
tests/.phpunit.result.cache
.rector
13 changes: 13 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<phingcall target="phpmd"/>
<phingcall target="pdepend"/>
<phingcall target="phpstan-checkstyle"/>
<phingcall target="rector-console"/>
</target>

<!-- Report rule violations with PHPMD (mess detector) -->
Expand Down Expand Up @@ -94,6 +95,18 @@
<arg line="fix --config=${srcdir}/tests/vufind.php-cs-fixer.php --dry-run --verbose --diff" />
</exec>
</target>

<!-- Rector -->
<target name="rector-console">
<exec executable="${srcdir}/vendor/bin/rector" escape="false" passthru="true" checkreturn="true">
<arg line="--config=${srcdir}/tests/rector.php --dry-run" />
</exec>
</target>
<target name="rector">
<exec executable="${srcdir}/vendor/bin/rector" escape="false" passthru="true" checkreturn="true">
<arg line="--config=${srcdir}/tests/rector.php" />
</exec>
</target>

<!-- PHP API Documentation -->
<target name="phpdoc">
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"phpstan/phpstan": "1.12.7",
"phpunit/phpunit": "10.5.36",
"phing/phing": "3.0",
"rector/rector": "^1.2.7",
"squizlabs/php_codesniffer": "3.10.3"
}
}
1 change: 1 addition & 0 deletions tests/phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<file>.</file>
<exclude-pattern>*/config/*</exclude-pattern>
<exclude-pattern>*.php-cs-fixer.*</exclude-pattern>
<exclude-pattern>*rector.*</exclude-pattern>
<arg name="extensions" value="php"/>
<!-- We only use PEAR to ensure complete comments at this time -->
<rule ref="PEAR.Commenting">
Expand Down
21 changes: 21 additions & 0 deletions tests/rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitSetList;

return RectorConfig::configure()
->withCache(
cacheClass: FileCacheStorage::class,
cacheDirectory: __DIR__ . '/../.rector'
)->withPaths([
__DIR__ . '/../src',
])
->withSets([
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
])
->withTypeCoverageLevel(0)
->withDeadCodeLevel(6)
->withCodeQualityLevel(22);