Skip to content

Commit 8d837a6

Browse files
committed
adds windows-latest to github action tests and corrects PHP_EOL to \n, bumped actions to v4 to avoid warnings
1 parent 1aa917e commit 8d837a6

File tree

5 files changed

+31
-34
lines changed

5 files changed

+31
-34
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@ on:
1111
jobs:
1212

1313
tests:
14-
name: Tests - PHP ${{ matrix.php }} ${{ matrix.dependency-version }}
15-
runs-on: ubuntu-latest
14+
name: Tests ${{ matrix.os }} - PHP ${{ matrix.php }}
1615
timeout-minutes: 15
1716
strategy:
1817
matrix:
18+
os: [ubuntu-latest, windows-latest]
1919
php: [ '8.0', '8.1', '8.2', '8.3' ]
20-
dependency-version: [ '' ]
21-
include:
22-
- php: '8.0'
23-
dependency-version: '--prefer-lowest'
20+
runs-on: ${{ matrix.os }}
2421
steps:
22+
- name: Set git to use LF
23+
run: |
24+
git config --global core.autocrlf input
25+
git config --global core.eol lf
2526
- name: Checkout
26-
uses: actions/checkout@v2
27+
uses: actions/checkout@v4
2728
- name: Setup PHP
2829
uses: shivammathur/setup-php@v2
2930
with:
@@ -32,19 +33,15 @@ jobs:
3233
coverage: none
3334
# Enable apcu
3435
extensions: apcu
35-
ini-values: apc.enable_cli=1
36+
ini-values: apc.enable_cli=1, opcache.enable=1, opcache.jit=tracing, opcache.jit_buffer_size=128M
3637
- name: Cache Composer dependencies
37-
uses: actions/cache@v2
38+
uses: actions/cache@v4
3839
with:
3940
path: ~/.composer/cache
4041
key: php-${{ matrix.php }}-composer-locked-${{ hashFiles('composer.lock') }}
4142
restore-keys: php-${{ matrix.php }}-composer-locked-
4243
- name: Install PHP dependencies
43-
if: matrix.php != '8.1'
44-
run: composer update ${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress --no-suggest
45-
- name: 'Install PHP dependencies on PHP 8.1 (TODO: remove that)'
46-
if: matrix.php == '8.1'
47-
run: composer update --ignore-platform-reqs ${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress --no-suggest
44+
run: composer update ${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress
4845
- name: PHPUnit
4946
run: vendor/bin/phpunit
5047

@@ -53,15 +50,15 @@ jobs:
5350
runs-on: ubuntu-latest
5451
steps:
5552
- name: Checkout
56-
uses: actions/checkout@v2
53+
uses: actions/checkout@v4
5754
- name: Setup PHP
5855
uses: shivammathur/setup-php@v2
5956
with:
60-
php-version: 8.0
57+
php-version: 8.3
6158
tools: composer:v2, cs2pr
6259
coverage: none
6360
- name: Cache Composer dependencies
64-
uses: actions/cache@v2
61+
uses: actions/cache@v4
6562
with:
6663
path: ~/.composer/cache
6764
key: php-composer-locked-${{ hashFiles('composer.lock') }}
@@ -75,15 +72,15 @@ jobs:
7572
runs-on: ubuntu-latest
7673
steps:
7774
- name: Checkout
78-
uses: actions/checkout@v2
75+
uses: actions/checkout@v4
7976
- name: Setup PHP
8077
uses: shivammathur/setup-php@v2
8178
with:
82-
php-version: 8.0
79+
php-version: 8.3
8380
tools: composer:v2, cs2pr
8481
coverage: none
8582
- name: Cache Composer dependencies
86-
uses: actions/cache@v2
83+
uses: actions/cache@v4
8784
with:
8885
path: ~/.composer/cache
8986
key: php-composer-locked-${{ hashFiles('composer.lock') }}

src/Definition/ArrayDefinition.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function replaceNestedDefinitions(callable $replacer) : void
4242

4343
public function __toString() : string
4444
{
45-
$str = '[' . \PHP_EOL;
45+
$str = '[' . "\n";
4646

4747
foreach ($this->values as $key => $value) {
4848
if (is_string($key)) {
@@ -52,12 +52,12 @@ public function __toString() : string
5252
$str .= ' ' . $key . ' => ';
5353

5454
if ($value instanceof Definition) {
55-
$str .= str_replace(\PHP_EOL, \PHP_EOL . ' ', (string) $value);
55+
$str .= str_replace("\n", "\n" . ' ', (string) $value);
5656
} else {
5757
$str .= var_export($value, true);
5858
}
5959

60-
$str .= ',' . \PHP_EOL;
60+
$str .= ',' . "\n";
6161
}
6262

6363
return $str . ']';

src/Definition/Dumper/ObjectDefinitionDumper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function dump(ObjectDefinition $definition) : string
3535
$str = sprintf(' class = %s%s', $warning, $className);
3636

3737
// Lazy
38-
$str .= \PHP_EOL . ' lazy = ' . var_export($definition->isLazy(), true);
38+
$str .= "\n" . ' lazy = ' . var_export($definition->isLazy(), true);
3939

4040
if ($classExist) {
4141
// Constructor
@@ -48,7 +48,7 @@ public function dump(ObjectDefinition $definition) : string
4848
$str .= $this->dumpMethods($className, $definition);
4949
}
5050

51-
return sprintf('Object (' . \PHP_EOL . '%s' . \PHP_EOL . ')', $str);
51+
return sprintf('Object (' . "\n" . '%s' . "\n" . ')', $str);
5252
}
5353

5454
/**
@@ -63,7 +63,7 @@ private function dumpConstructor(string $className, ObjectDefinition $definition
6363
if ($constructorInjection !== null) {
6464
$parameters = $this->dumpMethodParameters($className, $constructorInjection);
6565

66-
$str .= sprintf(\PHP_EOL . ' __construct(' . \PHP_EOL . ' %s' . \PHP_EOL . ' )', $parameters);
66+
$str .= sprintf("\n" . ' __construct(' . "\n" . ' %s' . "\n" . ' )', $parameters);
6767
}
6868

6969
return $str;
@@ -77,7 +77,7 @@ private function dumpProperties(ObjectDefinition $definition) : string
7777
$value = $propertyInjection->getValue();
7878
$valueStr = $value instanceof Definition ? (string) $value : var_export($value, true);
7979

80-
$str .= sprintf(\PHP_EOL . ' $%s = %s', $propertyInjection->getPropertyName(), $valueStr);
80+
$str .= sprintf("\n" . ' $%s = %s', $propertyInjection->getPropertyName(), $valueStr);
8181
}
8282

8383
return $str;
@@ -93,7 +93,7 @@ private function dumpMethods(string $className, ObjectDefinition $definition) :
9393
foreach ($definition->getMethodInjections() as $methodInjection) {
9494
$parameters = $this->dumpMethodParameters($className, $methodInjection);
9595

96-
$str .= sprintf(\PHP_EOL . ' %s(' . \PHP_EOL . ' %s' . \PHP_EOL . ' )', $methodInjection->getMethodName(), $parameters);
96+
$str .= sprintf("\n" . ' %s(' . "\n" . ' %s' . "\n" . ' )', $methodInjection->getMethodName(), $parameters);
9797
}
9898

9999
return $str;
@@ -139,6 +139,6 @@ private function dumpMethodParameters(string $className, MethodInjection $method
139139
$args[] = sprintf('$%s = #UNDEFINED#', $parameter->getName());
140140
}
141141

142-
return implode(\PHP_EOL . ' ', $args);
142+
return implode("\n" . ' ', $args);
143143
}
144144
}

src/Definition/EnvironmentVariableDefinition.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,20 @@ public function replaceNestedDefinitions(callable $replacer) : void
6868

6969
public function __toString() : string
7070
{
71-
$str = ' variable = ' . $this->variableName . \PHP_EOL
71+
$str = ' variable = ' . $this->variableName . "\n"
7272
. ' optional = ' . ($this->isOptional ? 'yes' : 'no');
7373

7474
if ($this->isOptional) {
7575
if ($this->defaultValue instanceof Definition) {
7676
$nestedDefinition = (string) $this->defaultValue;
77-
$defaultValueStr = str_replace(\PHP_EOL, \PHP_EOL . ' ', $nestedDefinition);
77+
$defaultValueStr = str_replace("\n", "\n" . ' ', $nestedDefinition);
7878
} else {
7979
$defaultValueStr = var_export($this->defaultValue, true);
8080
}
8181

82-
$str .= \PHP_EOL . ' default = ' . $defaultValueStr;
82+
$str .= "\n" . ' default = ' . $defaultValueStr;
8383
}
8484

85-
return sprintf('Environment variable (' . \PHP_EOL . '%s' . \PHP_EOL . ')', $str);
85+
return sprintf('Environment variable (' . "\n" . '%s' . "\n" . ')', $str);
8686
}
8787
}

src/Definition/Exception/InvalidDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class InvalidDefinition extends \Exception implements ContainerExceptionInterfac
1717
public static function create(Definition $definition, string $message, \Exception $previous = null) : self
1818
{
1919
return new self(sprintf(
20-
'%s' . \PHP_EOL . 'Full definition:' . \PHP_EOL . '%s',
20+
'%s' . "\n" . 'Full definition:' . "\n" . '%s',
2121
$message,
2222
(string) $definition
2323
), 0, $previous);

0 commit comments

Comments
 (0)