Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tags: MarjovanLier/StringManipulation

Tags

v2.0.8

Toggle v2.0.8's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Enhance repository configuration and documentation (#53)

* chore(repo): Convert .gitignore to a secure whitelist pattern

- Implement a deny-all `/*` strategy for enhanced security
- Selectively un-ignore essential files and directories with `!`
- Add explicit sections and documentation for clarity
- Include an explicit deny list for sensitive directories

This whitelist approach provides a secure-by-default configuration,
preventing the accidental commit of sensitive files or local
configurations. It improves repository hygiene and may enhance Git's
performance by optimising traversal patterns.

Signed-off-by: Marjo van Lier <[email protected]>

* feat(composer): Enhance package metadata and update dependencies

- Update package description to highlight performance optimisations
- Add detailed explanations for all script descriptions
- Upgrade development dependencies to their latest versions

This enhances the package's discoverability by clearly communicating its
high-performance features. The improved script descriptions clarify the
purpose of each development tool.

Updating dependencies ensures better stability and access to the latest
features from our development toolchain.

Signed-off-by: Marjo van Lier <[email protected]>

* docs(readme): Add performance benchmarks and tests

- Add Performance Benchmarks section with ops/sec metrics
- Revamp Features section to highlight O(n) optimisations
- Expand Testing section with Docker-based workflow
- Restructure Table of Contents for improved navigation
- Update introduction to reflect high-performance positioning

These changes transform the README into a compelling showcase of the
library's technical excellence. The new benchmarks provide quantifiable
proof of the recent 2-5x speed improvements, addressing developer
concerns about efficiency.

The enhanced testing documentation builds credibility, whilst the
restructured content improves the overall developer experience.

Signed-off-by: Marjo van Lier <[email protected]>

* chore(repo): Remove `.github` directory from .gitignore

- Adjust .gitignore to stop ignoring the `.github` directory
- Ensures inclusion of GitHub-specific workflows or configurations in version control

This change improves repository consistency by allowing essential `.github` files to be tracked.

* fix(gitignore): Correct whitelist pattern for global file denial

Change /* to * in .gitignore to properly implement whitelist approach.
The /* pattern only denies root-level items, allowing subdirectory
files to be inadvertently tracked. The * pattern correctly denies
all files and directories throughout the repository, ensuring true
whitelist behaviour where only explicitly allowed files are tracked.

This critical security fix prevents accidental commits of sensitive
files that may exist in subdirectories, strengthening the repository's
security posture by enforcing comprehensive file denial by default.

Signed-off-by: Marjo van Lier <[email protected]>

* feat(qodo): Enable auto approval for quality PRs

- Enable auto approval when review effort is ≤4
- Enable auto approval when code suggestions tool finds no issues
- Remove manual approval requirement for qualifying PRs
- Maintain security and effort labeling for transparency

This allows Qodo Merge to automatically approve PRs that meet
quality thresholds, streamlining the review process whilst
maintaining code quality standards through automated analysis.

Signed-off-by: Marjo van Lier <[email protected]>

* fix(qodo): Correct auto approval configuration structure

Move auto approval settings to [config] section per official docs:
- Enable auto approval for PRs with review effort ≤3
- Enable manual approval via /review auto_approve comments
- Enable auto approval when improve tool finds no suggestions
- Add self-review checkbox for PR authors

This aligns with Qodo Merge official documentation structure
and ensures auto approval features function correctly.

Signed-off-by: Marjo van Lier <[email protected]>

* feat(config): Add language and filtering options

- Add English language configuration for consistent output
- Disable output of relevant configurations to reduce noise
- Add ticket label filtering to skip draft and wont-fix PRs
- Improve configuration organisation with section comments

Enhances Qodo Merge workflow by providing cleaner output
and better PR filtering capabilities. The ticket filtering
prevents unnecessary reviews on draft or abandoned work.

Signed-off-by: Marjo van Lier <[email protected]>

* fix(gitignore): Restrict src and tests to PHP files only for enhanced security

Make whitelist patterns more specific by changing:
- !src/** → !src/**/*.php
- !tests/** → !tests/**/*.php

This prevents accidental commits of temporary files, local configs,
or other unwanted content in source directories.

Co-authored-by: Marjo <[email protected]>

---------

Signed-off-by: Marjo van Lier <[email protected]>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Marjo <[email protected]>

v2.0.7

Toggle v2.0.7's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
(Changed) Complete O(n) performance optimisation suite with comprehen…

