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

Enhance PHP API Ref #2584

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Enhance PHP API Ref #2584

wants to merge 10 commits into from

Conversation

adriendupuis
Copy link
Contributor

@adriendupuis adriendupuis commented Dec 19, 2024

Question Answer
JIRA Ticket N/A
Versions master, 4.6
Edition All
  • Add template for traits.
    • Before doesn't look like classes and interfaces' pages.
    • After has the right design.
  • Workaround duplicated properties issue (Duplicated magic property phpDocumentor/phpDocumentor#3716).
    • Deduplicate properties from right side ToC.
    • Group duplicates in center main doc.
    • Before has two depth properties in the right ToC, those two are far from each other in the center page but have the same anchor which complicates navigation.
    • After has one depth in the ToC, the two central ones are close to each other.
  • More external links to https://github.com/symfony/symfony/blob/5.4
    • Before: only extended abstract class is a link.
    • After: redirectToLocation() returned value class is also a link.
  • Display "Abstract", "Interface", and "Trait".
    • Before: Not clear that this is an abstract class.
    • After is indicated as abstract under the class name.
  • Support @used-by tag.
    • Not used yet but could be in the future.
    • Tested locally.

TODO: Merge #2585 before merging this one.

Checklist

  • Text renders correctly
  • Text has been checked with vale
  • Description metadata is up to date
  • Redirects cover removed/moved pages
  • Code samples are working
  • PHP code samples have been fixed with PHP CS fixer
  • Added link to this PR in relevant JIRA ticket or code PR

@adriendupuis adriendupuis changed the title Enh php api ref Enhance PHP API Ref Dec 19, 2024
@adriendupuis adriendupuis mentioned this pull request Dec 19, 2024
7 tasks
@adriendupuis adriendupuis marked this pull request as ready for review December 20, 2024 08:38
@adriendupuis
Copy link
Contributor Author

I tested all the generated external links and found no error.

<?php

$symfonyVersion = '5.4';
foreach (explode(PHP_EOL, trim(`find docs/api/php_api/php_api_reference/classes -type f`)) as $filePath) {
    //echo "$filePath\n";
    $grepCmd = "grep '<abbr title=\"\\\\Symfony\\\\' $filePath";
    $grepLines = shell_exec($grepCmd);
    if ($grepLines) {
        foreach (explode(PHP_EOL, trim($grepLines)) as $grepLine) {
            preg_match_all('/<abbr title="(?P<fqcn>\\\\Symfony\\\\[^"]+)"/', $grepLine, $matches);
            foreach ($matches['fqcn'] as $fqcn) {
                $href = 'https://github.com/symfony/symfony/blob/' . $symfonyVersion . '/src' . str_replace('\\', '/', $fqcn) . '.php';
                //echo "$href\n";
                $headers = @get_headers($href);
                if (empty($headers)) {
                    sleep(2);
                    $headers = @get_headers($href);
                }
                if (empty($headers)) {
                    echo "$filePath 'HTTP request failed' $href\n";
                } elseif ('HTTP/1.1 200 OK' !== $headers[0]) {
                    echo "$filePath '{$headers[0]}' $href\n";
                }
            }
        }
    }
}

@adriendupuis adriendupuis requested a review from mnocon December 20, 2024 11:57
@adriendupuis adriendupuis mentioned this pull request Dec 20, 2024
7 tasks
adriendupuis added a commit that referenced this pull request Dec 20, 2024
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.

1 participant