Title: add sourcecode link by LordSimal · Pull Request #246 · cakephp/cakephp-api-docs · GitHub
Open Graph Title: add sourcecode link by LordSimal · Pull Request #246 · cakephp/cakephp-api-docs
X Title: add sourcecode link by LordSimal · Pull Request #246 · cakephp/cakephp-api-docs
Description: Hello fellow CakePHP consumers 😄 This PR started with the basic desire to add a sourcecode link to the API docs so that one can easily jump to the logic they want to examine. This now looks like that Here I started to create a new TwigFilter called srcPath to get the path to that file which contains the function/method/property/whatever. But to have that data available in that LoadedXYZ object I had to adjust all the classes and how they are created. Some of them either already had the "correct" LoadedFile instance in them so I just had to extract the originale file path from that. Others (like the global namespaced ones) I had to manually add another parameter to the constructor and set the data via that. With that out of the way I stumbled upon my next problem: How do I generate the correct link to that file in the current active version/tag? Well, I first thought I can just link to e.g. https://github.com/cakephp/cakephp/blob/4.3/src/I18n/functions.php but this doesn't work. Either it has to be a specific tagged version or the branch name. Therefore I first went for the tagged version. But now the next question: * How do I get the tag from that repo?* Well, as you can see in the changed files I went for a shell_exec which executes git describe and I parse that string. But we have another inconsistency here: For the current queue repo I get fatal: No annotated tags can describe '414fa2d2caadb0494a9017eb6e8d3fcf0547485d'. However, there were unannotated tags: try --tags. For chronos both the 1.x and 2.x branch result in the "same" tag kevinpfeifer@Kevins-MBP [00:02:22] [~/Documents/CakePHP/chronos] [1.x] -> % git checkout 1.x && git describe Switched to branch '1.x' Your branch is up to date with 'origin/1.x'. 1.2.1-88-g4be4bb6 kevinpfeifer@Kevins-MBP [00:02:22] [~/Documents/CakePHP/chronos] [1.x] -> % git checkout 2.x && git describe Switched to branch '2.x' Your branch is up to date with 'origin/2.x'. 1.2.1-284-ga900965 Only for the main cakephp/cakephp repo I can used the tagged versions. This logic can be seen in src/Command/GenerateCommand.php Update phpdocumentor/reflection In the process of doing that I also updated the composer modules / did a major upgrade for phpdocumentor/reflection from 4.x to 5.x The main change/addition I had to do to make this work can be seen in src/Reflection/Loader.php Here I just had to adjust the construtor parameters. Non interactive composer updates I added the -n option to all composer update commands so composer 2.2 doesn't ask about Do you trust ..... And thats basically it. I re-generated the whole docs and put it on my server so you can check it yourself if you want. https://cakephp.pfiff.me/docs/cakephp/4.next/ https://cakephp.pfiff.me/docs/chronos/1.x/ https://cakephp.pfiff.me/docs/elastic-search/2.x/ https://cakephp.pfiff.me/docs/queue/0.x/
Open Graph Description: Hello fellow CakePHP consumers 😄 This PR started with the basic desire to add a sourcecode link to the API docs so that one can easily jump to the logic they want to examine. This now looks like th...
X Description: Hello fellow CakePHP consumers 😄 This PR started with the basic desire to add a sourcecode link to the API docs so that one can easily jump to the logic they want to examine. This now looks like th...
Opengraph URL: https://github.com/cakephp/cakephp-api-docs/pull/246
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:29e35033-ca23-5c90-328a-f5068e856e3a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BD74:36E792:12EE18:19E7A7:6B04B1B8 |
| html-safe-nonce | 149ef5865dfe77bf89d6087a3053bfbf5477d2a17a243a5447a5317864eccab3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDc0OjM2RTc5MjoxMkVFMTg6MTlFN0E3OjZCMDRCMUI4IiwidmlzaXRvcl9pZCI6IjEwMTM2MzYyMTUyMDkyNDMwNjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4bf75c9a9164c028fc1367181e4d2676f9e8b33819164003406aac43be849d7d |
| hovercard-subject-tag | pull_request:880782291 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/cakephp/cakephp-api-docs/pull/246/files |
| twitter:image | https://avatars.githubusercontent.com/u/9105243?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/9105243?s=400&v=4 |
| og:image:alt | Hello fellow CakePHP consumers 😄 This PR started with the basic desire to add a sourcecode link to the API docs so that one can easily jump to the logic they want to examine. This now looks like th... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | f1d110ea058a0915c1d8aa3fc2069fa15801e128f591e5762525abe77490ecb1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/cakephp/cakephp-api-docs git https://github.com/cakephp/cakephp-api-docs.git |
| octolytics-dimension-user_id | 23666 |
| octolytics-dimension-user_login | cakephp |
| octolytics-dimension-repository_id | 8281882 |
| octolytics-dimension-repository_nwo | cakephp/cakephp-api-docs |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 8281882 |
| octolytics-dimension-repository_network_root_nwo | cakephp/cakephp-api-docs |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ffa22a65e4c46d376940fe34b05e6a7e9c7fdb9b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width