Skip to content
Draft
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
70 changes: 35 additions & 35 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
name: CS - File lint and file validation
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
lint:
name: ✔️ CS check al files
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '--skip ci') && !github.event.pull_request.draft"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Validate php files
run: find ./src/ ./tests/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l
- uses: ramsey/composer-install@v3
- name: Coding standard
name: CS - File lint and file validation

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
lint:
name: ✔️ CS check al files

runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '--skip ci') && !github.event.pull_request.draft"

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Validate php files
run: find ./src/ ./tests/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l

- uses: ramsey/composer-install@v3

- name: Coding standard
run: composer run cs
58 changes: 29 additions & 29 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
name: Static Analysis
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
tests:
name: Static Analysis for PHP
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '--skip ci') && !github.event.pull_request.draft"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- uses: ramsey/composer-install@v3
- name: Psalm
name: Static Analysis

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
tests:
name: Static Analysis for PHP

runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '--skip ci') && !github.event.pull_request.draft"

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

- uses: ramsey/composer-install@v3

- name: Psalm
run: vendor/bin/psalm
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Enea Scerba
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The MIT License (MIT)

Copyright (c) 2015 Enea Scerba

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions tests/unit/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,28 @@ public function itShouldReturnDefaultIfValFetchedIsNull(): void
$this->assertSame('default-value', $sut->get('test2.test1.sub', 'default-value'), '');
}

public function testScalarToArrayCoercionReturnsDefaultAndLeavesScalarUntouched(): void
{
$sut = $this->makeInstance(['flag' => 'value']);

$this->assertSame('value', $sut->get('flag'));
$this->assertFalse($sut->has('flag.sub')); // scalar gets cast to array during lookup
$this->assertSame('fallback', $sut->get('flag.sub', 'fallback'));
$this->assertSame('value', $sut->get('flag')); // original scalar preserved
}

public function testLiteralKeyContainingDelimiterMustUseArrayPath(): void
{
$sut = $this->makeInstance();
$sut->set(['foo.bar'], 'literal');

$this->assertFalse($sut->has('foo.bar')); // interpreted as nested path
$this->assertSame('default', $sut->get('foo.bar', 'default'));

$this->assertTrue($sut->has(['foo.bar']));
$this->assertSame('literal', $sut->get(['foo.bar']));
}

/**
* @test
*/
Expand Down