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
25 changes: 21 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
coverage: none
- name: Install dependencies
uses: ramsey/composer-install@v2
Expand All @@ -42,13 +42,29 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
coverage: none
- name: Install dependencies
uses: ramsey/composer-install@v2
- name: Run Psalm
run: composer psalm -- --show-info=false --no-progress --no-suggestions --no-cache

rector:
name: 'Rector'
runs-on: 'ubuntu-latest'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
- name: Install dependencies
uses: ramsey/composer-install@v2
- name: Run Rector
run: composer rector:diff -- --no-progress-bar --clear-cache

php-cs-fixer:
name: 'PHPCsFixer'
runs-on: 'ubuntu-latest'
Expand All @@ -58,7 +74,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
coverage: none
- name: Install dependencies
uses: ramsey/composer-install@v2
Expand All @@ -67,7 +83,7 @@ jobs:

phpunit:
name: 'PHPUnit'
needs: ['parallel-lint', 'psalm', 'php-cs-fixer']
needs: ['parallel-lint', 'psalm', 'rector', 'php-cs-fixer']
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
Expand All @@ -79,6 +95,7 @@ jobs:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
composer-dependency:
- 'lowest'
- 'highest'
Expand Down
23 changes: 18 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
FROM php:8.2-cli
FROM php:8.3-cli-trixie

RUN \
RUN set -eux ; \
apt-get update ; \
apt-get install -y unzip ; \
apt-get install -y --no-install-recommends \
git \
unzip \
zip \
libzip-dev \
pkg-config \
ca-certificates ; \
rm -rf /var/lib/apt/lists/* ;

RUN set -eux ; \
docker-php-ext-configure zip ; \
docker-php-ext-install -j"$(nproc)" zip ; \
pecl install pcov ; \
docker-php-ext-enable pcov ;

COPY --from=composer:2.4 /usr/bin/composer /usr/local/bin/composer
COPY --from=composer/composer:2.9 /usr/bin/composer /usr/local/bin/composer

WORKDIR /usr/local/packages/tmpfile

WORKDIR /usr/local/packages/tmpfile/
CMD ["php", "-v"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
init:
docker build -t tmpfile:8.2 ./
docker build -t tmpfile:php8.3-cli-trixie ./

exec:
docker run --name tmpfile --rm --interactive --tty --volume ${PWD}:/usr/local/packages/tmpfile/ tmpfile:8.2 /bin/bash
docker run --name tmpfile --rm --interactive --tty --volume ${PWD}:/usr/local/packages/tmpfile/ tmpfile:php8.3-cli-trixie /bin/bash
33 changes: 19 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"authors": [
{
"name": "Aleksandr Denisyuk",
"email": "a@denisyuk.by",
"homepage": "https://denisyuk.by/",
"email": "aleksandr@denisyuk.email",
"homepage": "https://denisyuk.website/",
"role": "Developer"
}
],
Expand All @@ -24,12 +24,13 @@
"php": "^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.10",
"friendsofphp/php-cs-fixer": "^3.91",
"php-parallel-lint/php-console-highlighter": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.17.0",
"vimeo/psalm": "^4.26"
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpunit/phpunit": "^9.6",
"psalm/plugin-phpunit": "^0.18",
"rector/rector": "^2.2",
"vimeo/psalm": "^5.26"
},
"suggest": {
"denisyukphp/tmpfile-manager": "Allows more advanced creating and removing temp files."
Expand All @@ -45,22 +46,26 @@
}
},
"scripts": {
"phpunit": "./vendor/bin/phpunit --verbose --colors=always --no-coverage",
"phpunit:clear-cache": "rm ./build/cache/phpunit.cache",
"phpunit-coverage": "./vendor/bin/phpunit --verbose --colors=always --coverage-text",
"phpunit-coverage-html": "./vendor/bin/phpunit --verbose --colors=always --coverage-html ./build/logs/phpunit-coverage/",
"parallel-lint": "./vendor/bin/parallel-lint --colors ./src/ ./tests/",
"php-cs-fixer:fix": "./vendor/bin/php-cs-fixer fix --verbose --ansi --show-progress=dots",
"php-cs-fixer:diff": "./vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --diff",
"php-cs-fixer:clear-cache": "rm ./build/cache/php-cs-fixer.cache",
"psalm": "./vendor/bin/psalm --show-info=true",
"psalm:clear-cache": "rm -rf ./build/cache/psalm/",
"psalm:set-baseline": "@psalm --set-baseline=./psalm-baseline.xml --no-cache",
"psalm:update-baseline": "@psalm --update-baseline --no-cache",
"psalm:ignore-baseline": "@psalm --ignore-baseline --no-cache",
"rector:fix": "./vendor/bin/rector process",
"rector:diff": "./vendor/bin/rector process --dry-run",
"rector:clear-cache": "rm -rf ./build/cache/rector/",
"php-cs-fixer:fix": "./vendor/bin/php-cs-fixer fix --verbose --ansi --show-progress=dots",
"php-cs-fixer:diff": "./vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --diff",
"php-cs-fixer:clear-cache": "rm ./build/cache/php-cs-fixer.cache",
"phpunit": "./vendor/bin/phpunit --verbose --colors=always --no-coverage",
"phpunit:clear-cache": "rm ./build/cache/phpunit.cache",
"phpunit-coverage": "./vendor/bin/phpunit --verbose --colors=always --coverage-text",
"phpunit-coverage-html": "./vendor/bin/phpunit --verbose --colors=always --coverage-html ./build/logs/phpunit-coverage/",
"test": [
"@parallel-lint",
"@psalm",
"@rector:diff",
"@php-cs-fixer:diff",
"@phpunit"
]
Expand Down
26 changes: 26 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;

return RectorConfig::configure()
->withCache(
cacheDirectory: __DIR__.'/build/cache/rector',
cacheClass: FileCacheStorage::class,
)
->withPaths([
__DIR__.'/src',
__DIR__.'/tests',
])
->withPhpSets(
php80: true,
)
->withSets([
SetList::DEAD_CODE,
SetList::PRIVATIZATION,
SetList::TYPE_DECLARATION,
])
;
2 changes: 1 addition & 1 deletion src/TmpFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace TmpFile;

final class TmpFile implements TmpFileInterface
final class TmpFile implements \Stringable, TmpFileInterface
{
private string $filename;
private \Closure $handler;
Expand Down
4 changes: 1 addition & 3 deletions tests/TmpFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ public function testCreateTmpFileWithStringableBehavior(): void

public function testRemoveTmpFileOnGarbageCollection(): void
{
$filename = (static function (): string {
return (new TmpFile())->getFilename();
})();
$filename = (static fn (): string => (new TmpFile())->getFilename())();

$this->assertFileDoesNotExist($filename);
}
Expand Down