Files
monolog-gdpr-filter/psalm.xml
Ismo Vuorinen 00c6f76c97 feat: performance, integrations, advanced features (#2)
* feat: performance, integrations, advanced features

* chore: fix linting problems

* chore: suppressions and linting

* chore(lint): pre-commit linting, fixes

* feat: comprehensive input validation, security hardening, and regression testing

- Add extensive input validation throughout codebase with proper error handling
- Implement comprehensive security hardening with ReDoS protection and bounds checking
- Add 3 new regression test suites covering critical bugs, security, and validation scenarios
- Enhance rate limiting with memory management and configurable cleanup intervals
- Update configuration security settings and improve Laravel integration
- Fix TODO.md timestamps to reflect actual development timeline
- Strengthen static analysis configuration and improve code quality standards

* feat: configure static analysis tools and enhance development workflow

- Complete configuration of Psalm, PHPStan, and Rector for harmonious static analysis.
- Fix invalid configurations and tool conflicts that prevented proper code quality analysis.
- Add comprehensive safe analysis script with interactive workflow, backup/restore
  capabilities, and dry-run modes. Update documentation with linting policy
  requiring issue resolution over suppression.
- Clean completed items from TODO to focus on actionable improvements.
- All static analysis tools now work together seamlessly to provide
  code quality insights without breaking existing functionality.

* fix(test): update Invalid regex pattern expectation

* chore: phpstan, psalm fixes

* chore: phpstan, psalm fixes, more tests

* chore: tooling tweaks, cleanup

* chore: tweaks to get the tests pass

* fix(lint): rector config tweaks and successful run

* feat: refactoring, more tests, fixes, cleanup

* chore: deduplication, use constants

* chore: psalm fixes

* chore: ignore phpstan deliberate errors in tests

* chore: improve codebase, deduplicate code

* fix: lint

* chore: deduplication, codebase simplification, sonarqube fixes

* fix: resolve SonarQube reliability rating issues

Fix useless object instantiation warnings in test files by assigning
instantiated objects to variables. This resolves the SonarQube reliability
rating issue (was C, now targeting A).

Changes:
- tests/Strategies/MaskingStrategiesTest.php: Fix 3 instances
- tests/Strategies/FieldPathMaskingStrategyTest.php: Fix 1 instance

The tests use expectException() to verify that constructors throw
exceptions for invalid input. SonarQube flagged standalone `new`
statements as useless. Fixed by assigning to variables with explicit
unset() and fail() calls.

All tests pass (623/623) and static analysis tools pass.

* fix: resolve more SonarQube detected issues

* fix: resolve psalm detected issues

* fix: resolve more SonarQube detected issues

* fix: resolve psalm detected issues

* fix: duplications

* fix: resolve SonarQube reliability rating issues

* fix: resolve psalm and phpstan detected issues
2025-10-31 13:59:01 +02:00

146 lines
4.6 KiB
XML

<?xml version="1.0" ?>
<psalm
errorLevel="5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
phpVersion="8.2"
noCache="false"
findUnusedPsalmSuppress="true"
skipChecksOnUnresolvableIncludes="true"
allowPhpStormGenerics="true"
allowStringToStandInForClass="true"
memoizeMethodCallResults="true"
hoistConstants="true"
addParamTypehint="false"
checkForThrowsDocblock="false"
checkForThrowsInGlobalScope="false"
sealAllMethods="false"
sealAllProperties="false"
>
<projectFiles>
<directory name="src" />
<directory name="examples" />
<directory name="config" />
<directory name="tests" />
<ignoreFiles>
<directory name="vendor" />
<directory name="src/Laravel" />
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin" />
</plugins>
<issueHandlers>
<!-- Laravel function compatibility -->
<UndefinedFunction>
<errorLevel type="suppress">
<referencedFunction name="config" />
<referencedFunction name="app" />
<referencedFunction name="now" />
<referencedFunction name="config_path" />
<referencedFunction name="env" />
</errorLevel>
</UndefinedFunction>
<!-- Complex return type issues in GdprProcessor -->
<InvalidReturnType>
<errorLevel type="suppress">
<file name="src/GdprProcessor.php" />
</errorLevel>
</InvalidReturnType>
<!-- Override attributes - suppress for now to avoid breaking changes -->
<MissingOverrideAttribute errorLevel="suppress" />
<!-- Class finalization - suppress to avoid API breaking changes -->
<ClassMustBeFinal errorLevel="suppress" />
<!-- Mixed types - necessary for flexible APIs -->
<MixedArgument errorLevel="suppress" />
<MixedAssignment errorLevel="suppress" />
<MixedMethodCall errorLevel="suppress" />
<MixedPropertyFetch errorLevel="suppress" />
<MixedArrayAccess errorLevel="suppress" />
<!-- Missing type annotations - backward compatibility -->
<MissingReturnType errorLevel="suppress" />
<MissingParamType errorLevel="suppress" />
<MissingPropertyType errorLevel="suppress" />
<!-- Prevent Psalm from adding complex nested return types -->
<MismatchingDocblockReturnType errorLevel="suppress" />
<MoreSpecificReturnType errorLevel="suppress" />
<LessSpecificReturnStatement errorLevel="suppress" />
<!-- Test-specific suppressions -->
<!-- Redundant test assertions - provide defensive runtime validation -->
<RedundantCondition>
<errorLevel type="suppress">
<directory name="tests" />
</errorLevel>
</RedundantCondition>
<RedundantConditionGivenDocblockType>
<errorLevel type="suppress">
<directory name="tests" />
</errorLevel>
</RedundantConditionGivenDocblockType>
<ArgumentTypeCoercion>
<errorLevel type="suppress">
<directory name="tests" />
</errorLevel>
</ArgumentTypeCoercion>
<!-- Test validation issues -->
<InvalidArgument>
<errorLevel type="suppress">
<directory name="tests" />
</errorLevel>
</InvalidArgument>
<!-- Test helper methods in anonymous classes -->
<UndefinedMethod>
<errorLevel type="suppress">
<file name="tests/Strategies/AbstractMaskingStrategyTest.php" />
</errorLevel>
</UndefinedMethod>
<!-- Test function calls -->
<UndefinedFunction>
<errorLevel type="suppress">
<directory name="tests" />
</errorLevel>
</UndefinedFunction>
<!-- Test utility calls -->
<UnusedFunctionCall>
<errorLevel type="suppress">
<directory name="tests" />
</errorLevel>
</UnusedFunctionCall>
<!-- Laravel-specific patterns -->
<!-- (Laravel directory is excluded from scanning) -->
<!-- Intentional design choices -->
<PropertyNotSetInConstructor errorLevel="suppress" />
<PossiblyUnusedMethod errorLevel="suppress" />
<PossiblyUnusedProperty errorLevel="suppress" />
<!-- Array access patterns for configuration -->
<PossiblyUndefinedArrayOffset errorLevel="suppress" />
<PossiblyInvalidArrayOffset errorLevel="suppress" />
<!-- Closure patterns in callbacks -->
<UnusedClosureParam errorLevel="suppress" />
<MissingClosureParamType errorLevel="suppress" />
<MissingClosureReturnType errorLevel="suppress" />
<!-- String manipulation patterns -->
<PossiblyInvalidCast errorLevel="suppress" />
</issueHandlers>
</psalm>