Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion .github/workflows/deptrac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
deptrac:
uses: codeigniter4/.github/.github/workflows/deptrac.yml@main
uses: codeigniter4/.github/.github/workflows/deptrac.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/phpcpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ on:

jobs:
phpcpd:
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@main
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@CI46
with:
dirs: "src/ tests/"
2 changes: 1 addition & 1 deletion .github/workflows/phpcsfixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ on:

jobs:
phpcsfixer:
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@main
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
phpstan:
uses: codeigniter4/.github/.github/workflows/phpstan.yml@main
uses: codeigniter4/.github/.github/workflows/phpstan.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-lowest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
phpunit:
uses: codeigniter4/.github/.github/workflows/phpunit-lowest.yml@main
uses: codeigniter4/.github/.github/workflows/phpunit-lowest.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
phpunit:
uses: codeigniter4/.github/.github/workflows/phpunit.yml@main
uses: codeigniter4/.github/.github/workflows/phpunit.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
psalm:
uses: codeigniter4/.github/.github/workflows/psalm.yml@main
uses: codeigniter4/.github/.github/workflows/psalm.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
rector:
uses: codeigniter4/.github/.github/workflows/rector.yml@main
uses: codeigniter4/.github/.github/workflows/rector.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/unused.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ on:

jobs:
unused:
uses: codeigniter4/.github/.github/workflows/unused.yml@main
uses: codeigniter4/.github/.github/workflows/unused.yml@CI46
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ config classes for CodeIgniter 4 framework.
[![](https://github.com/codeigniter4/settings/workflows/Deptrac/badge.svg)](https://github.com/codeigniter4/settings/actions/workflows/inspect.yml)
[![Coverage Status](https://coveralls.io/repos/github/codeigniter4/settings/badge.svg?branch=develop)](https://coveralls.io/github/codeigniter4/settings?branch=develop)

![PHP](https://img.shields.io/badge/PHP-%5E7.4-blue)
![PHP](https://img.shields.io/badge/PHP-%5E8.1-blue)
![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.2.3-blue)
![License](https://img.shields.io/badge/License-MIT-blue)

Expand Down
9 changes: 3 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
],
"homepage": "https://github.com/codeigniter4/settings",
"require": {
"php": "^7.4 || ^8.0"
"php": "^8.1"
},
"require-dev": {
"codeigniter/coding-standard": "1.7.*",
"codeigniter4/devkit": "^1.1.2",
"codeigniter4/framework": "^4.2.3",
"phpunit/phpunit": "^9.6",
"rector/rector": "1.2.8"
"codeigniter4/devkit": "^1.3",
"codeigniter4/framework": "^4.2.3"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ service('settings')->forget('App.siteName');

### Requirements

![PHP](https://img.shields.io/badge/PHP-%5E7.4-red)
![PHP](https://img.shields.io/badge/PHP-%5E8.1-red)
![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.2.3-red)

### Acknowledgements
Expand Down
13 changes: 13 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
parameters:
ignoreErrors:
-
message: '#^Offset string does not exist on list\<CodeIgniter\\Settings\\Handlers\\BaseHandler\>\.$#'
identifier: offsetAccess.notFound
count: 1
path: src/Settings.php

-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''CodeIgniter\\\\Settings\\\\Settings'' and CodeIgniter\\Settings\\Settings will always evaluate to true\.$#'
identifier: method.alreadyNarrowedType
count: 1
path: tests/HelperTest.php
41 changes: 20 additions & 21 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
includes:
- phpstan-baseline.neon
parameters:
tmpDir: build/phpstan
level: 5
paths:
- src/
- tests/
bootstrapFiles:
- vendor/codeigniter4/framework/system/Test/bootstrap.php
excludePaths:
- src/Config/Routes.php
- src/Views/*
ignoreErrors:
universalObjectCratesClasses:
- CodeIgniter\Entity
- CodeIgniter\Entity\Entity
- Faker\Generator
scanDirectories:
- vendor/codeigniter4/framework/system/Helpers
dynamicConstantNames:
- APP_NAMESPACE
- CI_DEBUG
- ENVIRONMENT
tmpDir: build/phpstan
level: 5
paths:
- src/
- tests/
bootstrapFiles:
- vendor/codeigniter4/framework/system/Test/bootstrap.php
excludePaths:
universalObjectCratesClasses:
- CodeIgniter\Entity
- CodeIgniter\Entity\Entity
- Faker\Generator
scanDirectories:
- vendor/codeigniter4/framework/system/Helpers
dynamicConstantNames:
- APP_NAMESPACE
- CI_DEBUG
- ENVIRONMENT
159 changes: 70 additions & 89 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,102 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
backupGlobals="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="random"
failOnRisky="true"
failOnWarning="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="true">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
backupGlobals="false"
beStrictAboutOutputDuringTests="true"
colors="true"
executionOrder="random"
failOnRisky="true"
failOnWarning="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
cacheDirectory="build/.phpunit.cache"
beStrictAboutCoverageMetadata="true">

<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/Config</directory>
<directory suffix=".php">./src/Views</directory>
</exclude>
<report>
<clover outputFile="build/phpunit/clover.xml"/>
<html outputDirectory="build/phpunit/html"/>
<php outputFile="build/phpunit/coverage.serialized"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
<xml outputDirectory="build/phpunit/xml-coverage"/>
</report>
</coverage>
<coverage includeUncoveredFiles="true">
<report>
<clover outputFile="build/phpunit/clover.xml"/>
<html outputDirectory="build/phpunit/html"/>
<php outputFile="build/phpunit/coverage.serialized"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
<xml outputDirectory="build/phpunit/xml-coverage"/>
</report>
</coverage>

<testsuites>
<testsuite name="main">
<directory>./tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="main">
<directory>./tests</directory>
</testsuite>
</testsuites>

<extensions>
<extension class="Nexus\PHPUnit\Extension\Tachycardia">
<arguments>
<array>
<element key="timeLimit">
<double>0.50</double>
</element>
<element key="reportable">
<integer>30</integer>
</element>
<element key="precision">
<integer>2</integer>
</element>
<element key="collectBare">
<boolean>true</boolean>
</element>
<element key="tabulate">
<boolean>true</boolean>
</element>
</array>
</arguments>
</extension>
</extensions>
<extensions>
<bootstrap class="Nexus\PHPUnit\Tachycardia\TachycardiaExtension">
<parameter name="time-limit" value="0.50"/>
<parameter name="report-count" value="30"/>
<parameter name="format" value="table"/>
</bootstrap>
</extensions>

<logging>
<testdoxHtml outputFile="build/phpunit/testdox.html"/>
<testdoxText outputFile="build/phpunit/testdox.txt"/>
<junit outputFile="build/phpunit/junit.xml"/>
</logging>
<logging>
<testdoxHtml outputFile="build/phpunit/testdox.html"/>
<testdoxText outputFile="build/phpunit/testdox.txt"/>
<junit outputFile="build/phpunit/junit.xml"/>
</logging>

<php>
<env name="XDEBUG_MODE" value="coverage"/>
<server name="app.baseURL" value="https://example.com/"/>
<php>
<env name="XDEBUG_MODE" value="coverage"/>
<server name="app.baseURL" value="https://example.com/"/>

<!-- Directory containing phpunit.xml -->
<const name="HOMEPATH" value="./"/>
<!-- Directory containing phpunit.xml -->
<const name="HOMEPATH" value="./"/>

<!-- Directory containing the Paths config file -->
<const name="CONFIGPATH" value="./vendor/codeigniter4/framework/app/Config/"/>
<!-- Directory containing the Paths config file -->
<const name="CONFIGPATH" value="vendor/codeigniter4/framework/app/Config/"/>

<!-- Directory containing the front controller (index.php) -->
<const name="PUBLICPATH" value="./vendor/codeigniter4/framework/public/"/>
<!-- Directory containing the front controller (index.php) -->
<const name="PUBLICPATH" value="./public/"/>

<!-- https://getcomposer.org/xdebug -->
<env name="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>
<!-- https://getcomposer.org/xdebug -->
<env name="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>

<!-- Database configuration -->
<env name="database.tests.strictOn" value="true"/>
<!-- Uncomment to use alternate testing database configuration
<env name="database.tests.hostname" value="localhost"/>
<env name="database.tests.database" value="tests"/>
<env name="database.tests.username" value="tests_user"/>
<env name="database.tests.password" value=""/>
<env name="database.tests.DBDriver" value="MySQLi"/>
<env name="database.tests.DBPrefix" value="tests_"/>
-->
</php>
<!-- Database configuration -->
<env name="database.tests.strictOn" value="true"/>
<!-- Uncomment to use alternate testing database configuration
<env name="database.tests.hostname" value="localhost"/>
<env name="database.tests.database" value="tests"/>
<env name="database.tests.username" value="tests_user"/>
<env name="database.tests.password" value=""/>
<env name="database.tests.DBDriver" value="MySQLi"/>
<env name="database.tests.DBPrefix" value="tests_"/>
-->
</php>
<source>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/Config</directory>
</exclude>
</source>
</phpunit>
17 changes: 11 additions & 6 deletions rector.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

declare(strict_types=1);

/**
* This file is part of CodeIgniter Settings.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
Expand All @@ -26,7 +37,6 @@
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\ValueObject\PhpVersion;

return static function (RectorConfig $rectorConfig): void {
Expand Down Expand Up @@ -89,9 +99,4 @@
$rectorConfig->rule(FuncGetArgsToVariadicParamRector::class);
$rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class);
$rectorConfig->rule(SimplifyEmptyArrayCheckRector::class);
$rectorConfig
->ruleWithConfiguration(TypedPropertyFromAssignsRector::class, [
// Set to false if you use in libraries, or it does create breaking changes.
TypedPropertyFromAssignsRector::INLINE_PUBLIC => false,
]);
Comment thread
samsonasik marked this conversation as resolved.
};
2 changes: 1 addition & 1 deletion src/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected function isSerialized($data, $strict = true): bool
if ('"' !== substr($data, -2, 1)) {
return false;
}
} elseif (false === strpos($data, '"')) {
} elseif (! str_contains($data, '"')) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private function prepareClassAndProperty(string $key): array
// Use a fully qualified class name if the
// config file was found.
if ($config !== null) {
$class = get_class($config);
$class = $config::class;
}

return [$class, $property, $config];
Expand Down
Loading