Skip to content

build: add php-cs-fixer-preset#73

Merged
konradmichalik merged 5 commits intomainfrom
php-cs-fixer-preset
Oct 16, 2025
Merged

build: add php-cs-fixer-preset#73
konradmichalik merged 5 commits intomainfrom
php-cs-fixer-preset

Conversation

@konradmichalik
Copy link
Copy Markdown
Contributor

@konradmichalik konradmichalik commented Oct 16, 2025

Summary by CodeRabbit

  • Chores
    • Updated license headers and copyright notices across all files for consistency.
    • Updated author contact information in file documentation.
    • Refactored dependency management: replaced legacy PHP CS Fixer configuration with updated presets; adjusted Composer dependencies.
    • Consolidated import statements and reorganized PHP code structure for improved maintainability.
    • Enhanced test infrastructure with PHP 8 attributes and stricter type declarations in test fixtures.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 16, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Replaces php-cs-fixer config with KonradMichalik presets, standardizes license headers and author attribution, qualifies global functions/constants, injects a ConfigFactory into ConfigFileReader, adds SchemaValidator::isAvailable(), and extends multiple validators with new public methods for result type, formatting, and detailed output.

Changes

Cohort / File(s) Summary
Tooling & Root config
\.php-cs-fixer.php, composer.json, rector.php
Switch to KonradMichalik php-cs-fixer presets and header fixers; composer dev-deps adjusted; license header standardization and minor rector header wording edits.
Config module
src/Config/*, tests/src/Config/*
Added dependency injection for ConfigFactory in ConfigFileReader, SchemaValidator::isAvailable(): bool added, numerous header/license text and author updates, function/constant qualification fixes, and some test #[CoversClass(...)] attributes added.
Parser module & cache
src/Parser/*, tests/src/Parser/*
Added explicit function imports, qualified JSON constants and PATHINFO/DIRECTORY_SEPARATOR, improved JsonParser exception handling, ParserCache minor imports; tests updated to match qualified constants and relocated helpers.
Validators: API additions
src/Validator/{HtmlTag,KeyNamingConvention,DuplicateValues,PlaceholderConsistency,Mismatch,...}
Many validators gained new public/protected methods (e.g., resultTypeOnValidationFailure(), formatIssueMessage(), supportsParser(), shouldShowDetailedOutput(), renderDetailedOutput(), resetState()); imports grouped; header/license updates.
Validators: core & interfaces
src/Validator/AbstractValidator.php, src/Validator/ValidatorInterface.php, src/Validator/ResultType.php
Interface/class headers and grouped imports updated; AbstractValidator reorganized (resetState relocation); no breaking signature changes to core interfaces.
File detector & result modules
src/FileDetector/*, src/Result/*, tests/src/Result/*
Header/license normalization, grouped imports, global function imports, DIRECTORY_SEPARATOR qualification, minor renderer json constant qualification.
Plugin & CLI
src/Plugin.php, src/Capability/ValidateTranslationCommandProvider.php, src/Command/ValidateTranslationCommand.php, tests/*
Header/license and author updates; ValidateTranslationCommandProvider no longer final; import consolidations; tests updated accordingly.
Utilities & shared code
src/Utility/*, src/Parser/AbstractParser.php, src/Result/AbstractValidationResultRenderer.php
Added use function imports (sprintf, strlen, etc.), fully-qualified globals for constants, path normalization tweaks, and header standardization.
Fixtures & tests (fixtures)
tests/src/Fixtures/**/*.php, many tests/src/**/*Test.php
Added declare(strict_types=1) to fixtures, standardized license headers and author emails, grouped imports, relocated some private test helpers and added/updated test attributes.

Sequence Diagram(s)

sequenceDiagram
  participant Orchestration as ValidationOrchestrationService
  participant Validator as ConcreteValidator
  participant Result as ValidationResult
  participant Renderer as ValidationResultRenderer

  rect rgb(240,248,255)
    Orchestration->>Validator: processFile(File)
    Validator-->>Orchestration: addIssue(Issue) / internal state
  end

  rect rgb(245,255,240)
    Orchestration->>Validator: validate(FileSet)
    Validator-->>Orchestration: issues[]
    Orchestration->>Validator: resultTypeOnValidationFailure()
    Note right of Validator: returns ResultType (e.g., WARNING)
  end

  rect rgb(255,250,240)
    Orchestration->>Renderer: render(Result)
    Renderer->>Validator: if Validator.shouldShowDetailedOutput() then Validator.renderDetailedOutput(output, issues)
    Renderer-->>Orchestration: output produced
  end
