Skip to content
CAI
Software that uses CAICheck a score

symfony/finder

57.7

Adequate · 26 September 2026

2.2k

lines of production code

PHP

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is the Symfony Finder component, a PHP library designed for searching and filtering files and directories within a filesystem. It provides a fluent API for applying complex criteria such as depth, date, size, and content patterns, while supporting .gitignore rules and various sorting options. The component includes robust error handling for access and directory issues, along with immutable comparator classes for precise value matching.

Behavioural changes

Comparator class made immutable with added operator support and stricter validation

The Comparator classes in the Finder component are now immutable, with target and operator values set via constructor arguments instead of mutable setters. The base Comparator class now explicitly supports the '!=' (not equal) operator, which was previously missing from the default comparison logic. Validation is stricter: invalid operators throw an exception immediately upon construction, and DateComparator uses DateTimeImmutable for more robust date parsing. NumberComparator now accepts null as a valid test string and validates numeric inputs more rigorously.

Comparator · high confidence

Finder component modernized with native types, fluent API, and .gitignore support

The Finder component has been significantly refactored for modern PHP (8.1+), introducing native type declarations, private properties, and a fluent static \Finder::create()\ factory method. The API now supports chaining multiple depth/date/exclude rules via arrays, allows combining multiple search paths with \Finder::append()\, and enables sorting by extension, size, or case-insensitive name. New filtering capabilities include ignoring \.gitignore\ patterns (\ignoreVCSIgnored\), forcing forward slashes on Windows (\useUnixPaths\), and root-relative excludes. The component also adds \SplFileInfo\ extensions for relative paths and file content, and includes a new \Gitignore\ class to parse gitignore files into regex patterns.

(repo-wide) · high confidence

Finder iterators refactored with modern PHP features and new filtering capabilities

The Iterator component has been significantly modernized and expanded. Several iterators (FilenameFilterIterator, PathFilterIterator, FilecontentFilterIterator) now extend a new MultiplePcreFilterIterator base class, unifying pattern matching logic. New iterators include FilecontentFilterIterator for filtering by file contents and LazyIterator for deferred execution. The ExcludeDirectoryFilterIterator now supports callable prune filters and root-relative directory excludes. The SortableIterator has been expanded with new sorting options (extension, size, access/changed/modified time, natural/case-insensitive sorting) and a reverse order flag. The IgnoreVcsFilterIterator was removed and replaced by VcsIgnoredFilterIterator, which supports nested .gitignore files and looks for .git directories up to the git root. Code quality improvements include strict typing, modern PHP syntax (arrow functions, short arrays), and updated copyright headers.

Iterator · high confidence

New Finder exception classes for access and directory errors

The Finder component now includes dedicated exception classes to improve error handling clarity. AccessDeniedException (extending UnexpectedValueException) is introduced to signal access-denied scenarios, while DirectoryNotFoundException (extending InvalidArgumentException) is added to specifically indicate when a requested directory cannot be found. These changes allow users to catch and handle these specific failure modes more precisely than relying on generic exceptions.

Exception · high confidence

Test coverage

Added comprehensive test coverage for Symfony Finder component; Added test fixtures for path-based finder tests; Added unit tests for Finder Comparator classes; Added unit tests for Finder Iterator components.

Dependencies

Symfony Finder requires PHP 8.4.1 and Symfony 7.4/8.0

The Symfony Finder component now mandates a minimum PHP version of 8.4.1, reflecting a significant upgrade from previous versions. Additionally, the development dependencies have been updated to require symfony/filesystem version ^7.4 or ^8.0, ensuring compatibility with the latest Symfony ecosystem releases. The package configuration also enforces PSR-4 autoloading and excludes test files from the classmap to optimize performance.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 46 → 58 (+11.7)
  • Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 96 → 89 (-7.4)
  • Architecture 94 → 100 (+5.9)
  • Maturity 49 → 48 (-0.7)
  • Readiness 17 → 43 (+26.0)
  • Security 100 → 100 (+0.0)

