graphify-php 0.0.5__tar.gz → 0.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. {graphify_php-0.0.5 → graphify_php-0.0.8}/.github/workflows/stage-security.yml +12 -13
  2. {graphify_php-0.0.5 → graphify_php-0.0.8}/.graphifyignore +4 -0
  3. graphify_php-0.0.8/PKG-INFO +488 -0
  4. graphify_php-0.0.8/README.md +467 -0
  5. {graphify_php-0.0.5 → graphify_php-0.0.8}/docs/configuration.md +51 -1
  6. {graphify_php-0.0.5 → graphify_php-0.0.8}/docs/install.md +1 -1
  7. {graphify_php-0.0.5 → graphify_php-0.0.8}/docs/setup.md +4 -2
  8. {graphify_php-0.0.5 → graphify_php-0.0.8}/php/README.md +20 -4
  9. {graphify_php-0.0.5 → graphify_php-0.0.8}/php/src/CallGraph/CallEdge.php +12 -2
  10. {graphify_php-0.0.5 → graphify_php-0.0.8}/php/src/CallGraph/CallEdgeRule.php +2 -2
  11. {graphify_php-0.0.5 → graphify_php-0.0.8}/php/src/CallGraph/MethodCallCollector.php +49 -3
  12. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/__init__.py +37 -33
  13. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/cli.py +121 -1
  14. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config_resolver.py +6 -33
  15. graphify_php-0.0.8/src/graphify_php/core_guard.py +297 -0
  16. graphify_php-0.0.8/src/graphify_php/frameworks/__init__.py +16 -0
  17. graphify_php-0.0.8/src/graphify_php/frameworks/codeigniter.py +1760 -0
  18. graphify_php-0.0.8/src/graphify_php/frameworks/detect.py +62 -0
  19. graphify_php-0.0.8/src/graphify_php/frameworks/laravel.py +2129 -0
  20. graphify_php-0.0.8/src/graphify_php/frameworks/matching.py +64 -0
  21. graphify_php-0.0.8/src/graphify_php/frameworks/provider.py +252 -0
  22. graphify_php-0.0.8/src/graphify_php/frameworks/symfony.py +821 -0
  23. graphify_php-0.0.8/src/graphify_php/graph_adapter.py +1253 -0
  24. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/ports.py +112 -1
  25. graphify_php-0.0.8/src/graphify_php/resolver.py +1266 -0
  26. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/shrink.py +260 -24
  27. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/shrink_cli.py +14 -0
  28. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/sources/phpstan_source.py +275 -21
  29. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/sources/route_source.py +79 -11
  30. graphify_php-0.0.8/src/graphify_php/sources/tree_sitter_source.py +859 -0
  31. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/status.py +92 -0
  32. graphify_php-0.0.8/src/graphify_php/syntax/access_control.py +836 -0
  33. graphify_php-0.0.8/src/graphify_php/syntax/attributes.py +190 -0
  34. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/syntax/collectors.py +151 -0
  35. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/syntax/facts.py +24 -4
  36. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/syntax/file_scan.py +55 -14
  37. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/syntax/names.py +27 -0
  38. graphify_php-0.0.8/src/graphify_php/syntax/routes.py +782 -0
  39. graphify_php-0.0.8/tests/conftest.py +15 -0
  40. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Config/AdminRoutes.php +4 -0
  41. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Config/Filters.php +46 -0
  42. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Config/Modules.php +12 -0
  43. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Config/Routes.php +39 -0
  44. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Config/Routing.php +19 -0
  45. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Account.php +11 -0
  46. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Admin/Users.php +8 -0
  47. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Albums.php +9 -0
  48. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Api/Tokens.php +8 -0
  49. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Contact.php +8 -0
  50. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Files.php +8 -0
  51. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Home.php +8 -0
  52. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Panel.php +11 -0
  53. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Photos.php +14 -0
  54. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Reports.php +8 -0
  55. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Search.php +8 -0
  56. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/app/Controllers/Users.php +10 -0
  57. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/composer.json +8 -0
  58. graphify_php-0.0.8/tests/fixtures/frameworks/codeigniter/composer.lock +6 -0
  59. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/app/Http/Controllers/Api/TokenController.php +20 -0
  60. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/app/Http/Controllers/Controller.php +10 -0
  61. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/app/Http/Controllers/PhotoController.php +10 -0
  62. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/app/Http/Controllers/PostController.php +25 -0
  63. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/app/Http/Controllers/ReportController.php +24 -0
  64. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/app/Http/Controllers/ShowDashboard.php +8 -0
  65. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/app/Http/Controllers/UserController.php +33 -0
  66. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/bootstrap/app.php +16 -0
  67. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/composer.json +7 -0
  68. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/composer.lock +10 -0
  69. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/routes/admin.php +6 -0
  70. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/routes/api.php +8 -0
  71. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/routes/console.php +7 -0
  72. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/routes/orphan.php +6 -0
  73. graphify_php-0.0.8/tests/fixtures/frameworks/laravel/routes/web.php +53 -0
  74. graphify_php-0.0.8/tests/test_access_checks.py +561 -0
  75. graphify_php-0.0.8/tests/test_access_control_segments.py +911 -0
  76. graphify_php-0.0.8/tests/test_adapter_graph.py +719 -0
  77. graphify_php-0.0.8/tests/test_cli_attribution.py +357 -0
  78. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_cli_end_to_end.py +18 -0
  79. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_cli_gate.py +74 -1
  80. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_cli_shrink_gate.py +127 -2
  81. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_config_resolver.py +65 -1
  82. graphify_php-0.0.8/tests/test_core_guard.py +804 -0
  83. graphify_php-0.0.8/tests/test_engine_contradictions.py +404 -0
  84. graphify_php-0.0.8/tests/test_engine_extracted.py +336 -0
  85. graphify_php-0.0.8/tests/test_framework_codeigniter.py +1228 -0
  86. graphify_php-0.0.8/tests/test_framework_laravel.py +1843 -0
  87. graphify_php-0.0.8/tests/test_framework_providers.py +461 -0
  88. graphify_php-0.0.8/tests/test_namespace_blocks.py +208 -0
  89. graphify_php-0.0.8/tests/test_new_site_edges.py +285 -0
  90. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_phpstan_integration.py +113 -2
  91. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_phpstan_source.py +537 -0
  92. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_resolver_precedence.py +286 -0
  93. graphify_php-0.0.8/tests/test_route_schema.py +520 -0
  94. graphify_php-0.0.8/tests/test_routes_stacked_guards.py +367 -0
  95. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_shrink.py +10 -0
  96. graphify_php-0.0.8/tests/test_shrink_attribution.py +390 -0
  97. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_shrink_cli.py +63 -0
  98. graphify_php-0.0.8/tests/test_status_record.py +88 -0
  99. graphify_php-0.0.8/tests/test_syntax_parameters.py +478 -0
  100. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_syntax_routes.py +27 -27
  101. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_syntax_scan.py +1 -1
  102. graphify_php-0.0.8/tests/test_syntax_writes.py +172 -0
  103. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_tree_sitter_source.py +407 -1
  104. graphify_php-0.0.5/PKG-INFO +0 -218
  105. graphify_php-0.0.5/README.md +0 -197
  106. graphify_php-0.0.5/src/graphify_php/graph_adapter.py +0 -520
  107. graphify_php-0.0.5/src/graphify_php/resolver.py +0 -519
  108. graphify_php-0.0.5/src/graphify_php/sources/tree_sitter_source.py +0 -428
  109. graphify_php-0.0.5/src/graphify_php/syntax/routes.py +0 -288
  110. graphify_php-0.0.5/tests/test_adapter_graph.py +0 -337
  111. {graphify_php-0.0.5 → graphify_php-0.0.8}/.github/workflows/ci.yml +0 -0
  112. {graphify_php-0.0.5 → graphify_php-0.0.8}/.github/workflows/pages.yml +0 -0
  113. {graphify_php-0.0.5 → graphify_php-0.0.8}/.github/workflows/release.yml +0 -0
  114. {graphify_php-0.0.5 → graphify_php-0.0.8}/.github/workflows/stage-build.yml +0 -0
  115. {graphify_php-0.0.5 → graphify_php-0.0.8}/.github/workflows/stage-tests.yml +0 -0
  116. {graphify_php-0.0.5 → graphify_php-0.0.8}/.gitignore +0 -0
  117. {graphify_php-0.0.5 → graphify_php-0.0.8}/.gitleaks.toml +0 -0
  118. {graphify_php-0.0.5 → graphify_php-0.0.8}/.trufflehog-exclude.txt +0 -0
  119. {graphify_php-0.0.5 → graphify_php-0.0.8}/LICENSE +0 -0
  120. {graphify_php-0.0.5 → graphify_php-0.0.8}/docs/_config.yml +0 -0
  121. {graphify_php-0.0.5 → graphify_php-0.0.8}/docs/architecture.md +0 -0
  122. {graphify_php-0.0.5 → graphify_php-0.0.8}/docs/assets/css/style.scss +0 -0
  123. {graphify_php-0.0.5 → graphify_php-0.0.8}/docs/evaluation.md +0 -0
  124. {graphify_php-0.0.5 → graphify_php-0.0.8}/docs/index.md +0 -0
  125. {graphify_php-0.0.5 → graphify_php-0.0.8}/docs/phpstan.md +0 -0
  126. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/README.md +0 -0
  127. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/__init__.py +0 -0
  128. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/canaries.py +0 -0
  129. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/chained.php +0 -0
  130. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/ctor_body_assign.php +0 -0
  131. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/declared_property.php +0 -0
  132. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/dynamic.php +0 -0
  133. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/handler_shapes.php +0 -0
  134. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/inheritance.php +0 -0
  135. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/interfaces.php +0 -0
  136. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/locals_new.php +0 -0
  137. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/mail.php +0 -0
  138. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/nullable_union.php +0 -0
  139. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/promoted.php +0 -0
  140. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/same_name_traps.php +0 -0
  141. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/secrets.php +0 -0
  142. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/services.yaml +0 -0
  143. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/fixtures/traits.php +0 -0
  144. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/reference_set.py +0 -0
  145. {graphify_php-0.0.5 → graphify_php-0.0.8}/eval/score.py +0 -0
  146. {graphify_php-0.0.5 → graphify_php-0.0.8}/php/autoload.php +0 -0
  147. {graphify_php-0.0.5 → graphify_php-0.0.8}/php/src/CallGraph/CallEdgeWriter.php +0 -0
  148. {graphify_php-0.0.5 → graphify_php-0.0.8}/php/src/CallGraph/JsonLinesWriter.php +0 -0
  149. {graphify_php-0.0.5 → graphify_php-0.0.8}/pyproject.toml +0 -0
  150. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config/__init__.py +0 -0
  151. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config/class_lookup.py +0 -0
  152. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config/discovery.py +0 -0
  153. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config/document.py +0 -0
  154. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config/emit.py +0 -0
  155. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config/environment.py +0 -0
  156. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config/facts.py +0 -0
  157. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config/messaging.py +0 -0
  158. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config/ports.py +0 -0
  159. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/config/safe_yaml.py +0 -0
  160. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/container/__init__.py +0 -0
  161. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/container/facts.py +0 -0
  162. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/container/layer.py +0 -0
  163. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/container/locator.py +0 -0
  164. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/container/overlay.py +0 -0
  165. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/container/ports.py +0 -0
  166. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/container/reader.py +0 -0
  167. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/container/reasons.py +0 -0
  168. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/syntax/call_sites.py +0 -0
  169. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/syntax/class_index.py +0 -0
  170. {graphify_php-0.0.5 → graphify_php-0.0.8}/src/graphify_php/syntax/nodes.py +0 -0
  171. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/fixtures/shrink/ckeditor/new_graph.json +0 -0
  172. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/fixtures/shrink/ckeditor/new_manifest.json +0 -0
  173. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/fixtures/shrink/ckeditor/old_graph.json +0 -0
  174. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/fixtures/shrink/ckeditor/old_manifest.json +0 -0
  175. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/fixtures/shrink/ckeditor/present.txt +0 -0
  176. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/fixtures/shrink/games/new_graph.json +0 -0
  177. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/fixtures/shrink/games/new_manifest.json +0 -0
  178. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/fixtures/shrink/games/old_graph.json +0 -0
  179. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/fixtures/shrink/games/old_manifest.json +0 -0
  180. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/fixtures/shrink/games/present.txt +0 -0
  181. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_config_readers.py +0 -0
  182. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_container_integration.py +0 -0
  183. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_container_layer.py +0 -0
  184. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_container_overlay.py +0 -0
  185. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_container_reader.py +0 -0
  186. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_eval_canaries.py +0 -0
  187. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_eval_reference_set.py +0 -0
  188. {graphify_php-0.0.5 → graphify_php-0.0.8}/tests/test_eval_score.py +0 -0