Loading

Notes:

  • Validator now exposes resultTypeOnValidationFailure(), formatIssueMessage(), shouldShowDetailedOutput(), renderDetailedOutput() used by orchestration/renderer.
  • Flow highlights new query methods and optional detailed rendering phase.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Rationale: Wide-spread repetitive header and import changes lower per-file cognitive load, but the validator API additions (new public methods across multiple validators), ConfigFileReader DI, and JsonParser behavior change require careful review and cross-file integration checks.

Possibly related PRs

Poem

🐇 I hopped through headers, neat and spry,
swapped fixers, trimmed each license sigh.
Validators learned fresh tricks to show,
formats, warnings, details in tow.
From hej@ to km@, with carrot cheer—
translations safe another year! 🍃

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch php-cs-fixer-preset

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da4994e and c39c360.

⛔ Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (107)
  • .php-cs-fixer.php (1 hunks)
  • composer.json (2 hunks)
  • rector.php (1 hunks)
  • src/Capability/ValidateTranslationCommandProvider.php (2 hunks)
  • src/Command/ValidateTranslationCommand.php (1 hunks)
  • src/Config/ConfigFactory.php (1 hunks)
  • src/Config/ConfigFileReader.php (5 hunks)
  • src/Config/ConfigReader.php (4 hunks)
  • src/Config/ConfigValidator.php (1 hunks)
  • src/Config/SchemaValidator.php (4 hunks)
  • src/Config/TranslationValidatorConfig.php (1 hunks)
  • src/Enum/KeyNamingConvention.php (1 hunks)
  • src/FileDetector/Collector.php (4 hunks)
  • src/FileDetector/DetectorInterface.php (1 hunks)
  • src/FileDetector/DirectoryFileDetector.php (1 hunks)
  • src/FileDetector/FileDetectorRegistry.php (1 hunks)
  • src/FileDetector/FileSet.php (1 hunks)
  • src/FileDetector/PrefixFileDetector.php (1 hunks)
  • src/FileDetector/SuffixFileDetector.php (1 hunks)
  • src/Parser/AbstractParser.php (2 hunks)
  • src/Parser/JsonParser.php (2 hunks)
  • src/Parser/ParserCache.php (1 hunks)
  • src/Parser/ParserInterface.php (1 hunks)
  • src/Parser/ParserRegistry.php (2 hunks)
  • src/Parser/PhpParser.php (1 hunks)
  • src/Parser/XliffParser.php (2 hunks)
  • src/Parser/YamlParser.php (2 hunks)
  • src/Plugin.php (1 hunks)
  • src/Result/AbstractValidationResultRenderer.php (3 hunks)
  • src/Result/FormatType.php (1 hunks)
  • src/Result/Issue.php (1 hunks)
  • src/Result/Output.php (2 hunks)
  • src/Result/ValidationResult.php (1 hunks)
  • src/Result/ValidationResultCliRenderer.php (2 hunks)
  • src/Result/ValidationResultGitHubRenderer.php (1 hunks)
  • src/Result/ValidationResultJsonRenderer.php (3 hunks)
  • src/Result/ValidationResultRendererFactory.php (2 hunks)
  • src/Result/ValidationResultRendererInterface.php (1 hunks)
  • src/Result/ValidationRun.php (1 hunks)
  • src/Result/ValidationStatistics.php (1 hunks)
  • src/Service/ValidationOrchestrationService.php (1 hunks)
  • src/Utility/ClassUtility.php (1 hunks)
  • src/Utility/OutputUtility.php (2 hunks)
  • src/Utility/PathUtility.php (3 hunks)
  • src/Validator/AbstractValidator.php (2 hunks)
  • src/Validator/DuplicateKeysValidator.php (1 hunks)
  • src/Validator/DuplicateValuesValidator.php (2 hunks)
  • src/Validator/EmptyValuesValidator.php (1 hunks)
  • src/Validator/EncodingValidator.php (1 hunks)
  • src/Validator/HtmlTagValidator.php (4 hunks)
  • src/Validator/KeyCountValidator.php (1 hunks)
  • src/Validator/KeyDepthValidator.php (1 hunks)
  • src/Validator/KeyNamingConventionValidator.php (2 hunks)
  • src/Validator/MismatchValidator.php (2 hunks)
  • src/Validator/PlaceholderConsistencyValidator.php (2 hunks)
  • src/Validator/ResultType.php (2 hunks)
  • src/Validator/ValidatorInterface.php (2 hunks)
  • src/Validator/ValidatorRegistry.php (1 hunks)
  • src/Validator/XliffSchemaValidator.php (1 hunks)
  • tests/Build/console-application.php (1 hunks)
  • tests/src/Capability/ValidateTranslationCommandProviderTest.php (2 hunks)
  • tests/src/Command/ValidateTranslationCommandConfigTestSimple.php (2 hunks)
  • tests/src/Command/ValidateTranslationCommandTest.php (2 hunks)
  • tests/src/Config/ConfigFactoryTest.php (2 hunks)
  • tests/src/Config/ConfigFileReaderTest.php (2 hunks)
  • tests/src/Config/ConfigReaderTest.php (1 hunks)
  • tests/src/Config/ConfigValidatorTest.php (2 hunks)
  • tests/src/Config/SchemaValidatorTest.php (3 hunks)
  • tests/src/Config/TranslationValidatorConfigTest.php (2 hunks)
  • tests/src/Config/ValidatorSettingsConfigTest.php (2 hunks)
  • tests/src/FileDetector/CollectorTest.php (2 hunks)
  • tests/src/FileDetector/DirectoryFileDetectorTest.php (2 hunks)
  • tests/src/FileDetector/FileDetectorRegistryTest.php (1 hunks)
  • tests/src/FileDetector/FileSetTest.php (1 hunks)
  • tests/src/FileDetector/PrefixFileDetectorTest.php (2 hunks)
  • tests/src/FileDetector/SuffixFileDetectorTest.php (2 hunks)
  • tests/src/Fixtures/config/auto-detect/translation-validator.php (1 hunks)
  • tests/src/Fixtures/config/invalid.php (1 hunks)
  • tests/src/Fixtures/config/valid.php (1 hunks)
  • tests/src/Fixtures/recursive/level1/auth.de.php (1 hunks)
  • tests/src/Fixtures/recursive/level1/auth.en.php (1 hunks)
  • tests/src/Fixtures/translations/php/fail/invalid.php (1 hunks)
  • tests/src/Fixtures/translations/php/fail/messages.de.php (1 hunks)
  • tests/src/Fixtures/translations/php/fail/messages.en.php (1 hunks)
  • tests/src/Fixtures/translations/php/laravel/de/messages.php (1 hunks)
  • tests/src/Fixtures/translations/php/laravel/en/messages.php (1 hunks)
  • tests/src/Fixtures/translations/php/success/messages.de.php (1 hunks)
  • tests/src/Fixtures/translations/php/success/messages.en.php (1 hunks)
  • tests/src/Parser/AbstractParserTest.php (5 hunks)
  • tests/src/Parser/JsonParserTest.php (8 hunks)
  • tests/src/Parser/ParserCacheTest.php (1 hunks)
  • tests/src/Parser/ParserRegistryTest.php (1 hunks)
  • tests/src/Parser/PhpParserTest.php (3 hunks)
  • tests/src/Parser/XliffParserTest.php (5 hunks)
  • tests/src/Parser/YamlParserTest.php (3 hunks)
  • tests/src/PluginExtendedTest.php (2 hunks)
  • tests/src/PluginTest.php (2 hunks)
  • tests/src/Result/AbstractValidationResultRendererTest.php (3 hunks)
  • tests/src/Result/FormatTypeTest.php (2 hunks)
  • tests/src/Result/IssueTest.php (2 hunks)
  • tests/src/Result/OutputTest.php (2 hunks)
  • tests/src/Result/ValidationResultCliRendererTest.php (2 hunks)
  • tests/src/Result/ValidationResultGitHubRendererTest.php (1 hunks)
  • tests/src/Result/ValidationResultJsonRendererTest.php (3 hunks)
  • tests/src/Result/ValidationResultRendererFactoryTest.php (1 hunks)
  • tests/src/Result/ValidationResultTest.php (2 hunks)
  • tests/src/Result/ValidationRunTest.php (4 hunks)
