Skip to content

Deprecate SpecificationInterface in FileCollector and ParseDirectoryCommand#1334

Open
lacatoire wants to merge 3 commits intophpDocumentor:mainfrom
lacatoire:deprecate/specification-interface-file-collector
Open

Deprecate SpecificationInterface in FileCollector and ParseDirectoryCommand#1334
lacatoire wants to merge 3 commits intophpDocumentor:mainfrom
lacatoire:deprecate/specification-interface-file-collector

Conversation

@lacatoire
Copy link
Copy Markdown
Contributor

Closes #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).

…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
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.

Deprecated use of SpecificationInterface on file collector

1 participant