diff --git a/.github/workflows/phpcs.yaml b/.github/workflows/phpcs.yaml index 675d71c..48b2083 100644 --- a/.github/workflows/phpcs.yaml +++ b/.github/workflows/phpcs.yaml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # 2.34.1 + - uses: shivammathur/setup-php@34a5396826718e0013f08e3e639d1c315d5f6b23 # 2.35.0 - name: Install dependencies run: composer install --no-interaction --prefer-dist - name: Run PHP_CodeSniffer (PSR-12) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 4252241..4863bee 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup PHP - uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # 2.34.1 + uses: shivammathur/setup-php@34a5396826718e0013f08e3e639d1c315d5f6b23 # 2.35.0 with: coverage: pcov diff --git a/.mega-linter.yml b/.mega-linter.yml index 82e546d..c8645a6 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -25,6 +25,8 @@ ENABLE_LINTERS: - JSON_PRETTIER - JAVASCRIPT_ES - TYPESCRIPT_ES + - PHP_PHPCS + - PHP_PSALM YAML_YAMLLINT_CONFIG_FILE: .yamllint.yml MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdownlint.json @@ -32,4 +34,4 @@ JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json TYPESCRIPT_ES_CONFIG_FILE: .eslintrc.json FILTER_REGEX_EXCLUDE: > - (node_modules|\.automation/test|docs/json-schemas|\.github/workflows) + (vendor|node_modules|\.automation/test|docs/json-schemas) diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 8d1507b..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2025 Ismo Vuorinen - -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. diff --git a/composer.json b/composer.json index 4beec76..5974b82 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,9 @@ { - "$ref": "https://getcomposer.org/schema.json", + "$schema": "https://getcomposer.org/schema.json", "name": "ivuorinen/monolog-gdpr-filter", "description": "Monolog processor for GDPR masking with regex and dot-notation paths", "version": "1.0.0", + "license": "MIT", "type": "library", "scripts": { "lint": [ diff --git a/phpcs.xml b/phpcs.xml index ed6f53a..0798c46 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,6 +1,7 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> PHP_CodeSniffer configuration for PSR-12 coding standard. src/ diff --git a/src/GdprProcessor.php b/src/GdprProcessor.php index 9beedfc..a21dddd 100644 --- a/src/GdprProcessor.php +++ b/src/GdprProcessor.php @@ -264,9 +264,6 @@ class GdprProcessor implements ProcessorInterface /** * Set the audit logger callable. - * - * @param callable|null $auditLogger - * @return void */ public function setAuditLogger(?callable $auditLogger): void { diff --git a/tests/GdprDefaultPatternsTest.php b/tests/GdprDefaultPatternsTest.php index b15fd40..07ae240 100644 --- a/tests/GdprDefaultPatternsTest.php +++ b/tests/GdprDefaultPatternsTest.php @@ -127,8 +127,6 @@ class GdprDefaultPatternsTest extends TestCase $this->assertSame($notApiKey, $processor->maskMessage($notApiKey)); } - - public function testPatternMac(): void { $patterns = GdprProcessor::getDefaultPatterns(); diff --git a/tests/GdprProcessorTest.php b/tests/GdprProcessorTest.php index 4d26007..5abac19 100644 --- a/tests/GdprProcessorTest.php +++ b/tests/GdprProcessorTest.php @@ -303,6 +303,7 @@ class GdprProcessorTest extends TestCase }; $processor = new GdprProcessor($invalidPattern); $processor->setAuditLogger($logger); + $result = $processor->regExpMessage('test'); $this->assertTrue($called, 'Audit logger should be called on preg_replace error'); $this->assertSame('test', $result, 'Message should be unchanged if preg_replace fails'); diff --git a/tests/TestHelpers.php b/tests/TestHelpers.php index daf7603..38f6582 100644 --- a/tests/TestHelpers.php +++ b/tests/TestHelpers.php @@ -13,8 +13,6 @@ use Monolog\JsonSerializableDateTimeImmutable; use Monolog\Level; use Monolog\Logger; use Monolog\LogRecord; -use ReflectionClass; -use ReflectionException; use ReflectionMethod; use Stringable; @@ -62,7 +60,7 @@ trait TestHelpers object|string $object, string $methodName = '', ): ReflectionMethod { - if (empty($methodName) && is_string($object)) { + if (($methodName === '' || $methodName === '0') && is_string($object)) { $method = new ReflectionMethod($object); } else { $method = new ReflectionMethod($object, $methodName);