Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with minimal directory #3325

Merged
merged 1 commit into from
Sep 27, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/phpDocumentor/Configuration/PathNormalizingMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private function makeDsnRelativeToConfig(Configuration $configuration, ?UriInter
$version->setApi($apiConfigs);

foreach ($version->getGuides() ?? [] as $key => $guide) {
$version->guides[$key]->withSource(
$version->guides[$key] = $version->guides[$key]->withSource(
$guide->source()->withDsn(
$guide->source()->dsn()->resolve($configDsn)
)
Expand Down Expand Up @@ -148,13 +148,23 @@ private function normalizePath(string $path): string
$path = '/' . $path;
}

return rtrim($path, '/');
$path = rtrim($path, '/');

if ($path === '') {
return '.';
}

return $path;
}

private function pathToGlobPattern(string $path): string
{
$path = $this->normalizePath($path);

if ($path === '.') {
return '/**/*';
}

if (substr($path, -1) !== '*' && strpos($path, '.') === false) {
$path .= '/**/*';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
~ This file is part of phpDocumentor.
~
~ For the full copyright and license information, please view the LICENSE
~ file that was distributed with this source code.
~
~ @copyright 2010-2017 Mike van Riel<mike@phpdoc.org>
~ @link https://phpdoc.org
-->

<phpdocumentor
configVersion="3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.phpdoc.org"
xsi:noNamespaceSchemaLocation="phpdoc.xsd"
>
<paths>
<output>file://build/docs</output>
<cache>/tmp/phpdoc-doc-cache</cache>
</paths>
<version number="1.0.0">
<folder>latest</folder>
<guide format="rst">
<source dsn=".">
<path>.</path>
</source>
</guide>
</version>
<template name="clean"/>
</phpdocumentor>