Skip to content

Deprecate SpecificationInterface in FileCollector and ParseDirectoryCommand#1334

Merged
jaapio merged 3 commits into
phpDocumentor:mainfrom
lacatoire:deprecate/specification-interface-file-collector
May 8, 2026
Merged

Deprecate SpecificationInterface in FileCollector and ParseDirectoryCommand#1334
jaapio merged 3 commits into
phpDocumentor:mainfrom
lacatoire:deprecate/specification-interface-file-collector

Conversation

@lacatoire

@lacatoire lacatoire commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

refs #1209.

FileCollector::collect() now emits a deprecation when a Flyfinder\Specification\SpecificationInterface is passed; users should switch to phpDocumentor\FileSystem\Finder\Exclude (which the collector already supports). The deprecation message in ParseDirectoryCommand is also fixed (concatenation typos, missing spaces) and uses sprintf placeholders.

Side bugfix: ParseDirectoryHandler no longer triggers the deprecation when no exclusion is supplied. It used to call getExcludedSpecification() unconditionally on the fallback branch, which fired the deprecation even when the caller did nothing wrong. A new hasExcludedSpecification() getter on the command lets the handler choose without touching the deprecated path. Internal call sites use Deprecation::triggerIfCalledFromOutside() so user-facing notices stay scoped to actual user code.

Tests added for both FileCollector::collect() and ParseDirectoryCommand covering the three input variants (null, Exclude, SpecificationInterface).

@jaapio jaapio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning up!

lacatoire added 3 commits May 8, 2026 16:29
…ommand

Emit a deprecation notice when phpDocumentor\Guides\FileCollector::collect()
receives a Flyfinder SpecificationInterface, and avoid spuriously firing the
existing ParseDirectoryCommand deprecation when no exclusion was supplied.

Closes phpDocumentor#1209
@jaapio jaapio force-pushed the deprecate/specification-interface-file-collector branch from 912f922 to 3ef741c Compare May 8, 2026 14:29
@jaapio jaapio enabled auto-merge May 8, 2026 14:30
@jaapio jaapio merged commit 24f1f0c into phpDocumentor:main May 8, 2026
58 checks passed
@lacatoire lacatoire deleted the deprecate/specification-interface-file-collector branch May 25, 2026 09:03
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.

2 participants