Develop#5
Merged
Merged
Conversation
Core/Infra fixes: - Transform: add @param variadic docblock for $rules - TransformationContextImpl: separate @param docblocks in __construct - ProcessorBridge: typed @param array<string,list<...>> $fieldRules - TransformationResult: separate @param docblocks in __construct - AttributeTransformer: @var inline cast before engine::transform() call - TransformerEngine: @param on resolveValue/resolveRule private methods Rule fixes (17 files): - Pattern: (is_T($_p = $context->getParameter(KEY, DEFAULT)) ? $_p : DEFAULT) - ArrayToKeyValueRule: is_int|is_string guard for array key - CsvToArrayRule: explicit list<string> cast on headers before array_combine - ImplodeRule: is_scalar guard in lambda fn - GroupByRule: array_key_exists + is_int|is_string for group key - RenameKeysRule: is_string|is_int guard for mapped key - FlattenRule: @param/@return on flattenArray - UnflattenRule: @var type annotation on $result + safe separator
…r, phpunit Psalm fixes: - Add #[Override] attribute to all TransformationRule implementations (transform() and getName() methods) via psalm --alter - AgeRule: remove redundant (int) cast, DateInterval->y is already int - DateToIso8601Rule: ensure $tz is non-empty-string before DateTimeZone() - RelativeDateRule: use intdiv(int, int) instead of / operator; cast abs() result to (int) since abs(int) returns float|int in Psalm - PercentageRule: use 100.0 instead of 100 to fix float * int InvalidOperand CS-Fixer: auto-format new source and test files to project code style
…ec V4.0 Coverage: 47/47 classes · 118/118 methods · 450/450 lines (100%) - Create 22 individual test files (one CoversClass per rule) so pcov correctly attributes coverage to each class independently - Remove duplicate test methods from consolidated test files to avoid coverage-attribution conflicts - Add missing branch tests: ctype_digit, empty-string, non-string passthrough - Fix PluckRuleTest: assert [null,'Bob'] (rule uses $item[$field] ?? null) - Fix GroupByRuleTest: testEmptyFieldReturnsValue, testItemMissingField - Add devkit.php: exclude tests/ from cs-fixer to prevent @PHP84Migration from breaking pcov coverage attribution
…ame() methods All getName() assertions now validate the actual string value instead of just the type, following ARFA 1.3 Spec V4.0 testing standards. Files updated (7 consolidated test files): - BrazilianRulesTest: CpfToDigits, CnpjToDigits, CepToDigits, PhoneFormat - DataRulesTest: CsvToArray, JsonEncode, Implode - DateRulesTest: DateToIso8601, RelativeDate - EncodingRulesTest: Base64Encode, Base64Decode - NumericRulesTest: CurrencyFormat - StringRulesTest: CamelCase, SnakeCase, KebabCase, PascalCase, Mask, Reverse, Repeat - StructureRulesTest: Flatten, Pluck, GroupBy, RenameKeys, Unflatten
Replace all `(new Foo())->method()` inline patterns with local variable
assignments to satisfy cs-fixer @PHP84Migration rules while keeping pcov
code-coverage attribution correct:
Before: $this->assertX((new FooRule())->transform($v, $ctx));
After: $rule = new FooRule();
$this->assertX($rule->transform($v, $ctx));
This enables cs-fixer to run on tests/ without breaking phpunit coverage.
kcode quality: All 4 tools pass — cs-fixer + phpstan + psalm + phpunit
Coverage: 100% classes · 100% methods · 100% lines
abs(int) returns float|int — Rector removes the (int) cast (treats it as useless) but Psalm requires it for intdiv(). This creates a circular conflict between kcode format (Rector removes cast) and kcode quality (Psalm fails). Solution: $diff >= 0 ? $diff : -$diff is purely int — no cast, no abs(), no conflict between tools. Also applies Rector refactoring suggestions from kcode format run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.