⛔ Files not processed due to max files limit (23)
  • tests/src/Result/ValidationStatisticsTest.php
  • tests/src/Service/ValidationOrchestrationServiceTest.php
  • tests/src/Utility/ClassUtilityTest.php
  • tests/src/Utility/OutputUtilityTest.php
  • tests/src/Utility/PathUtilityExtendedTest.php
  • tests/src/Utility/PathUtilityTest.php
  • tests/src/Validator/AbstractValidatorTest.php
  • tests/src/Validator/DuplicateKeysValidatorTest.php
  • tests/src/Validator/DuplicateValuesValidatorTest.php
  • tests/src/Validator/EmptyValuesValidatorTest.php
  • tests/src/Validator/EncodingValidatorTest.php
  • tests/src/Validator/HtmlTagValidatorTest.php
  • tests/src/Validator/KeyCountValidatorTest.php
  • tests/src/Validator/KeyDepthValidatorTest.php
  • tests/src/Validator/KeyNamingConventionValidatorConfigTest.php
  • tests/src/Validator/KeyNamingConventionValidatorTest.php
  • tests/src/Validator/MismatchValidatorTest.php
  • tests/src/Validator/PlaceholderConsistencyValidatorTest.php
  • tests/src/Validator/ResultTypeTest.php
  • tests/src/Validator/SchemaValidatorTest.php
  • tests/src/Validator/ValidatorInterfaceTest.php
  • tests/src/Validator/ValidatorRegistryTest.php
  • tests/src/Validator/XliffSchemaValidatorTest.php

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

