Skip to content

Releases: SebastiaanWouters/diffalyzer

Release 1.7.5

Choose a tag to compare

@github-actions github-actions released this 10 Nov 16:09

[1.7.5] - 2025-11-10

Fixed

  • Bug: formatMethods() was including non-test classes and invalid method names in PHPUnit filter
    • Previously checked if class name contained "Test" anywhere, matching classes like TestHelper, InternalTestData
    • Also included invalid entries like assertSame, service when method names were malformed
    • Now strictly validates that class names end with Test or TestCase
    • This prevents overly broad PHPUnit filters that could match unintended test methods

Added

  • Comprehensive test coverage for formatMethods() to prevent regression
  • Test cases for filtering out non-test classes and invalid method names

Release 1.7.4

Choose a tag to compare

@github-actions github-actions released this 10 Nov 15:22

[1.7.4] - 2025-11-10

Fixed

  • Critical bug: PHPUnit 9 compatibility - output was incompatible with PHPUnit 9.x
    • v1.7.3 output multiple file paths (e.g., tests/FileA.php tests/FileB.php)
    • PHPUnit 9 doesn't support multiple file arguments - only runs the first file
    • PHPUnit 10+ added support for multiple file arguments
    • Now uses --filter with test class names instead: --filter '/UserTest|FooTest|BarTest/'
    • This format is backward compatible with PHPUnit 9+ and works across all versions
    • All affected test classes will run, which is the intended behavior

Release 1.7.3

Choose a tag to compare

@github-actions github-actions released this 10 Nov 15:09

[1.7.3] - 2025-11-10

Fixed

  • Critical bug: Method-level output with --filter was unreliable with PHPUnit
    • v1.7.2 attempted to use --filter '/method1|method2|...'/' syntax with multiple files
    • This caused PHPUnit to skip test files that didn't contain all the filtered method names
    • Example: tests/FileA.php tests/FileB.php --filter '/testA|testB/' would only run tests from files containing both methods
    • Now formatMethods() outputs only the test file paths without method filtering
    • This ensures all relevant test files run completely, trading method granularity for reliability
    • Method-level dependency analysis still determines which files to run (this is the key value)

Release 1.7.2

Choose a tag to compare

@github-actions github-actions released this 10 Nov 15:01

[1.7.2] - 2025-11-10

Fixed

  • Critical bug: formatMethods() was outputting invalid PHPUnit syntax (file::method pairs)
    • Now properly converts method-level output to PHPUnit's --filter argument format
    • Example: tests/UserTest.php tests/FooTest.php --filter '/testLogin|testLogout|testBar/'
    • Previously output: tests/UserTest.php::testLogin tests/UserTest.php::testLogout tests/FooTest.php::testBar
    • PHPUnit does not support :: syntax; method filtering requires --filter with the filename

Release 1.7.1

Choose a tag to compare

@github-actions github-actions released this 10 Nov 14:54

[1.7.1] - 2025-01-10

Added

  • Support for :: syntax to specify individual test methods (e.g., tests/UserTest.php::testLogin)
  • Automatic conversion from :: syntax to PHPUnit's --filter argument
  • Smart handling of multiple test methods with regex filter combination

Changed

  • PhpUnitFormatter now parses ::methodName syntax in file paths
  • Test method names with special regex characters are automatically escaped
  • Fixed isTestFile() to properly handle :: syntax in file paths by stripping method names before pattern matching

Release 1.7.0

Choose a tag to compare

@github-actions github-actions released this 10 Nov 11:58

[1.7.0] - 2025-11-10

Fixed

  • Critical bug: Changed files were missing from Psalm/PHPStan output when using method-level granularity

    • Files containing changed methods are now always included in the affected files output
    • Fixed issue where classToFileMap was empty, causing class name resolution to fail
    • Moved getClassToFileMap() call to after buildDependencyGraph() when the map is populated
  • Critical bug: PHPUnit output showed 0 tests even when relevant tests existed

    • Short class names from MethodChangeParser are now correctly mapped to fully qualified names
    • Added cascading test matching strategy: direct method calls → class-level matching → namespace matching
    • Implemented findTestMethodsForClasses() to find tests calling any method on changed classes
    • Implemented findTestMethodsByNamespace() as fallback using path/namespace heuristics

Added

  • Smart test discovery: Three-level cascading approach for finding relevant tests:
    1. Direct method call matching (most precise)
    2. Class-level matching (tests using any method on changed classes)
    3. Namespace/directory matching (tests in same bundle/namespace as changed files)
  • New helper method mapShortNamesToFQN() to convert short class names to fully qualified names
  • New helper method extractClassesFromMethods() to extract class names from method signatures

Changed

  • Psalm/PHPStan formatters now always use file-level output (method-level output not meaningful for static analyzers)
  • PHPUnit formatter only uses method-level output when appropriate (test discovery)
  • Improved verbose output showing the test matching strategy used
  • Better diagnostic messages when falling back through test matching strategies

Improved

  • Test discovery is now more robust and finds tests even when they don't directly call changed methods
  • Reduced false negatives where relevant tests were not detected
  • Better handling of projects with namespace-based directory structures

Release 1.6.2

Choose a tag to compare

@github-actions github-actions released this 10 Nov 11:25

[1.6.2] - 2025-11-10

Improved

  • Full-scan pattern functionality with glob pattern support and enhanced diagnostics
    • Added support for glob patterns (e.g., *.xml, phpunit.xml, config/**) alongside regex patterns
    • Glob patterns don't require delimiters, making them simpler and more intuitive to use
    • Enhanced --verbose output to show which files changed and whether patterns matched
    • Improved pattern validation with clearer error messages and helpful examples
    • Added warning when CLI pattern is provided but doesn't match any changed files
    • Better documentation with comprehensive troubleshooting section for pattern usage

Added

  • Comprehensive pattern usage examples in README for both glob and regex patterns
  • Troubleshooting section specifically for full-scan pattern issues
  • New test cases for glob pattern matching and CLI pattern override behavior
  • Helpful feedback when patterns don't match, guiding users to correct syntax

Changed

  • Pattern validation now distinguishes between regex patterns (starting with / or #) and glob patterns
  • Verbose mode now lists all changed files to help with pattern debugging
  • Error messages now include pattern syntax examples and recommendations

Release 1.6.1

Choose a tag to compare

@github-actions github-actions released this 10 Nov 11:08
v1.6.1

Release v1.6.1: PHPStan support and critical bug fixes

Release 1.6.0

Choose a tag to compare

@github-actions github-actions released this 10 Nov 09:49
v1.6.0

Release v1.6.0: Method-level granularity for precise test targeting

Release 1.5.0

Choose a tag to compare

@github-actions github-actions released this 08 Nov 16:11

[1.5.0] - 2025-11-08

Performance - Major Release 🚀

  • Token-Based Parser: Revolutionary 5-10x faster parsing using PHP's built-in token_get_all() instead of AST

    • New default parser provides 500-1000% speedup for cold starts
    • Maintains 100% accuracy and backward compatibility
    • AST parser still available as fallback option
    • Created comprehensive parser architecture with ParserInterface, TokenBasedParser, AstBasedParser
    • 600+ line TokenBasedDependencyExtractor handles complex PHP features correctly
    • Verified with 12 comprehensive comparison tests ensuring identical results
  • Algorithmic Optimizations: Critical improvements to core algorithms

    • Fixed O(n²) → O(n) change detection in FileHashRegistry (50-90% faster for large codebases)
    • Fixed O(m×n) → O(k) class cleanup in incremental mode (80-95% faster)
    • Added bidirectional fileToClassesMap index for O(1) class lookups
    • Optimized CacheInvalidator with O(1) lookups (90%+ faster)
    • All strategies updated to support new ParseResult interface

Added

  • src/Parser/ParserInterface.php - Common interface for parsers
  • src/Parser/ParseResult.php - Value object for parse results
  • src/Parser/TokenBasedParser.php - Fast token-based parser adapter (default)
  • src/Parser/AstBasedParser.php - AST parser adapter for compatibility
  • src/Parser/TokenBasedDependencyExtractor.php - Core token parsing engine
  • tests/Parser/ParserComparisonTest.php - Comprehensive correctness tests (12 tests)
  • PERFORMANCE_IMPROVEMENTS.md - Detailed performance optimization documentation
  • Parser type configuration support in DependencyAnalyzer constructor

Changed

  • Default parser is now token-based for maximum performance
  • DependencyAnalyzer accepts optional parser type parameter ('token' or 'ast')
  • All strategies implement new extractDependenciesFromResult() method
  • StrategyInterface extended with ParseResult support while maintaining backward compatibility
  • Cache now stores fileToClassesMap for optimized lookups

Performance Benchmarks

  • Real-world (41 files): Parse time 60ms → 10ms (6x faster)
  • Synthetic (100 classes): 2.7ms → 1.7ms (1.6x faster)
  • Scalability (1000 files):
    • Change detection: 1,000,000 ops → 1,000 ops (99.9% reduction)
    • Class cleanup: 10,000 ops → 10 ops per file (99% reduction)
    • Parsing: 500ms → 50ms (10x faster)
  • Combined improvements: 6-8x faster overall cold start performance

Technical Details

  • Token parser correctly handles: namespaces, use statements (including group use), aliases, class/interface/trait declarations, extends, implements, trait usage, new instantiations, static calls, fully qualified names
  • All 109 existing tests pass + 12 new parser comparison tests
  • Zero breaking changes - 100% backward compatible
  • Clean architecture following DRY principles with comprehensive documentation