@@ -17,19 +17,18 @@ jobs:
17
17
  fetch-depth: 0
18
18
 
19
19
  - name: gitleaks — scan git history for hardcoded secrets
20
- # Plain OSS gitleaks CLI, not gitleaks/gitleaks-action: that Action now
21
- # requires a paid GITLEAKS_LICENSE for GitHub Organizations. The CLI
22
- # itself stays free/open-source.
23
- # The sha256 below is pinned from the official release checksums file:
24
- # https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_checksums.txt
25
- # .gitleaks.toml at the repository root extends the default rules with
26
- # a path allowlist for the planted canaries (see that file).
27
- run: |
28
- curl -sSfL -o gitleaks_8.30.1_linux_x64.tar.gz \
29
- https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz
30
- echo "551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb gitleaks_8.30.1_linux_x64.tar.gz" | sha256sum -c -
31
- tar -xzf gitleaks_8.30.1_linux_x64.tar.gz gitleaks
32
- ./gitleaks detect --source . --no-banner --redact
20
+ # gitleaks-action needs a GITLEAKS_LICENSE only for repositories owned
21
+ # by a GitHub Organization; OxCom is a personal account, so none is set.
22
+ # A push scans the pushed commits; the nightly schedule and a manual
23
+ # dispatch scan the full history. The action runs `gitleaks detect
24
+ # --redact` and picks up .gitleaks.toml at the repository root, which
25
+ # allowlists the planted canaries (see that file).
26
+ uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0
27
+ env:
28
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
+ GITLEAKS_VERSION: "8.30.1"
30
+ # PR comments need pull-requests: write; this job keeps contents: read.
31
+ GITLEAKS_ENABLE_COMMENTS: "false"
33
32
 
