Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/xsd/phpdoc.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<xs:element name="examples" type="pd:sourceType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="format" type="xs:string" default="php" />
<xs:attribute name="ignore-packages" type="xs:boolean" default="false"/>
</xs:complexType>

<xs:complexType name="rstGuideType">
Expand Down
2 changes: 1 addition & 1 deletion phpdoc.dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</paths>
<version number="3.0.0">
<folder>latest</folder>
<api>
<api ignore-packages="true">
<source dsn=".">
<path>src</path>
</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public function __construct(private readonly Parser $parser)

protected function process(ApiSetDescriptor $subject): ApiSetDescriptor
{
if ($subject->getSettings()->ignorePackages()) {
return $subject;
}

$package = $subject->getPackage();
Assert::isInstanceOf($package, PackageInterface::class);

Expand Down
15 changes: 14 additions & 1 deletion src/phpDocumentor/Configuration/ApiSpecification.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ private function __construct(
private Source|null $examples,
private string $encoding,
private bool $validate,
private bool $ignorePackages,
) {
}

Expand Down Expand Up @@ -81,6 +82,7 @@ public static function createFromArray(array $api): self
: null,
$api['encoding'],
$api['validate'],
$api['ignore-packages'],
);
}

Expand All @@ -106,6 +108,7 @@ public static function createDefault(): ApiSpecification
null,
'utf8',
false,
false,
);
}

Expand All @@ -126,7 +129,12 @@ public function setIgnore(array $ignore): void
/** @return string[] */
public function getIgnoredTags(): array
{
return $this->ignoreTags;
$tags = $this->ignoreTags;
if ($this->ignorePackages) {
$tags[] = 'package';
}

return $tags;
}

public function calculateVisiblity(): int
Expand Down Expand Up @@ -174,4 +182,9 @@ public function source(): Source
{
return $this->source;
}

public function ignorePackages(): bool
{
return $this->ignorePackages;
}
}
7 changes: 6 additions & 1 deletion src/phpDocumentor/Configuration/Definition/Version3.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
* examples?: array{dsn: string, paths: array<string>},
* include-source: bool,
* validate: bool,
* visibility: non-empty-array<array-key, string>
* visibility: non-empty-array<array-key, string>,
* ignore-packages: bool
* }
* @psalm-type ConfigurationMap = array{
* configVersion: string,
Expand Down Expand Up @@ -245,6 +246,10 @@ private function apiSection(): ArrayNodeDefinition
->values(['php'])
->defaultValue('php')
->end()
->booleanNode('ignore-packages')
->info('Whether to ignore packages in the documentation')
->defaultFalse()
->end()
->arrayNode('visibilities')
->prototype('enum')
->info('What is the deepest level of visibility to include in the documentation?')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ private static function defaultConfigurationOutput(): array
'markers' => ['markers' => ['TODO', 'FIXME']],
'ignore-tags' => ['ignore_tags' => []],
'output' => '.',
'ignore-packages' => false,
],
],
'guides' => [],
Expand Down
Loading