…sive benchmarking (#50)

* feat(performance): Complete O(n) optimization suite

PERFORMANCE OPTIMIZATIONS:
- Phase 1: Replace str_replace() with strtr() in removeAccents()
  for 2-3x performance improvement using O(1) hash lookup
- Phase 2: Implement single-pass algorithm in searchWords()
  replacing 5+ string traversals with combined character mapping
- Phase 3: Consolidate nameFix() regex operations from 6+
  passes to 3 main passes with optimized Mc/Mac detection

BENCHMARK SUITE IMPLEMENTATION:
- Create professional PHPUnit-style benchmark classes replacing
  problematic standalone scripts
- Add ComprehensiveBenchmark, NameFixBenchmark,
  RemoveAccentsBenchmark, and SearchWordsBenchmark classes
- Implement proper CLI execution with static run() methods
- Add O(n) complexity verification and performance testing

QUALITY ASSURANCE IMPROVEMENTS:
- Resolve all PHPStan static analysis errors (14+ issues)
- Fix Phan autoload path issues in benchmark files
- Address code style violations with Laravel Pint compliance
- Add Psalm suppressions for benchmark class static analysis
- Apply pre-increment optimization in loop counters
- Remove redundant type casts and improve code formatting
- Maintain 100% test coverage with 166 PHPUnit tests passing
- Achieve 88% mutation testing score with comprehensive coverage

TECHNICAL ACHIEVEMENTS:
- removeAccents(): 1,120,621+ operations/second performance
- searchWords(): 648,258+ operations/second with single-pass
- nameFix(): 261,893+ operations/second with consolidated regex
- All methods maintain exact API and output compatibility
- Complete algorithmic improvement from O(n*k) to O(n) complexity
- Clean static analysis results across all tools

The StringManipulation library now features comprehensive O(n)
performance optimizations across all core methods while maintaining
100% backward compatibility and achieving professional code quality
standards with modern PHP 8.3+ architecture and clean static
analysis results.

Signed-off-by: Marjo van Lier <[email protected]>

* fix(unicode): Fix uppercase accent mapping bug

- Fix critical searchWords() bug where uppercase accented characters
  like 'À' incorrectly returned 'A' instead of 'a'
- Apply strtolower() to REMOVE_ACCENTS_TO values for consistent
  lowercase output in searchWords() method
- Add array_combine() validation to prevent fatal errors from
  mismatched array lengths with LogicException handling
- Preserve case correctly in removeAccents() while fixing searchWords()

Comprehensive test coverage includes:
- ArrayCombineValidationBugFixTest for array length validation
- UppercaseAccentMappingBugFixTest for accent character processing
- CriticalBugFixIntegrationTest to verify combined functionality
- Static cache reset between tests for consistent test states

Tests validate both happy path scenarios and edge cases to prevent
future regressions. The fix ensures searchWords('À') returns 'a'
not 'A', while removeAccents('À') correctly returns 'A'.

Array validation prevents fatal errors from mismatched array lengths
in array_combine() operations with proper exception handling.

Signed-off-by: Marjo van Lier <[email protected]>

---------

Signed-off-by: Marjo van Lier <[email protected]>

v2.0.6

Toggle v2.0.6's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
(Added) Enhance mutation testing coverage with logical condition tests (

#49)

* test(mutation): Add comprehensive logical condition tests

- Add Mac/Mc prefix handling tests targeting LogicalAnd mutations
- Implement single character optimisation tests for mutation coverage
- Test edge cases where both conditions must be true for code paths
- Verify proper handling of array vs string parameter combinations
- Enhance test coverage for logical operators in nameFix and strReplace

These tests specifically target mutation testing scenarios by validating
that logical AND conditions work correctly. The new test methods ensure
that both conditions in logical expressions must be satisfied for the
intended behaviour to occur, improving the robustness of mutation
testing coverage.

Signed-off-by: Marjo van Lier <[email protected]>

* chore: Enable manual approval for PR-Agent

- Disable enable_auto_approval setting
- Add require_approval = true configuration
- Remove auto_approve commands from pr_commands and push_commands
- PR-Agent will now require manual approval instead of automatic approval

Co-authored-by: Marjo <[email protected]>

---------

Signed-off-by: Marjo van Lier <[email protected]>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Marjo <[email protected]>

v2.0.5

Toggle v2.0.5's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add Claude Code GitHub Workflow (#48)

* "Update Claude PR Assistant workflow"

* "Claude Code Review workflow"

v2.0.4

Toggle v2.0.4's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
(Added) Comprehensive test suite enhancement for StringManipulation l…

…ibrary

This merge request introduces a significant enhancement to the project's test suite, increasing the total number of tests from 125 to 166 and assertions to 1126. The changes add comprehensive test coverage for all functions within the `StringManipulation` library, with a special focus on the `nameFix` method. This effort improves code quality, ensures robustness against a wide range of inputs, and increases the mutation testing score from 90% to 92%.

v2.0.3

Toggle v2.0.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add Claude Code GitHub Workflow (#46)

* Add Claude PR Assistant workflow

* fix(claude): Update permissions and add security restrictions

- Change pull-requests and issues permissions from read to write to allow Claude to respond
- Add user restriction to only allow MarjovanLier to trigger Claude
- Add repository check to prevent workflow tampering from forks
- Prevent unauthorized API usage and costs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>

v2.0.2

Toggle v2.0.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
(Changed) Performance optimisations, bug fixes, and Docker-based deve…

…lopment setup (#45)

* refactor: Change class to final and update static method calls to self

(Changed) Make StringManipulation final and update static to self references

Make `StringManipulation` class final and replace `static` with `self`.

Converted the `StringManipulation` class to `final` to prevent inheritance and replaced all occurrences of `static` with `self` for improved clarity and static binding. Additionally, updated development dependencies in `composer.json` to their latest versions for enhanced tooling support.

* refactor: improve string processing readability

- Simplify control flow in string replacement methods
- Reduce code complexity for better maintainability

* perf: optimize string replacement logic for efficiency

- Improve performance of string manipulation operations
- Reduce unnecessary iterations in replacement algorithms

* perf: cache accent replacement mappings for better performance

- Implement caching mechanism for accent transformations
- Reduce repeated computations in accent normalization

* test: add comprehensive tests for string replacement optimizations

- Add test coverage for edge cases in string replacement
- Validate performance improvements with test cases

* refactor: remove unnecessary optimizations in strReplace method

- Simplify string replacement implementation
- Remove premature optimization attempts

* docs(project): Improve documentation accuracy and consistency

- Standardise spelling to South African English throughout codebase
  - Change "optimize/optimization" to "optimise/optimisation"
  - Change "normalize" to "normalise"
  - Change "standardize/capitalizing" to "standardise/capitalising"

- Fix README.md documentation issues
  - Remove duplicate UTF-8 to ANSI conversion section
  - Correct method name from validateDate() to isValidDate()
  - Remove references to non-existent validateTime() method
  - Fix incorrect output descriptions for utf8Ansi examples

- Fix code quality issues
  - Remove duplicate PHPDoc for removeAccents() method
  - Fix duplicate 'ë' character in REMOVE_ACCENTS_FROM array
  - Standardise parameter naming: $valor to $value in utf8Ansi()

- Clarify UnicodeMappings trait documentation
  - Update to accurately describe Unicode escape sequence decoding
  - Correct misconception about ANSI conversion functionality

These changes improve code maintainability and ensure documentation
accurately reflects the actual implementation. All tests pass.

Signed-off-by: Marjo Wenzel van Lier <[email protected]>

* style: Fix code style issues

- Add missing periods to inline comments
- Fix array alignment in ACCENTS_REPLACEMENT
- Fix spacing in method signature
- Add parentheses around null coalescing operation
- Change dynamic method calls to static in tests

These changes address Codacy and PHPStan warnings.

Signed-off-by: Marjo Wenzel van Lier <[email protected]>

* style: Fix binary operator spacing

Laravel Pint detected incorrect spacing around the equals sign
in the method signature default parameter.

Signed-off-by: Marjo Wenzel van Lier <[email protected]>

* refactor: Remove unreachable null check

The null check after nameFix() was unreachable since nameFix() only
returns null when its input is null, and we already check for null
input at the beginning of searchWords().

This improves code coverage by removing dead code.

Signed-off-by: Marjo Wenzel van Lier <[email protected]>

* fix: Add type assertion for PHPStan

PHPStan cannot infer that nameFix() only returns null when its input
is null. Added an assertion to help the static analyzer understand
the code flow better.

Signed-off-by: Marjo Wenzel van Lier <[email protected]>

* refactor: Replace assert with type cast for PHPStan

Using assert() in production code is not recommended as assertions
can be disabled. Instead, we use a type cast to string which is safe
because we've already verified the input is not null.

Signed-off-by: Marjo Wenzel van Lier <[email protected]>

* fix: Remove unnecessary SensitiveParameter import and fix cast spacing

- Remove duplicate SensitiveParameter import that conflicts with PHP 8's built-in attribute
- Use global \SensitiveParameter attribute instead of importing it
- Fix cast spacing to comply with PER coding standards

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Signed-off-by: MarjovanLier <[email protected]>

* feat(ci): Add pre-commit hooks with containerised testing

- Add Dockerfile for PHP 8.3 with all required extensions including xdebug
- Create docker-compose.yml with individual test services
- Set up pre-commit framework with comprehensive checks
- Add custom commit-msg hook for conventional commits validation
- Create test-runner.sh for easy test execution
- Create setup-hooks.sh for automated setup
- Add .dockerignore to optimise Docker builds
- Document setup process in CONTRIBUTING.md
- Update .gitignore with Docker and pre-commit entries

All tests now run in consistent Docker containers to avoid environment-specific issues.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Signed-off-by: MarjovanLier <[email protected]>

* fix(ci): Fix test runner script and remove docker-compose version warning

- Fix missing print_info function in test-runner.sh
- Remove obsolete version attribute from docker-compose.yml
- Fix composer validation test handling in test runner
- Add missing newlines at end of files (linter fixes)

All required tests now pass successfully in containers.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Signed-off-by: MarjovanLier <[email protected]>

* fix: resolve Phan compatibility issues with typed constants

- Remove typed array constants to support Phan polyfill parser
- Update Rector config to skip type-adding rules
- Fix import path for RemoveUselessVarTagRector
- Maintain type safety through PHPDoc annotations
- Set Phan processes to 1 to avoid pcntl requirement

All critical static analysis tools now passing (Phan, PHPStan, Rector)

* fix: suppress MissingClassConstType errors in Psalm

This allows both Phan and Psalm to pass - Phan requires untyped constants
while Psalm normally requires typed constants. By suppressing this specific
error type, we maintain compatibility with both tools.

* feat: add all composer tests to pre-commit hooks via Docker

- Add phpmd, phan, rector, and infection to pre-commit hooks
- All tests now run in Docker containers for consistency
- Infection mutation testing runs on pre-push stage
- Add helper script run-tests-docker.sh for running all tests
- Fix deprecated stage names (commit -> pre-commit, push -> pre-push)
- Enable xdebug in Docker for mutation testing support

All pre-commit hooks now passing with 98% mutation coverage

* style: add periods to inline comments in test files

- Add periods to all inline comments for consistency
- Follows coding style guidelines for comment punctuation
- Addresses CodeRabbit review feedback

* feat(hooks): Implement commitlint for conventional commit validation

- Add commitlint configuration with strict rules
- Update commit-msg hook to use commitlint via npx
- Add Docker support for commitlint when npm is not available
- Update Dockerfile to include Node.js and npm
- Add package.json for npm dependencies
- Create commitlint-docker.sh wrapper script
- Update setup script to install npm dependencies

This ensures all commit messages follow the Conventional Commits
specification with proper validation and helpful error messages.

Signed-off-by: Marjo Wenzel van Lier <[email protected]>

* fix(config): Correct Phan configuration and pre-commit setup

- Revert Phan directory_list to include full vendor directory
- Change minimum_severity back to CRITICAL for focused analysis
- Increase Phan processes from 1 to 4 for better performance
- Remove deprecated stages declaration from PHPUnit pre-commit hook

These changes fix the Phan configuration to properly analyze vendor
dependencies while excluding them from analysis, and remove the
deprecated stage warning from pre-commit.

Signed-off-by: Marjo Wenzel van Lier <[email protected]>

* perf: optimize string manipulation methods and fix validation bugs

- Optimize strReplace for single character replacements (69% faster)
- Optimize searchWords by combining operations (15% faster)
- Fix isValidDate to properly validate month/day combinations
- Add performance benchmarking suite
- Fix PHPStan type issues and improve null safety
- Add edge case handling for empty strings

The optimizations significantly improve performance for common use cases
while maintaining full backward compatibility. All tests pass.

Signed-off-by: Marjo Wenzel van Lier <[email protected]>

* feat: restore typed class constants with Docker AST support

- Restored PHP 8.3+ typed class constants in AccentNormalization and UnicodeMappings traits
- Fixed Dockerfile to properly install AST extension separately from xdebug
- Updated composer.json to remove --allow-polyfill-parser flag for Phan
- Removed AddTypeToConstRector skip in rector.php configuration
- Removed MissingClassConstType suppression in psalm.xml
- Reduced Phan processes from 4 to 1 to avoid memory issues
- Fixed Psalm strict type issues in benchmark file with explicit casting
- Applied code style fixes with Pint and Rector
- Added RemoveConcatAutocastRector to skip list to avoid Psalm conflicts
- Updated .gitignore to exclude temporary and Qodana files

All static analysis tools now support typed constants when running in Docker containers
with the AST extension properly installed.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* fix: correct PHPStan and Psalm type annotations in IsValidTimePartTest

- Updated data provider return type annotations to match exact array shape
- Fixed type mismatch between data providers and test method parameters
- Ensures both PHPStan and Psalm static analysis pass without errors

* docs: update CLAUDE.md with Docker-first testing approach

- Consolidated Docker testing commands into main Build & Testing section
- Emphasized Docker as the recommended testing environment
- Removed duplicate Docker testing commands section
- Added all available Docker test services with proper naming
- Clarified that Docker provides PHP 8.3 with AST extension

* chore: update development dependencies

- laravel/pint: >=1.21.1 -> >=1.22.1
- phpstan/phpstan: >=2.1.8 -> >=2.1.17
- phpstan/phpstan-strict-rules: >=2.0.3 -> >=2.0.4
- psalm/plugin-phpunit: >=0.19.2 -> >=0.19.3
- rector/rector: >=2.0.10 -> >=2.0.16

All tests passing with updated dependencies

* feat: configure Codacy to use PER 2.0 coding standard

- Added .php-cs-fixer.php with @PER-CS2.0 rule set
- Configured Codacy to use PHP CS Fixer with PER 2.0 standard
- Disabled phpcodesniffer in Codacy to avoid style conflicts
- Simplified pint.json to use only the 'per' preset
- Added .php-cs-fixer.cache to .gitignore

This ensures both Pint and Codacy use the same PER 2.0 coding standard

* fix: improve Codacy configuration to enforce PER 2.0 standard

- Explicitly disabled all PHP style checkers except php-cs-fixer
- Added .codacyignore to exclude non-source files
- Excluded tests/Benchmark from analysis as it has different requirements
- Disabled PHPMD to avoid style conflicts

This should resolve Codacy issues by ensuring only php-cs-fixer
with PER 2.0 standard is used for style checking

* feat: add PHP_CodeSniffer configuration for Codacy

- Added phpcs.xml with PER coding standard
- Enabled PHP_CodeSniffer in Codacy configuration
- Excluded specific rules that conflict with project standards
- Kept both PHP_CodeSniffer and php-cs-fixer enabled

This provides Codacy with explicit configuration files for both
supported tools to enforce PER 2.0 coding standard

---------

Signed-off-by: Marjo Wenzel van Lier <[email protected]>
Signed-off-by: MarjovanLier <[email protected]>
Co-authored-by: Claude <[email protected]>

v2.0.1

Toggle v2.0.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
(Changed) Update to PHP 8.3 and Enforce Explicit Type Declarations (#43)

* chore!: Set minimum required PHP version to 8.3

- Remove references to PHP 8.2 in workflows and configuration files
- Update composer constraints to reflect the new requirement
- Align development and production environments with PHP 8.3

BREAKING CHANGE: Environments must now use PHP 8.3 or higher.

* style: Add type hints and formatting

- Introduce explicit type declarations for clarity and type safety
- Remove redundant comments to streamline the code
- Correct formatting for improved readability and consistency

These changes align the codebase with established style guidelines,
making it easier to maintain and collaborate on.

v1.0.85

Toggle v1.0.85's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
(Changed) Update to PHP 8.3 and Enforce Explicit Type Declarations (#43)

* chore!: Set minimum required PHP version to 8.3

- Remove references to PHP 8.2 in workflows and configuration files
- Update composer constraints to reflect the new requirement
- Align development and production environments with PHP 8.3

BREAKING CHANGE: Environments must now use PHP 8.3 or higher.

* style: Add type hints and formatting

- Introduce explicit type declarations for clarity and type safety
- Remove redundant comments to streamline the code
- Correct formatting for improved readability and consistency

These changes align the codebase with established style guidelines,
making it easier to maintain and collaborate on.

v1.0.84

Toggle v1.0.84's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
(Fixed) Config updates (#42)

* feat(code-review): Update .coderabbit guidelines

- Revise tone_instructions to enforce PER Coding Style 2.0,
  SOLID principles, and FOOP techniques.
- Add path_instructions for "**/*.php" to ensure proper namespace
  usage, code organisation, and separation of concerns.
- Enhance automated review configuration to promote robust and
  maintainable PHP code.

* chore(dependabot): Exclude roave/security-advisories from updates

- Add an ignore rule in dependabot.yml for the
  roave/security-advisories package.
- Prevent dependency resolution errors since the package is
  always set to "dev-latest" and doesn’t require version bumps.

* fix(config): Condense tone_instructions in .coderabbit.yaml

- Shorten and adjust tone_instructions to comply with the 250-character limit.
- Correct spelling in "code organisation" for UK English consistency.
- Ensure CodeRabbit applies our custom settings rather than default settings.