34
33
  trufflehog:
35
34
  runs-on: ubuntu-latest
@@ -27,3 +27,7 @@ graphify-out/
27
27
  .npmrc
28
28
  auth.json
29
29
  LICENSE
30
+
31
+ # Tests are excluded from the graph: they added nodes and edges without
32
+ # answering code questions (2026-11-16).
33
+ /tests/
@@ -0,0 +1,488 @@
1
+ Metadata-Version: 2.5
2
+ Name: graphify-php
3
+ Version: 0.0.8
4
+ Summary: PHP member-call resolution for graphify: binds $this->service->method() to the method node it calls.
5
+ Author: Andrii Afanasiev
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Keywords: call-graph,code-graph,graphify,php,static-analysis
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Topic :: Software Development :: Quality Assurance
13
+ Requires-Python: >=3.10
14
+ Requires-Dist: pyyaml>=6.0
15
+ Provides-Extra: lint
16
+ Requires-Dist: ruff>=0.15; extra == 'lint'
17
+ Provides-Extra: test
18
+ Requires-Dist: graphifyy>=0.9.66; extra == 'test'
19
+ Requires-Dist: pytest>=7.0; extra == 'test'
20
+ Description-Content-Type: text/markdown
21
+
22
+ # graphify-php
23
+
24
+ PHP member-call resolution for [graphify](https://github.com/OxCom/graphify). It binds
25
+ `$this->emails->reminderSubmitWeek($user)` to the method node it actually calls, so a PHP graph
26
+ has a call graph instead of a list of names.
27
+
28
+ ## The measurement
29
+
30
+ graphify ships cross-file member-call resolvers for Swift, Python, Ruby, TypeScript, C#, Java
31
+ and Rust, and none for PHP. Its PHP extractor marks `$obj->method()` as a member call and the
32
+ shared cross-file pass then drops it, because a bare `method` collides across the corpus and a
33
+ name-only match is not evidence.
34
+
35
+ On a reference Symfony application (584 PHP files, not shipped with this package), measured
36
+ from the published graph:
37
+
38
+ | | |
39
+ |---|---|
40
+ | PHP callable nodes | 3426 |
41
+ | `calls` edges in the whole graph | 2172 |
42
+ | PHP callables with an outgoing `calls` edge | 24.4 % |
43
+ | PHP callables with an incoming `calls` edge | 20.1 % |
44
+
45
+ Three quarters of the PHP callables in that graph are connected to nothing they call. Every
46
+ "what calls this", "what does this touch" and blast-radius question over PHP is answered from
47
+ that quarter.
48
+
49
+ ## What it does
50
+
51
+ The pass runs inside graphify's build, after extraction:
52
+
53
+ 1. collects every member call graphify left unresolved, from `per_file[*]["raw_calls"]`;
54
+ 2. hands the sources the PHP files graphify parsed as the `corpus` they may read declarations
55
+ from. A leaf service class has nothing unresolved in it, so it never appears among the sites,
56
+ and a source indexing only those files cannot tell whether it declares the method being
57
+ called on it. The set is bounded by the build, never by a filesystem walk;
58
+ 3. asks each configured **call target source** in precedence order for the receiver's class —
59
+ the precise source (a PHP type engine that already knows the project's types) first, the
60
+ tree-sitter parser second. A site the first source proves is never offered to the second, so
61
+ a weaker source can add reach but can never overwrite a stronger source's answer;
62
+ 4. maps each `(class FQN, method)` to a graphify node id;
63
+ 5. appends `calls` edges carrying the target's confidence (`EXTRACTED` when the type was read
64
+ from source, `INFERRED` when it was derived) and `_resolver: "graphify-php"`, which is how a
65
+ reader tells our edges from graphify's own and can drop them without a rebuild. `_via` names
66
+ the technique that proved each one (`tree_sitter:promoted-parameter`, `tree_sitter:self-scope`,
67
+ ...).
68
+
69
+ The marker is not `_origin`: graphify overwrites that on every edge with `"ast"` after the
70
+ resolvers run (`extract.py:8285-8289`), where it means the eviction tier rather than the author.
71
+
72
+ ### Scoped calls
73
+
74
+ `self::`, `parent::`, `static::` and `Class::method()` reach graphify with `is_member_call`
75
+ false and the **scope** as the callee — the method name is dropped
76
+ (`extractors/engine.py:6147-6152`). The resolver recovers it without parsing PHP: it asks the
77
+ graph which methods that class declares and offers each as a candidate, and the type source
78
+ refuses every name not actually written on that line. A class with ten methods costs ten
79
+ lookups and yields at most one edge.
80
+
81
+ `Class::method()` additionally already has a coarse `caller -> Class` edge, because graphify
82
+ resolves the scope name to the class node. Our method-level edge is a **second** edge between
83
+ different endpoints, so both are published. The narrow one carries `_refines` naming the coarse
84
+ one, so a consumer can collapse the pair instead of counting the call twice.
85
+
86
+ A source returns a target only when it can prove it. Chained calls, dynamic names, `static::`
87
+ and anything through `__call` are counted by reason, not guessed at: a wrong call edge is worse
88
+ than a missing one, and every counted reason is a line on the next version's work list.
89
+
90
+ ## Install and register
91
+
92
+ graphify-php is not on PyPI. Install a clone in editable mode into graphify's own environment;
93
+ the PHPStan source needs the `php/` directory of the checkout, which the wheel does not ship:
94
+
95
+ ```bash
96
+ git clone https://github.com/OxCom/graphify-php.git ~/src/graphify-php
97
+ pipx inject --editable --include-apps graphifyy ~/src/graphify-php
98
+ ```
99
+
100
+ The one runtime dependency is pyyaml. graphify and tree-sitter come from the environment that
101
+ runs the build; pinning them here would fight graphify's own pins. Virtual environments,
102
+ PHPStan, verification and troubleshooting: [docs/install.md](docs/install.md).
103
+
104
+ Registration is one call, made before graphify builds:
105
+
106
+ ```python
107
+ import graphify_php
108
+
109
+ graphify_php.register()
110
+ ```
111
+
112
+ It is idempotent and imports graphify lazily, so importing the package never requires graphify
113
+ to be installed.
114
+
115
+ ## Run a build
116
+
117
+ ```bash
118
+ graphify-php-build -- update .
119
+ ```
120
+
121
+ Everything after `--` is passed to graphify unchanged; options before it belong to the wrapper:
122
+
123
+ | Option | Meaning |
124
+ |---|---|
125
+ | `--graph PATH` | the graph artifact to protect (default `$GRAPHIFY_OUT/graph.json`) |
126
+ | `--expect RESOLVER` | a resolver that must report; repeatable, defaults to `php_member_calls` |
127
+
128
+ Exit codes:
129
+
130
+ | Code | Meaning |
131
+ |---|---|
132
+ | 0 | every expected resolver reported `completed` or `skipped` |
133
+ | 2 | an expected resolver reported `failed`, or never finished |
134
+ | 3 | an expected resolver never reported at all |
135
+ | other | graphify's own exit code, when graphify itself failed |
136
+
137
+ The wrapper sets `PYTHONHASHSEED=0` before calling graphify. graphify re-execs itself to pin
138
+ that seed for `update`, `extract`, `cluster-only` and `label` (`__main__.py:486-525`), and the
139
+ re-exec would replace the process — losing both the registration and the gate. Setting the seed
140
+ graphify would have set skips the re-exec and keeps its determinism guarantee.
141
+
142
+ ## Why the wrapper exists
143
+
144
+ graphify runs registered resolvers like this:
145
+
146
+ ```python
147
+ try:
148
+ resolver.resolve(per_file, all_nodes, all_edges)
149
+ except Exception as exc:
150
+ _LOG.warning("%s resolution failed, skipping: %s", resolver.name, exc)
151
+ ```
152
+
153
+ A resolver that raises is skipped and the build still publishes. A resolver that was never
154
+ registered — because the seam moved in a graphify upgrade, or because an install left this
155
+ package out — is not even logged. Both produce a valid graph with fewer `calls` edges, which is
156
+ exactly the shape of the defect this package was written to fix. The failure would be invisible
157
+ at the one moment it matters, and the warning goes to graphify's logger, which nothing running
158
+ the build reads.
159
+
160
+ So each resolver writes its own record — state, and counters that include the denominator,
161
+ because "resolved 400 calls" says nothing without "out of how many" — and `graphify-php-build`
162
+ reads that record and refuses to publish when an expected resolver did not complete. On a
163
+ refusal the previous graph is restored and the exit code is non-zero.
164
+
165
+ `skipped` with a reason is a success: a repository with no PHP type engine in `vendor/` is a
166
+ normal skip, and conflating it with a failure is how a missing layer becomes noise. `failed`,
167
+ and silence, are not.
168
+
169
+ The record path defaults to `graphify-out/.graphify-php-status.json` and is overridable with
170
+ `GRAPHIFY_PHP_STATUS`, so one machine can index many repositories without their builds sharing
171
+ a file.
172
+
173
+ ## Routes
174
+
175
+ A second registered pass publishes what `#[Route]` attributes declare. Each declaration becomes
176
+ one node — labelled with the path template, carrying the route name, the HTTP methods and
177
+ whether the path was composed whole — and one `handled_by` edge to the controller method that
178
+ serves it. `route_path` holds the full composed path, `""` when it could not be composed.
179
+
180
+ Every `#[Route]` on a method is a route of its own, stacked in separate groups or listed in one.
181
+ Only the first class-level `#[Route]` is the prefix. An invokable class with no method routes
182
+ turns each class-level `#[Route]` into a route for `__invoke`. A path may be a string literal,
183
+ `self::NAME` for a string constant declared in the same class body, or a `.` concatenation of
184
+ those; `static::NAME`, inherited constants and any `self::NAME` in a trait (where `self` is the
185
+ using class) are refused as `path-not-literal`.
186
+
187
+ The node key is `Class::method#path`, so two controller methods declaring the same path stay two
188
+ nodes. An older measurement of the reference application found more route declarations than
189
+ distinct path templates, the repeats being different HTTP verbs on one path.
190
+
191
+ The relation is `handled_by`, not `routed_to` — the latter already means messenger transport
192
+ routing, and merging the two would put HTTP paths and message transports in one query.
193
+
194
+ A declaration whose controller method is missing from the graph still gets its node; only the
195
+ edge is withheld, and the omission is counted under `controller_not_in_graph`. The path is a
196
+ fact about the codebase either way.
197
+
198
+ Route nodes follow `route_schema: 2` and carry these fields after the ones above. The reason a
199
+ template is `""` or only partly trusted is also on the node, in `route_template_reason` (`""`
200
+ when there is none):
201
+
202
+ - `route_template`: the path with `{name}` placeholders and a leading `/`, `{name?}` for an
203
+ optional one. Symfony inline requirements and defaults are dropped: `{id<\d+>}` is `{id}`,
204
+ `{page<\d+>?1}` and `{page?1}` are `{page?}`. A `defaults:` key also makes a trailing
205
+ placeholder optional. It is `""` when the path could not be composed, or with a counted
206
+ reason: `route-template-multi-segment` when an inline or `requirements:` regex may match `/`
207
+ (anything not provably slash-free counts), `route-template-optional-literal` for an optional
208
+ literal part such as `[/edit]` (other providers), `route-template-unparsed` for a brace that is
209
+ not a placeholder. A `requirements:` value reads like a route path: a string literal,
210
+ `self::NAME` for a string constant declared once in the same class body, or a `.` of those.
211
+ The whole `requirements:` array may be `self::NAME` for a literal array constant declared once
212
+ in the same class body, and that array or an inline one may spread (`...self::OTHER`) another
213
+ such constant; later keys win, and a cycle or any unreadable element leaves the whole array
214
+ unread. Any other value (`static::`, another class, an inherited or trait constant) keeps the template
215
+ and is counted as `route-template-requirement-unread`. The status record shows these under the
216
+ route source's prefix, e.g. `tree_sitter_routes:route-template-multi-segment`.
217
+ - `declared_in`: the declaring file, equal to `source_file`.
218
+ - `effective_guards`: the sorted ids of the guard nodes proved to apply: route-scoped guards
219
+ (`access_control`), guards on the handler method and guards on its class. `checks_access`
220
+ targets are not included. `[]` when none.
221
+ - `authorization_state`: `covered` when an effective guard has `guard_kind: "authorization"`;
222
+ otherwise `undecided` when the `access_control` step could not decide the route or an
223
+ effective guard is `unknown`; otherwise `not_proven`.
224
+ - `authorization_reason`: `""` unless undecided, then `access-control-undecided`,
225
+ `access-control-blocked` (unread `security.yaml`, a config blocker, or a route path or prefix
226
+ that is not a literal) or `guard-kind-unknown`.
227
+ - `handler_kind`: `method` when the node has a `handled_by` edge, `closure` when the action is a
228
+ closure or arrow function (no handler node exists, so no edge), `unresolved` when the named
229
+ handler is not in the graph (counted under `controller_not_in_graph`, no edge). `method` holds
230
+ exactly when a `handled_by` edge leaves the node. A node shared by several declarations is
231
+ `method` when any of them produced the edge.
232
+
233
+ ### Laravel provider
234
+
235
+ The Laravel provider (`frameworks/laravel.py`) reads routes files loaded from
236
+ `bootstrap/app.php` `withRouting(web:, api:, apiPrefix:)`. Behaviour follows the framework source
237
+ as recorded in a docs check; each rule cites its item in a `docs-check laravel` comment.
238
+
239
+ Covered:
240
+
241
+ - Verbs, `match`, and `any` as the installed `Router::$verbs`. The version comes from
242
+ `composer.lock` `packages` at minor precision. QUERY and `Route::query()` start at v13.35.0.
243
+ With no version or no minor read (`13.x-dev`), `any` leaves QUERY out and
244
+ `laravel-version-unread` is counted once.
245
+ - Registrar calls straight before a verb (`Route::prefix('p')->get('b', ...)`) are the route
246
+ action, not a group. Inside a group with prefix `g` the path is `p/g/b`. Group middleware comes
247
+ before registrar middleware, and the registrar `as` is appended. A repeated registrar call
248
+ replaces the earlier one; only `withoutMiddleware` accumulates.
249
+ - `Route::controller(X)->get('b', 'm')` does not bind `X`: the route is published with
250
+ `handler_kind: "unresolved"` under `laravel-registrar-controller-rejected-by-framework`,
251
+ unless an enclosing group sets a controller. Laravel itself rejects such a route at
252
+ registration (`RouteAction::makeInvokable` throws "Invalid route action"), so it is not an
253
+ unguarded endpoint.
254
+ - Groups: prefix, `as`, middleware, `withoutMiddleware`, `where`, `controller` (an inner one
255
+ overrides), `namespace` (joined unless it starts with `\`). Array groups take the aliased keys
256
+ `as`, `scope_bindings` and `excluded_middleware`.
257
+ - Route-level `->prefix()` in front of the built URI, applied in written order. Route-level
258
+ `->name()` appends to the name the route already has.
259
+ - String actions get the group namespace unless they start with `\` or with that namespace.
260
+ A `use` line never applies to a string. In a `controller` group, `Foo@bar` keeps its class and
261
+ a bare method name takes the group controller. A bare string that contains `\` or names a
262
+ corpus class is refused, because `class_exists()` decides it at runtime. Array actions get
263
+ neither the controller nor the namespace.
264
+ - Name prefixes (`as`) concatenate with no separator: `name('admin')` and `name('index')` give
265
+ `adminindex`.
266
+ - `resource`, `apiResource`, `resources`, `apiResources`, nested `photos.comments`, `->shallow()`,
267
+ `singleton` and `apiSingleton` with `creatable()` and `destroyable()`. A name with `/`
268
+ (`admin/photos`) registers its last segment inside a prefix group of the rest.
269
+ - Controller middleware from `HasMiddleware::middleware()` and the `#[Middleware]` and
270
+ `#[Authorize]` attributes (from v13.0.0) and `#[WithoutMiddleware]` (from v13.20.0) on a class
271
+ or a method. `#[Authorize('x')]` shares the guard node of `->can('x')` and `can:x`.
272
+ `#[WithoutMiddleware]` removes route and group middleware as well as controller middleware.
273
+ From v13.5.0 a parent class's attributes apply too: they are counted under
274
+ `laravel-controller-attribute-inherited`, not published. From v13.20.0 an inherited
275
+ `#[WithoutMiddleware]`, or a parent outside the corpus (`laravel-controller-parent-unread`),
276
+ leaves that handler with no proved route guard. `Illuminate\Routing\Controller` ends the walk.
277
+ - `withRouting(using:, then:)`: a closure `then` makes Laravel ignore `using` and load the
278
+ `web` / `api` files.
279
+ - Guard kinds: `can` is `authorization`; `auth`, `auth:*`, `auth.basic`, `auth.session`, `guest`,
280
+ `verified` and `password.confirm` are `authentication`; any other alias is `middleware`.
281
+ - Grant calls: `$this->authorize` and `Gate::authorize` (throwing), `Gate::allows`, `denies`,
282
+ `check`, `any` and `none` (conditional).
283
+
284
+ Counted under a `laravel-*` reason, never published: `redirect`, `permanentRedirect` and `view`
285
+ routes (`laravel-route-no-controller`), the `health:` route (`laravel-health-route`), a
286
+ non-literal namespace, a class string in a `controller` group, and a bare `Route::` when
287
+ `config/app.php` lists literal `aliases` without the facade (`laravel-route-alias-removed`).
288
+ Resource `create` and `edit` routes are refused when any file calls `resourceVerbs(...)`
289
+ (`laravel-resource-verbs-changed`). A registrar `prefix`, `name`, `where`, `namespace` or
290
+ `controller` before a resource is refused (`laravel-resource-registrar-attribute`):
291
+ `ResourceRegistrar` gets them as options and does not apply them as a group would.
292
+
293
+ Not covered: Laravel 10 `RouteServiceProvider`, Lumen, `Route::fallback`, invokable string
294
+ actions (`'App\Ctl'`), nested singletons, and `$this->middleware()` in a controller constructor.
295
+
296
+ ### Laravel closure routes
297
+
298
+ A Laravel route whose action is a closure or arrow function (`Route::get('/', fn () => ...)`) is
299
+ published like an array action: path, methods, name, template and route-scope guards
300
+ (`middleware`, `can`). It gets `handler_kind: "closure"` and no `handled_by` edge, and it is
301
+ still counted under `laravel-closure-action`. Its node key is
302
+ `laravel:closure:<routes file>:<line>#<path>`, with the routes file repo-relative. A closure has
303
+ no method or class, so no method-scope or class-scope guard and no `checks_access` edge applies;
304
+ `authorization_state` comes from the route-scope guards alone.
305
+
306
+ ### CodeIgniter 4 provider
307
+
308
+ The CodeIgniter provider (`frameworks/codeigniter.py`) is selected by a direct
309
+ `codeigniter4/framework` or `codeigniter4/codeigniter4` requirement. It reads the route files of
310
+ `app/Config/Routing.php` `$routeFiles` (a literal list of `APPPATH . 'Config/...'`), else
311
+ `app/Config/Routes.php`, in order. Each rule cites its item in a `docs-check ci4` comment. The
312
+ `codeigniter4/framework` version comes from `composer.lock`; where it matters and is unread,
313
+ `codeigniter-version-unread` is counted once.
314
+
315
+ Covered:
316
+
317
+ - `get`, `post`, `put`, `patch`, `delete`, `options`, `head`; `match()` (verbs lowercased);
318
+ `add()` and `map()` as all nine `Router::HTTP_METHODS`.
319
+ - String handlers `Ctl::method/$1`, prefixed with the `namespace` option or the default namespace
320
+ (`App\Controllers`, `Routing::$defaultNamespace`, or a literal `setDefaultNamespace()`) unless
321
+ they start with `\`: `Admin\Users::index` is prefixed. Array callables `[Ctl::class, 'm']` are
322
+ fully qualified through the imports. Closures are published with `handler_kind: "closure"`.
323
+ - `route_path` is the path as written, with a leading `/`. `(:num)`, `(:alpha)`, `(:alphanum)`,
324
+ `(:segment)`, `(:hash)`, a literal `addPlaceholder()` declared before use, and a raw group
325
+ that cannot match `/` become `{1}`, `{2}`... by position. `(:any)`, `.*`, or a `.` in the path
326
+ give `route_template: ""` with `route-template-multi-segment`.
327
+ - `group()` prefixes. Group options merge into inner groups from 4.5.0 (inner replaces before);
328
+ group filters merge into route filters from 4.5.4. Before 4.5.4, or with no version read, no
329
+ group filter is claimed (`codeigniter-group-filter-version`).
330
+ - `resource()` and `presenter()` tables with `only`, `except` (list or CSV), `websafe`,
331
+ `controller` and `placeholder`. The id placeholder follows the source (`any`, `.*`), not the
332
+ guide's `(:segment)`, so member templates are `""` unless a placeholder is given.
333
+ - Route `filter` options as route-scope guards (`_via: "filter"`, the label keeps arguments).
334
+ `app/Config/Filters.php` before-filters as route-scope guards keyed
335
+ `codeigniter:config#app/Config/Filters.php:<index>` (`_via: "filter_config"`): `$required`
336
+ (4.5.0+), `$globals` minus `except`, `$methods` for routes of only that verb, and `$filters`
337
+ when a pattern provably matches every URL of the route. A partial or undecidable match is
338
+ counted, and makes the route `undecided` when the filter is authorization or unknown.
339
+ - Guard kinds: Shield (only with a direct `codeigniter4/shield` requirement) `session`,
340
+ `tokens`, `hmac`, `jwt`, `chain` are authentication, `group` and `permission` authorization;
341
+ the built-ins, `auth-rates` and `force-reset` are middleware. An alias the application maps to
342
+ another class, and every other alias or class, is `unknown`.
343
+ - `#[Filter(by, having)]` on controller classes and methods from 4.7.0, where
344
+ `Routing::$useControllerAttributes` defaults to true: the label is the route filter spec
345
+ `by` or `by:having,csv`, on the route filter's guard node. A literal `false` is counted per
346
+ attribute (`codeigniter-controller-attributes-disabled`), as is any attribute before 4.7.0
347
+ (`codeigniter-controller-attributes-version`). A non-literal setting, no readable
348
+ `Routing.php`, or no version read is counted once and leaves the routes of `#[Filter]`
349
+ holders `undecided`. A string `having` is a TypeError at runtime
350
+ (`codeigniter-controller-attribute-invalid`). `#[Restrict]` is a route condition
351
+ (`codeigniter-controller-attribute-restrict`), not a guard; `#[Cache]` is ignored.
352
+ - Per key, a verb route beats an `add()`/`map()` route (`RouteCollection.php:504`), which keeps
353
+ the remaining verbs. A verb route with no `filter` option key runs the `*` route's filters
354
+ (`loadRoutesOptions()`, `:1568-1575`); when either key's presence or the `*` route is
355
+ runtime-dependent the route is `undecided` (`codeigniter-route-any-options-undecided`).
356
+ - `$methods`: the exact uppercase key, or from 4.5.0 the deprecated lowercase key when the
357
+ uppercase one is missing. An empty `$filters` path (`''` or `[]`) matches every route; an
358
+ empty `except` matches none. A filter spec with more than one `:` is unread
359
+ (`codeigniter-filter-spec-unread`) and makes a route it may apply to `undecided`.
360
+ `codeigniter-methods-filter-case-bypass` means a route's only authorization guard is a
361
+ `$methods` filter, which a lowercase request method skips, so the route is `undecided`
362
+ (`access-control-undecided`) while the guard edge stays published.
363
+
364
+ Counted under a `codeigniter-*` reason, never published: `cli()`, `view()`, `addRedirect()`,
365
+ routes inside `environment()`, a `$routes` passed to any call (`service('auth')->routes($routes)`),
366
+ module route discovery, auto routing, a duplicate path and verb after the first, an
367
+ unconditional route that shares its key and table with a conditional one, and `match()` with
368
+ TRACE or CONNECT (`codeigniter-match-verb-no-method`: no such `RouteCollection` method).
369
+ Hostname routes are published and counted (`codeigniter-hostname-route`); a `subdomain` is
370
+ ignored when `hostname` is set, else counted as `codeigniter-subdomain-route`.
371
+ A route that loses its GET to a `view()` on its key is refused as
372
+ `codeigniter-route-key-view-collision`; its other verbs still publish. Every route on the key of
373
+ an `addRedirect()` is refused as `codeigniter-route-key-redirect-collision`, unless an
374
+ unconditional `add()`/`map()` route on that key came first and voids the redirect.
375
+
376
+ Not covered: auto-routed controllers, module `Config/Routes.php` files, Shield's own routes,
377
+ `$user->can()` grant calls (a typed receiver; follow-up), filter regex patterns beyond `*`,
378
+ Registrar-added globals, and `{locale}` rewriting.
379
+
380
+ ### Access guards
381
+
382
+ Guards are `access_guard` nodes. Three relations reach them:
383
+
384
+ - `guarded_by` with `_via: "attribute"`: from a method or class to each `#[IsGranted]` on it.
385
+ A literal role is one shared node (`guard#ROLE_X`); any other first argument is kept as source
386
+ text and scoped to its class. The edge carries `guard_scope` and `guard_attribute: "IsGranted"`.
387
+ - `checks_access` with `_via: "call"`: from a route handler to the guard named by a direct
388
+ `$this->isGranted(...)` (`conditional: true`) or `$this->denyAccessUnlessGranted(...)`
389
+ (`conditional: false`) in its body. These share the `#[IsGranted]` node. A call whose name
390
+ matches `^can[A-Z]` or `^assert\w*Access` goes to a class-scoped node labelled with the method
391
+ name (`conditional: null`). `GRAPHIFY_PHP_ACCESS_CHECK_PATTERNS` replaces the patterns with a
392
+ comma-separated list; an invalid list falls back to the defaults and is counted. Every
393
+ `checks_access` edge carries `check_kind`: `framework` for `isGranted` and
394
+ `denyAccessUnlessGranted`, `pattern` for a name-matched project method.
395
+ - `guarded_by` with `_via: "access_control"`: from a route node to the
396
+ `config/packages/security.yaml` rule Symfony applies to it. The edge is added only when that
397
+ rule is proved to be the first match for every URL the route template can produce.
398
+ Otherwise the route is counted under `access-control-undecided`. The proof compares the
399
+ literal text before the first placeholder, then goes segment by segment: a placeholder is one
400
+ segment with the value set of its literal requirement (`\d+`, a bounded `\d{n}` or `\d{n,m}`
401
+ with n >= 1, a word alternation, or Symfony's default `[^/]+`), checked against rule segments that are literal, `\d+` or `[^/]+`, an optional
402
+ trailing group of literal alternatives, and an optional `$`. A rule without `$` is a prefix
403
+ match. A same-class `self::NAME` requirement counts as literal, as in `route_template`. Any
404
+ other non-literal requirement, a defaulted or optional placeholder at the deciding segment,
405
+ `{_locale}`/`{_format}`, or any other rule shape leaves the route undecided. A routes import
406
+ that sets `requirements`, `defaults`, `locale` or `format` turns the segment step off
407
+ (`access-control-segment-facts-unread`).
408
+
409
+ Every guard node and every `guarded_by` and `checks_access` edge carries `guard_kind`, and every
410
+ guard node carries `guard_key`, the key its id is hashed from. Symfony keys are unchanged
411
+ (`guard#ROLE_X`, `Class::guard#<text>`, `Class::check#<method>`, `access_control#<index>`).
412
+ Other providers key a guard `guard#<provider>:<guard_kind>:<label>` (or
413
+ `Class::guard#<provider>:<guard_kind>:<text>`) and a config rule
414
+ `<provider>:config#<file>:<index>`. Symfony's `guard_kind`:
415
+
416
+ - an `access_control` rule without `allow_if`: `public` for no roles or a `PUBLIC_ACCESS` /
417
+ `IS_AUTHENTICATED_ANONYMOUSLY` role, `authentication` for an `IS_AUTHENTICATED_*`,
418
+ `IS_REMEMBERED` or `IS_IMPERSONATOR` role, else `authorization`. A request passes on any one
419
+ role, so the weakest role decides;
420
+ - `allow_if`: split at top-level `and` / `&&`; `authorization` when one of those conjuncts is
421
+ exactly a positive `is_granted('X')` with X a role, else `unknown`. A top-level `or` or `||`
422
+ gives `unknown`; one inside parentheses does not. With `roles` too, the weaker of the two kinds
423
+ wins;
424
+ - `#[IsGranted]` and `isGranted` / `denyAccessUnlessGranted`: a literal goes through the role
425
+ rule, anything else is `unknown`;
426
+ - a pattern-matched helper call is `unknown`.
427
+
428
+ The `php_routes` status record carries `route_schema: 2`, `authorization_state` (route nodes per
429
+ state) and `authorization_reason` (undecided routes per reason). It counts `handlers_total` and
430
+ `handlers_unguarded` (handlers with no `authorization` guard edge from the method, its class or
431
+ its routes, and no `check_kind: framework` edge). A
432
+ pattern-only check does not cover a handler. Handlers with no `guarded_by` edge fall into exactly
433
+ one of `handlers_check_framework`, `handlers_check_pattern_only` and `handlers_unchecked`, and
434
+ `handlers_unguarded` equals the last two summed. The record also counts
435
+ `checks_access_declarations`, `checks_access_edges_added`, `access_control_edges_added` and
436
+ `routes_access_control_undecided`.
437
+
438
+ Route schema 2 changes what the `handlers_*` counters mean, so their numbers move without any
439
+ change in the application. Before, any guard counted; now only an `authorization` guard does,
440
+ and a sign-in-only or public `access_control` rule no longer covers a handler. On the reference
441
+ Symfony application (220 handlers) `handlers_unguarded` went from 40 to 130,
442
+ `handlers_check_framework` from 2 to 17, `handlers_check_pattern_only` from 13 to 20 and
443
+ `handlers_unchecked` from 27 to 110. That is a stricter count, not a regression.
444
+
445
+ Limits:
446
+
447
+ - Inherited route methods are not followed, although Symfony reads routes from parent methods.
448
+ - A `use ... as` alias for `Route` or `IsGranted` is not followed.
449
+ - Two stacked routes with the same path on one method collapse to one node.
450
+ - A shared literal guard node keeps the subject and location of the first declaration seen.
451
+ - `access_control` is read from top-level `security.yaml` only, and only a proved first match
452
+ gets an edge. When a `when@<env>` block, another file under `config/packages/`, or a PHP/XML
453
+ file there may declare `access_control`, every such edge is refused as
454
+ `access-control-overridden-elsewhere`.
455
+ - `route_path` is the attribute-declared path. A routes-config import prefix is not applied,
456
+ and when one exists access_control edges are refused as `access-control-route-prefix-unread`.
457
+ Routing PHP and XML files and `src/Kernel.php` get a text check for `prefix` calls only.
458
+ - `checks_access` reads only direct `$this` calls in handler bodies. Closures, arrow functions,
459
+ anonymous classes and helper methods are not followed.
460
+
461
+ ## Verifying it works
462
+
463
+ ```bash
464
+ PYTHONPATH=src python -m pytest tests/test_cli_end_to_end.py -q
465
+ ```
466
+
467
+ That test generates a small PHP project in a temporary directory, runs graphify over it twice —
468
+ once plain, once with `register()` called first — and asserts the difference. On the generated
469
+ fixture the plain build produces **1** `calls` edge and the registered build **5**. It needs no
470
+ reference application and writes nothing outside `tmp_path`.
471
+
472
+ ## Extending
473
+
474
+ Adding a third source — a language server, an LSIF index — means implementing one protocol,
475
+ `CallTargetSource` in `ports.py`, and adding it to the factory in `__init__.py`. `resolver.py`
476
+ depends on the protocols and nothing else, and does not change.
477
+
478
+ ## CI
479
+
480
+ GitHub Actions runs three stages in order: **security** (gitleaks, trufflehog, pip-audit,
481
+ `php -l` over `php/`), **tests** (ruff lint and format check, pytest on Python 3.10–3.14) and
482
+ **build** (`python -m build`, then import and `graphify-php-build --help` from the installed
483
+ wheel). The same checks locally: `pip install -e ".[test,lint]"`, then `ruff check .`,
484
+ `ruff format --check .`, `python -m pytest`, and `for f in php/autoload.php php/src/CallGraph/*.php; do php -l "$f"; done`.
485
+
486
+ ## License
487
+
488
+ Apache-2.0.