Skip to content
Open
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
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8

[*.{json,yaml,yml,xml}]
indent_style = space
indent_size = 2

[*.php]
indent_style = space
indent_size = 4
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
* text eol=lf
.github export-ignore
docs export-ignore
features export-ignore
tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php-cs-fixer.dist.php export-ignore
.readthedocs.yaml export-ignore
phpstan.dist.neon export-ignore
phpunit.xml.dist export-ignore
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ on:
- main
jobs:
ci:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
composer-script:
- behat
- cs
Expand All @@ -19,14 +20,21 @@ jobs:
- "8.3"
- "8.4"
- "8.5"
include:
- os: windows-latest
php: "8.5"
composer-script: phpunit
runs-on: ${{ matrix.os }}
name: composer run ${{ matrix.composer-script }} / PHP ${{ matrix.php }}
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, fileinfo, sockets
- id: composer-cache-dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
shell: bash
- id: composer-cache
uses: actions/cache@v5
with:
Expand All @@ -36,6 +44,7 @@ jobs:
- run: composer install
- if: ${{ matrix.composer-script == 'behat' }}
run: php -S localhost:8080 -t ./features/bootstrap > httpd.log 2>&1 &
shell: bash
- run: composer run ${{ matrix.composer-script }}
env:
PHP_CS_FIXER_IGNORE_ENV: 1
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php declare(strict_types=1);

require 'vendor/autoload.php';

$finder = new PhpCsFixer\Finder();
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@
"require": {
"php": ">=8.3",
"ext-json": "*",
"ext-fileinfo": "*",
"beberlei/assert": "^3",
"behat/behat": "^3",
"firebase/php-jwt": "^6",
"guzzlehttp/guzzle": "^7.7"
},
"require-dev": {
"ext-sockets": "*",
"friendsofphp/php-cs-fixer": "^3.92",
"imbo/imbo-coding-standard": "^3.0",
"phpstan/extension-installer": "^1.4",
Expand All @@ -60,7 +62,7 @@
}
},
"scripts": {
"behat": "vendor/bin/behat --strict",
"behat": "vendor/bin/behat --strict --colors",
"ci": [
"@behat",
"@cs",
Expand All @@ -71,8 +73,8 @@
"cs:fix": "vendor/bin/php-cs-fixer fix --diff",
"dev": "php -S localhost:8080 -t ./features/bootstrap",
"docs": "cd docs; make html",
"phpunit": "vendor/bin/phpunit",
"phpunit:coverage": "vendor/bin/phpunit --coverage-html build/coverage",
"phpunit": "vendor/bin/phpunit --colors=always",
"phpunit:coverage": "@phpunit --coverage-html build/coverage",
"sa": "vendor/bin/phpstan",
"test": [
"@behat",
Expand Down
12 changes: 8 additions & 4 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ public function createFile(string $filename, PyStringNode $content, bool $readab
file_put_contents($filename, $content);

if (!$readable) {
chmod($filename, 0000);
if (\PHP_OS_FAMILY === 'Windows') {
exec('icacls '.escapeshellarg($filename).' /deny Everyone:(R)');
} else {
chmod($filename, 0000);
}
}
}

Expand Down Expand Up @@ -218,7 +222,7 @@ private function getOutput(): string

$output = $this->process->getErrorOutput().$this->process->getOutput();

return trim((string) preg_replace('/ +$/m', '', $output));
return trim((string) preg_replace(['/ +$/m', '/\r\n/'], ['', "\n"], $output));
}

/**
Expand All @@ -235,11 +239,11 @@ private static function rmdir(string $path): void
if (is_dir($file)) {
self::rmdir($file);
} else {
unlink($file);
@unlink($file);
}
}

// Remove the remaining directory
rmdir($path);
@rmdir($path);
}
}
3 changes: 1 addition & 2 deletions src/Exception/ArrayContainsComparatorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use function sprintf;

use const JSON_PRETTY_PRINT;
use const PHP_EOL;

/**
* Array contains comparator exception.
Expand All @@ -16,7 +15,7 @@ class ArrayContainsComparatorException extends AssertionFailedException
{
public function __construct(string $message, int $code = 0, ?Throwable $previous = null, mixed $needle = null, mixed $haystack = null)
{
$message .= PHP_EOL.PHP_EOL.sprintf(
$message .= "\n\n".sprintf(
<<<MESSAGE
================================================================================
= Needle =======================================================================
Expand Down