# Conflicts:
#	.php-cs-fixer.php
#	composer.json
#	composer.lock
#	src/Capability/ValidateTranslationCommandProvider.php
#	src/Command/ValidateTranslationCommand.php
#	src/Config/ConfigFactory.php
#	src/Config/ConfigFileReader.php
#	src/Config/ConfigReader.php
#	src/Config/ConfigValidator.php
#	src/Config/SchemaValidator.php
#	src/Config/TranslationValidatorConfig.php
#	src/Enum/KeyNamingConvention.php
#	src/FileDetector/Collector.php
#	src/FileDetector/DetectorInterface.php
#	src/FileDetector/DirectoryFileDetector.php
#	src/FileDetector/FileDetectorRegistry.php
#	src/FileDetector/FileSet.php
#	src/FileDetector/PrefixFileDetector.php
#	src/FileDetector/SuffixFileDetector.php
#	src/Parser/AbstractParser.php
#	src/Parser/JsonParser.php
#	src/Parser/ParserCache.php
#	src/Parser/ParserInterface.php
#	src/Parser/ParserRegistry.php
#	src/Parser/PhpParser.php
#	src/Parser/XliffParser.php
#	src/Parser/YamlParser.php
#	src/Plugin.php
#	src/Result/AbstractValidationResultRenderer.php
#	src/Result/FormatType.php
#	src/Result/Issue.php
#	src/Result/Output.php
#	src/Result/ValidationResult.php
#	src/Result/ValidationResultCliRenderer.php
#	src/Result/ValidationResultGitHubRenderer.php
#	src/Result/ValidationResultJsonRenderer.php
#	src/Result/ValidationResultRendererFactory.php
#	src/Result/ValidationResultRendererInterface.php
#	src/Result/ValidationRun.php
#	src/Result/ValidationStatistics.php
#	src/Service/ValidationOrchestrationService.php
#	src/Utility/ClassUtility.php
#	src/Utility/OutputUtility.php
#	src/Utility/PathUtility.php
#	src/Validator/AbstractValidator.php
#	src/Validator/DuplicateKeysValidator.php
#	src/Validator/DuplicateValuesValidator.php
#	src/Validator/EmptyValuesValidator.php
#	src/Validator/EncodingValidator.php
#	src/Validator/HtmlTagValidator.php
#	src/Validator/KeyCountValidator.php
#	src/Validator/KeyDepthValidator.php
#	src/Validator/KeyNamingConventionValidator.php
#	src/Validator/MismatchValidator.php
#	src/Validator/PlaceholderConsistencyValidator.php
#	src/Validator/ResultType.php
#	src/Validator/ValidatorInterface.php
#	src/Validator/ValidatorRegistry.php
#	src/Validator/XliffSchemaValidator.php
#	tests/src/Capability/ValidateTranslationCommandProviderTest.php
#	tests/src/Command/ValidateTranslationCommandConfigTestSimple.php
#	tests/src/Command/ValidateTranslationCommandTest.php
#	tests/src/Config/ConfigFactoryTest.php
#	tests/src/Config/ConfigFileReaderTest.php
#	tests/src/Config/ConfigReaderTest.php
#	tests/src/Config/ConfigValidatorTest.php
#	tests/src/Config/SchemaValidatorTest.php
#	tests/src/Config/TranslationValidatorConfigTest.php
#	tests/src/Config/ValidatorSettingsConfigTest.php
#	tests/src/FileDetector/CollectorTest.php
#	tests/src/FileDetector/DirectoryFileDetectorTest.php
#	tests/src/FileDetector/FileDetectorRegistryTest.php
#	tests/src/FileDetector/FileSetTest.php
#	tests/src/FileDetector/PrefixFileDetectorTest.php
#	tests/src/FileDetector/SuffixFileDetectorTest.php
#	tests/src/Parser/AbstractParserTest.php
#	tests/src/Parser/JsonParserTest.php
#	tests/src/Parser/ParserCacheTest.php
#	tests/src/Parser/ParserRegistryTest.php
#	tests/src/Parser/PhpParserTest.php
#	tests/src/Parser/XliffParserTest.php
#	tests/src/Parser/YamlParserTest.php
#	tests/src/PluginExtendedTest.php
#	tests/src/PluginTest.php
#	tests/src/Result/AbstractValidationResultRendererTest.php
#	tests/src/Result/FormatTypeTest.php
#	tests/src/Result/IssueTest.php
#	tests/src/Result/OutputTest.php
#	tests/src/Result/ValidationResultCliRendererTest.php
#	tests/src/Result/ValidationResultGitHubRendererTest.php
#	tests/src/Result/ValidationResultJsonRendererTest.php
#	tests/src/Result/ValidationResultRendererFactoryTest.php
#	tests/src/Result/ValidationResultTest.php
#	tests/src/Result/ValidationRunTest.php
#	tests/src/Result/ValidationStatisticsTest.php
#	tests/src/Service/ValidationOrchestrationServiceTest.php
#	tests/src/Utility/ClassUtilityTest.php
#	tests/src/Utility/OutputUtilityTest.php
#	tests/src/Utility/PathUtilityExtendedTest.php
#	tests/src/Utility/PathUtilityTest.php
#	tests/src/Validator/AbstractValidatorTest.php
#	tests/src/Validator/DuplicateKeysValidatorTest.php
#	tests/src/Validator/DuplicateValuesValidatorTest.php
#	tests/src/Validator/EmptyValuesValidatorTest.php
#	tests/src/Validator/EncodingValidatorTest.php
#	tests/src/Validator/HtmlTagValidatorTest.php
#	tests/src/Validator/KeyCountValidatorTest.php
#	tests/src/Validator/KeyDepthValidatorTest.php
#	tests/src/Validator/KeyNamingConventionValidatorConfigTest.php
#	tests/src/Validator/KeyNamingConventionValidatorTest.php
#	tests/src/Validator/MismatchValidatorTest.php
#	tests/src/Validator/PlaceholderConsistencyValidatorTest.php
#	tests/src/Validator/ResultTypeTest.php
#	tests/src/Validator/SchemaValidatorTest.php
#	tests/src/Validator/ValidatorInterfaceTest.php
#	tests/src/Validator/ValidatorRegistryTest.php
#	tests/src/Validator/XliffSchemaValidatorTest.php
@konradmichalik konradmichalik merged commit fdf220a into main Oct 16, 2025
27 of 28 checks passed
@konradmichalik konradmichalik deleted the php-cs-fixer-preset branch October 27, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant