Repository navigation
Releases: SebastiaanWouters/diffalyzer
Releases · SebastiaanWouters/diffalyzer
Release list
Release 1.7.5
[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,servicewhen method names were malformed - Now strictly validates that class names end with
TestorTestCase - This prevents overly broad PHPUnit filters that could match unintended test methods
- Previously checked if class name contained "Test" anywhere, matching classes like
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
[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
--filterwith 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
- v1.7.3 output multiple file paths (e.g.,
Release 1.7.3
[1.7.3] - 2025-11-10
Fixed
- Critical bug: Method-level output with
--filterwas 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)
- v1.7.2 attempted to use
Release 1.7.2
[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
--filterargument 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--filterwith the filename
- Now properly converts method-level output to PHPUnit's
Release 1.7.1
[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--filterargument - Smart handling of multiple test methods with regex filter combination
Changed
PhpUnitFormatternow parses::methodNamesyntax 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
[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
classToFileMapwas empty, causing class name resolution to fail - Moved
getClassToFileMap()call to afterbuildDependencyGraph()when the map is populated
-
Critical bug: PHPUnit output showed 0 tests even when relevant tests existed
- Short class names from
MethodChangeParserare 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
- Short class names from
Added
- Smart test discovery: Three-level cascading approach for finding relevant tests:
- Direct method call matching (most precise)
- Class-level matching (tests using any method on changed classes)
- 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
[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
--verboseoutput 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 support for glob patterns (e.g.,
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
v1.6.1 Release v1.6.1: PHPStan support and critical bug fixes
Release 1.6.0
v1.6.0 Release v1.6.0: Method-level granularity for precise test targeting
Release 1.5.0
[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
TokenBasedDependencyExtractorhandles 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
fileToClassesMapindex for O(1) class lookups - Optimized
CacheInvalidatorwith O(1) lookups (90%+ faster) - All strategies updated to support new
ParseResultinterface
- Fixed O(n²) → O(n) change detection in
Added
src/Parser/ParserInterface.php- Common interface for parserssrc/Parser/ParseResult.php- Value object for parse resultssrc/Parser/TokenBasedParser.php- Fast token-based parser adapter (default)src/Parser/AstBasedParser.php- AST parser adapter for compatibilitysrc/Parser/TokenBasedDependencyExtractor.php- Core token parsing enginetests/Parser/ParserComparisonTest.php- Comprehensive correctness tests (12 tests)PERFORMANCE_IMPROVEMENTS.md- Detailed performance optimization documentation- Parser type configuration support in
DependencyAnalyzerconstructor
Changed
- Default parser is now token-based for maximum performance
DependencyAnalyzeraccepts optional parser type parameter ('token'or'ast')- All strategies implement new
extractDependenciesFromResult()method StrategyInterfaceextended withParseResultsupport while maintaining backward compatibility- Cache now stores
fileToClassesMapfor 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