Skip to content

Commit

Permalink
Merge pull request #1 from jesseschutt/main
Browse files Browse the repository at this point in the history
Updates to php 8.1
  • Loading branch information
HollyIT authored Mar 2, 2023
2 parents deacd66 + 637e890 commit 884f65a
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 49 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.idea
.php_cs
.php_cs.cache
.phpunit.cache
.phpunit.result.cache
build
composer.lock
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
}
],
"require": {
"php": "^8.0",
"phpunit/phpunit": "^9.5"
"php": "^8.1",
"phpunit/phpunit": "^10.0"
},
"require-dev": {

Expand Down
56 changes: 19 additions & 37 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<testsuites>
<testsuite name="HollyIT Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="HollyIT Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
</phpunit>
2 changes: 1 addition & 1 deletion src/TokenReplacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ protected function doTransformations($open, $close, callable $callback)
if (str_contains($matches[1][$key], ':')) {
list($token, $args) = explode(':', $matches[1][$key], 2);
}
$results = $this->doTransformation(trim($token), trim($args));
$results = $this->doTransformation(trim($token), trim($args ?? ''));

// Let our callback to any alterations if set.
if (is_callable($this->replaceCallback)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class TestCase extends \PHPUnit\Framework\TestCase
{
public function test()
protected function setUp(): void
{
\HollyIT\TokenReplace\TokenReplacer::$defaultTransformers = [
'date' => \HollyIT\TokenReplace\Transformers\DateTransformer::class,
Expand Down
4 changes: 2 additions & 2 deletions tests/Transformers/ArrayTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class ArrayTransformerTest extends TestCase
{
/** @test * */
/** @test **/
public function it_extracts_items_from_an_array()
{
$str = 'The quick brown {{animal:jumper}} jumped over the lazy {{animal:target}}';
Expand All @@ -21,7 +21,7 @@ public function it_extracts_items_from_an_array()
$this->assertEquals('The quick brown fox jumped over the lazy dog', $transformer->transform());
}

/** @test * */
/** @test **/
public function it_removes_missing_array_values()
{
$str = 'The quick brown {{animal:jumper}} jumped over the lazy {{animal:target}}';
Expand Down
2 changes: 1 addition & 1 deletion tests/Transformers/ClosureTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class ClosureTransformerTest extends TestCase
{
/** @test * */
/** @test **/
public function it_transforms_via_closures()
{
$transformer = new \HollyIT\TokenReplace\TokenReplacer('with {{ test1:options }} and without {{ test2 }}');
Expand Down
4 changes: 2 additions & 2 deletions tests/Transformers/DateTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class DateTransformerTest extends TestCase
{
/** @test */
/** @test **/
public function it_transforms_a_date()
{
$transformer = new \HollyIT\TokenReplace\TokenReplacer('replace a {{ date:m }}/{{ date:d }}/{{ date:y }} date token');
Expand All @@ -20,7 +20,7 @@ public function it_transforms_a_date()
]) . ' date token', (string) $transformer);
}

/** @test * */
/** @test **/
public function it_requires_a_format_option()
{
$transformer = new \HollyIT\TokenReplace\TokenReplacer('{{ date }}');
Expand Down
2 changes: 1 addition & 1 deletion tests/Transformers/FileTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class FileTransformerTest extends TestCase
{
/** @test * */
/** @test **/
public function is_extract_from_a_file_path()
{
$path = '/home/me/test.txt';
Expand Down
2 changes: 1 addition & 1 deletion tests/Transformers/ObjectTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class ObjectTransformerTest extends TestCase
{
/** @test * */
/** @test **/
public function it_extracts_items_from_an_array()
{
$str = 'The quick brown {{animal:jumper}} jumped over the lazy {{animal:target}}';
Expand Down
2 changes: 1 addition & 1 deletion tests/Transformers/UrlTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class UrlTransformerTest extends TestCase
{
/** @test * */
/** @test **/
public function is_extract_from_a_file_path()
{
$url = 'https://example.com/index.html';
Expand Down

0 comments on commit 884f65a

Please sign in to comment.