Resolved (10)

  • Coverage not measured — test suite did not build
  • Dimension evaluation failed
  • Duplicated block (11 lines × 2) (Tests/Iterator/PathFilterIteratorTest.php)
  • Duplicated block (15 lines × 2) (Tests/FinderTest.php)
  • Duplicated block (26 lines × 2) (Tests/FinderTest.php)
  • Duplicated block (30 lines × 2) (Tests/Iterator/SortableIteratorTest.php)
  • No exposed public API
  • No tests found
  • Test reliability not included
  • The README describes an intuitive fluent interface but provides no usage example or runnable code showing how to call Finder::find() on a directory. (README.md)

New (28)

  • Documentation: no installation or build instructions (README.md)
  • Documentation: no licence statement (README.md)
  • Documentation: no usage examples (README.md)
  • ExcludeDirectoryFilterIterator.accept (cognitive 20) (Iterator/ExcludeDirectoryFilterIterator.php)
  • Finder.getIterator (cognitive 22) (Finder.php)
  • Finder.searchInDirectory (cognitive 22) (Finder.php)
  • Finder.searchInDirectory (cyclomatic 25) (Finder.php)
  • Glob.toRegex (cognitive 75) (Glob.php)
  • Glob.toRegex (cyclomatic 46) (Glob.php)
  • Hotspot: Finder.php (Finder.php)
  • Hotspot: Iterator/ExcludeDirectoryFilterIterator.php (Iterator/ExcludeDirectoryFilterIterator.php)
  • No assertions: testLazy (Tests/Iterator/LazyIteratorTest.php)
  • Off-boarding risk: anonymized user #1
  • Skipped (documented): testAccept (Tests/Iterator/SortableIteratorTest.php)
  • Skipped (documented): testAcceptWithSymlinkedBaseDirectory (Tests/Iterator/VcsIgnoredFilterIteratorTest.php)
  • Skipped (documented): testAccessDeniedException (Tests/FinderTest.php)
  • Skipped (documented): testDanglingSymlinkIsNeitherAFileNorADirectory (Tests/Iterator/FileTypeFilterIteratorTest.php)
  • Skipped (documented): testFollowLinks (Tests/FinderTest.php)
  • Skipped (documented): testIgnoreVCSIgnoredWithOpenBasedir (Tests/FinderOpenBasedirTest.php)
  • Skipped (documented): testIgnoredAccessDeniedException (Tests/FinderTest.php)
  • …and 8 more

Changes since last survey

  • 25 commits — 19 feature/other, 6 fixes

By area

  • (repo) — 16 commits
  • (root) — 4 commits
  • Iterator/VcsIgnoredFilterIterator.php — 2 commits
  • Iterator/ExcludeDirectoryFilterIterator.php — 1 commit
  • Iterator/FileTypeFilterIterator.php — 1 commit
  • Tests/Iterator — 1 commit

Notable commits

  • fix: [Finder] Fix building the gitignore regex for files with many patterns
  • fix: [Finder] Fix gitignore matching of negated patterns and excluded directories
  • fix: [Finder] Fix ignoreVCSIgnored() when the search directory is reached through a symlink
  • fix: [Finder] Fix prune filters not applied to nested directories and with path excludes
  • fix: bug #65529 [Finder] Fix gitignore matching of negated patterns and excluded directories (nicolas-grekas)
  • fix: bug #65962 [Finder] Fix building the gitignore regex for files with many patterns (fabpot)
  • change: Merge branch '6.4' into 7.4
  • change: Merge branch '6.4' into 7.4
  • change: Merge branch '6.4' into 7.4
  • change: Merge branch '6.4' into 7.4
  • change: Merge branch '6.4' into 7.4
  • change: Merge branch '7.4' into 8.1
  • change: Merge branch '7.4' into 8.1
  • change: Merge branch '7.4' into 8.1
  • change: Merge branch '7.4' into 8.1
  • change: Merge branch '7.4' into 8.1
  • change: Merge branch '8.1' into 8.2
  • change: Merge branch '8.1' into 8.2
  • change: Merge branch '8.1' into 8.2
  • change: Merge branch '8.1' into 8.2
  • …and 5 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

symfony/finder was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 26 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 318bb0d415c4c2e6110b7b054bf879bdd41439a2 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-a15879f6f801.