graphify-php 0.0.8__tar.gz → 0.0.9__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.
- graphify_php-0.0.9/.github/workflows/graphify-canary.yml +39 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/.graphifyignore +6 -1
- graphify_php-0.0.9/PKG-INFO +208 -0
- graphify_php-0.0.9/README.md +187 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/docs/index.md +5 -0
- graphify_php-0.0.8/README.md → graphify_php-0.0.9/docs/routes.md +5 -185
- {graphify_php-0.0.8 → graphify_php-0.0.9}/pyproject.toml +3 -1
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/core_guard.py +20 -5
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_core_guard.py +12 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_engine_extracted.py +44 -2
- graphify_php-0.0.8/PKG-INFO +0 -488
- {graphify_php-0.0.8 → graphify_php-0.0.9}/.github/workflows/ci.yml +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/.github/workflows/pages.yml +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/.github/workflows/release.yml +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/.github/workflows/stage-build.yml +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/.github/workflows/stage-security.yml +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/.github/workflows/stage-tests.yml +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/.gitignore +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/.gitleaks.toml +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/.trufflehog-exclude.txt +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/LICENSE +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/docs/_config.yml +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/docs/architecture.md +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/docs/assets/css/style.scss +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/docs/configuration.md +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/docs/evaluation.md +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/docs/install.md +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/docs/phpstan.md +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/docs/setup.md +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/README.md +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/__init__.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/canaries.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/chained.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/ctor_body_assign.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/declared_property.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/dynamic.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/handler_shapes.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/inheritance.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/interfaces.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/locals_new.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/mail.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/nullable_union.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/promoted.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/same_name_traps.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/secrets.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/services.yaml +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/fixtures/traits.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/reference_set.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/eval/score.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/php/README.md +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/php/autoload.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/php/src/CallGraph/CallEdge.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/php/src/CallGraph/CallEdgeRule.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/php/src/CallGraph/CallEdgeWriter.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/php/src/CallGraph/JsonLinesWriter.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/php/src/CallGraph/MethodCallCollector.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/__init__.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/cli.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config/__init__.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config/class_lookup.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config/discovery.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config/document.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config/emit.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config/environment.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config/facts.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config/messaging.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config/ports.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config/safe_yaml.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/config_resolver.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/container/__init__.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/container/facts.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/container/layer.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/container/locator.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/container/overlay.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/container/ports.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/container/reader.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/container/reasons.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/frameworks/__init__.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/frameworks/codeigniter.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/frameworks/detect.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/frameworks/laravel.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/frameworks/matching.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/frameworks/provider.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/frameworks/symfony.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/graph_adapter.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/ports.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/resolver.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/shrink.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/shrink_cli.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/sources/phpstan_source.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/sources/route_source.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/sources/tree_sitter_source.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/status.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/syntax/access_control.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/syntax/attributes.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/syntax/call_sites.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/syntax/class_index.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/syntax/collectors.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/syntax/facts.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/syntax/file_scan.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/syntax/names.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/syntax/nodes.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/src/graphify_php/syntax/routes.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/conftest.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Config/AdminRoutes.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Config/Filters.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Config/Modules.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Config/Routes.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Config/Routing.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Account.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Admin/Users.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Albums.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Api/Tokens.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Contact.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Files.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Home.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Panel.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Photos.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Reports.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Search.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/app/Controllers/Users.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/composer.json +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/codeigniter/composer.lock +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/app/Http/Controllers/Api/TokenController.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/app/Http/Controllers/Controller.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/app/Http/Controllers/PhotoController.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/app/Http/Controllers/PostController.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/app/Http/Controllers/ReportController.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/app/Http/Controllers/ShowDashboard.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/app/Http/Controllers/UserController.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/bootstrap/app.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/composer.json +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/composer.lock +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/routes/admin.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/routes/api.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/routes/console.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/routes/orphan.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/frameworks/laravel/routes/web.php +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/shrink/ckeditor/new_graph.json +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/shrink/ckeditor/new_manifest.json +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/shrink/ckeditor/old_graph.json +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/shrink/ckeditor/old_manifest.json +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/shrink/ckeditor/present.txt +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/shrink/games/new_graph.json +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/shrink/games/new_manifest.json +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/shrink/games/old_graph.json +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/shrink/games/old_manifest.json +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/fixtures/shrink/games/present.txt +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_access_checks.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_access_control_segments.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_adapter_graph.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_cli_attribution.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_cli_end_to_end.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_cli_gate.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_cli_shrink_gate.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_config_readers.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_config_resolver.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_container_integration.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_container_layer.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_container_overlay.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_container_reader.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_engine_contradictions.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_eval_canaries.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_eval_reference_set.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_eval_score.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_framework_codeigniter.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_framework_laravel.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_framework_providers.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_namespace_blocks.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_new_site_edges.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_phpstan_integration.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_phpstan_source.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_resolver_precedence.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_route_schema.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_routes_stacked_guards.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_shrink.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_shrink_attribution.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_shrink_cli.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_status_record.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_syntax_parameters.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_syntax_routes.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_syntax_scan.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_syntax_writes.py +0 -0
- {graphify_php-0.0.8 → graphify_php-0.0.9}/tests/test_tree_sitter_source.py +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: graphify canary
|
|
2
|
+
|
|
3
|
+
# CI installs graphify up to the release tests/test_core_guard.py PINNED_SHAPE was checked
|
|
4
|
+
# against (the cap in pyproject.toml). This run installs the newest graphify instead, so a red
|
|
5
|
+
# run here means a new graphify release changed something: re-check core's PHP pass, add a
|
|
6
|
+
# PINNED_SHAPE row, then raise the cap. It is a separate workflow so that CI stays a signal
|
|
7
|
+
# about this repository's code.
|
|
8
|
+
on:
|
|
9
|
+
schedule:
|
|
10
|
+
- cron: '30 3 * * *'
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test-latest-graphify:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
23
|
+
with:
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.13"
|
|
30
|
+
|
|
31
|
+
- name: Install graphify-php with the newest graphify
|
|
32
|
+
# Not the test extra: its cap would hold graphify back.
|
|
33
|
+
run: pip install -e . "pytest>=7.0" graphifyy
|
|
34
|
+
|
|
35
|
+
- name: Show the graphify release under test
|
|
36
|
+
run: pip show graphifyy
|
|
37
|
+
|
|
38
|
+
- name: Run the test suite
|
|
39
|
+
run: python -m pytest -rs
|
|
@@ -30,4 +30,9 @@ LICENSE
|
|
|
30
30
|
|
|
31
31
|
# Tests are excluded from the graph: they added nodes and edges without
|
|
32
32
|
# answering code questions (2026-11-16).
|
|
33
|
-
|
|
33
|
+
# 2026-11-19: tests are indexed and demoted at query time instead (graphify-mesh non-source demotion).
|
|
34
|
+
# /tests/
|
|
35
|
+
|
|
36
|
+
# Markdown is not indexed: semantic passes on README.md time out on ai1
|
|
37
|
+
# (504 at 540 s) and add doc concepts, not code (2026-11-23).
|
|
38
|
+
*.md
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: graphify-php
|
|
3
|
+
Version: 0.0.9
|
|
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.115,>=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 (Symfony), plus Laravel
|
|
176
|
+
and CodeIgniter 4 route files. Each declaration becomes one node and one `handled_by` edge to
|
|
177
|
+
the controller method that serves it. Access guards become `access_guard` nodes reached by
|
|
178
|
+
`guarded_by` and `checks_access` edges. The route schema, providers, guard rules and limits are
|
|
179
|
+
in [docs/routes.md](docs/routes.md).
|
|
180
|
+
|
|
181
|
+
## Verifying it works
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
PYTHONPATH=src python -m pytest tests/test_cli_end_to_end.py -q
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
That test generates a small PHP project in a temporary directory, runs graphify over it twice —
|
|
188
|
+
once plain, once with `register()` called first — and asserts the difference. On the generated
|
|
189
|
+
fixture the plain build produces **1** `calls` edge and the registered build **5**. It needs no
|
|
190
|
+
reference application and writes nothing outside `tmp_path`.
|
|
191
|
+
|
|
192
|
+
## Extending
|
|
193
|
+
|
|
194
|
+
Adding a third source — a language server, an LSIF index — means implementing one protocol,
|
|
195
|
+
`CallTargetSource` in `ports.py`, and adding it to the factory in `__init__.py`. `resolver.py`
|
|
196
|
+
depends on the protocols and nothing else, and does not change.
|
|
197
|
+
|
|
198
|
+
## CI
|
|
199
|
+
|
|
200
|
+
GitHub Actions runs three stages in order: **security** (gitleaks, trufflehog, pip-audit,
|
|
201
|
+
`php -l` over `php/`), **tests** (ruff lint and format check, pytest on Python 3.10–3.14) and
|
|
202
|
+
**build** (`python -m build`, then import and `graphify-php-build --help` from the installed
|
|
203
|
+
wheel). The same checks locally: `pip install -e ".[test,lint]"`, then `ruff check .`,
|
|
204
|
+
`ruff format --check .`, `python -m pytest`, and `for f in php/autoload.php php/src/CallGraph/*.php; do php -l "$f"; done`.
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
Apache-2.0.
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# graphify-php
|
|
2
|
+
|
|
3
|
+
PHP member-call resolution for [graphify](https://github.com/OxCom/graphify). It binds
|
|
4
|
+
`$this->emails->reminderSubmitWeek($user)` to the method node it actually calls, so a PHP graph
|
|
5
|
+
has a call graph instead of a list of names.
|
|
6
|
+
|
|
7
|
+
## The measurement
|
|
8
|
+
|
|
9
|
+
graphify ships cross-file member-call resolvers for Swift, Python, Ruby, TypeScript, C#, Java
|
|
10
|
+
and Rust, and none for PHP. Its PHP extractor marks `$obj->method()` as a member call and the
|
|
11
|
+
shared cross-file pass then drops it, because a bare `method` collides across the corpus and a
|
|
12
|
+
name-only match is not evidence.
|
|
13
|
+
|
|
14
|
+
On a reference Symfony application (584 PHP files, not shipped with this package), measured
|
|
15
|
+
from the published graph:
|
|
16
|
+
|
|
17
|
+
| | |
|
|
18
|
+
|---|---|
|
|
19
|
+
| PHP callable nodes | 3426 |
|
|
20
|
+
| `calls` edges in the whole graph | 2172 |
|
|
21
|
+
| PHP callables with an outgoing `calls` edge | 24.4 % |
|
|
22
|
+
| PHP callables with an incoming `calls` edge | 20.1 % |
|
|
23
|
+
|
|
24
|
+
Three quarters of the PHP callables in that graph are connected to nothing they call. Every
|
|
25
|
+
"what calls this", "what does this touch" and blast-radius question over PHP is answered from
|
|
26
|
+
that quarter.
|
|
27
|
+
|
|
28
|
+
## What it does
|
|
29
|
+
|
|
30
|
+
The pass runs inside graphify's build, after extraction:
|
|
31
|
+
|
|
32
|
+
1. collects every member call graphify left unresolved, from `per_file[*]["raw_calls"]`;
|
|
33
|
+
2. hands the sources the PHP files graphify parsed as the `corpus` they may read declarations
|
|
34
|
+
from. A leaf service class has nothing unresolved in it, so it never appears among the sites,
|
|
35
|
+
and a source indexing only those files cannot tell whether it declares the method being
|
|
36
|
+
called on it. The set is bounded by the build, never by a filesystem walk;
|
|
37
|
+
3. asks each configured **call target source** in precedence order for the receiver's class —
|
|
38
|
+
the precise source (a PHP type engine that already knows the project's types) first, the
|
|
39
|
+
tree-sitter parser second. A site the first source proves is never offered to the second, so
|
|
40
|
+
a weaker source can add reach but can never overwrite a stronger source's answer;
|
|
41
|
+
4. maps each `(class FQN, method)` to a graphify node id;
|
|
42
|
+
5. appends `calls` edges carrying the target's confidence (`EXTRACTED` when the type was read
|
|
43
|
+
from source, `INFERRED` when it was derived) and `_resolver: "graphify-php"`, which is how a
|
|
44
|
+
reader tells our edges from graphify's own and can drop them without a rebuild. `_via` names
|
|
45
|
+
the technique that proved each one (`tree_sitter:promoted-parameter`, `tree_sitter:self-scope`,
|
|
46
|
+
...).
|
|
47
|
+
|
|
48
|
+
The marker is not `_origin`: graphify overwrites that on every edge with `"ast"` after the
|
|
49
|
+
resolvers run (`extract.py:8285-8289`), where it means the eviction tier rather than the author.
|
|
50
|
+
|
|
51
|
+
### Scoped calls
|
|
52
|
+
|
|
53
|
+
`self::`, `parent::`, `static::` and `Class::method()` reach graphify with `is_member_call`
|
|
54
|
+
false and the **scope** as the callee — the method name is dropped
|
|
55
|
+
(`extractors/engine.py:6147-6152`). The resolver recovers it without parsing PHP: it asks the
|
|
56
|
+
graph which methods that class declares and offers each as a candidate, and the type source
|
|
57
|
+
refuses every name not actually written on that line. A class with ten methods costs ten
|
|
58
|
+
lookups and yields at most one edge.
|
|
59
|
+
|
|
60
|
+
`Class::method()` additionally already has a coarse `caller -> Class` edge, because graphify
|
|
61
|
+
resolves the scope name to the class node. Our method-level edge is a **second** edge between
|
|
62
|
+
different endpoints, so both are published. The narrow one carries `_refines` naming the coarse
|
|
63
|
+
one, so a consumer can collapse the pair instead of counting the call twice.
|
|
64
|
+
|
|
65
|
+
A source returns a target only when it can prove it. Chained calls, dynamic names, `static::`
|
|
66
|
+
and anything through `__call` are counted by reason, not guessed at: a wrong call edge is worse
|
|
67
|
+
than a missing one, and every counted reason is a line on the next version's work list.
|
|
68
|
+
|
|
69
|
+
## Install and register
|
|
70
|
+
|
|
71
|
+
graphify-php is not on PyPI. Install a clone in editable mode into graphify's own environment;
|
|
72
|
+
the PHPStan source needs the `php/` directory of the checkout, which the wheel does not ship:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone https://github.com/OxCom/graphify-php.git ~/src/graphify-php
|
|
76
|
+
pipx inject --editable --include-apps graphifyy ~/src/graphify-php
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The one runtime dependency is pyyaml. graphify and tree-sitter come from the environment that
|
|
80
|
+
runs the build; pinning them here would fight graphify's own pins. Virtual environments,
|
|
81
|
+
PHPStan, verification and troubleshooting: [docs/install.md](docs/install.md).
|
|
82
|
+
|
|
83
|
+
Registration is one call, made before graphify builds:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import graphify_php
|
|
87
|
+
|
|
88
|
+
graphify_php.register()
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
It is idempotent and imports graphify lazily, so importing the package never requires graphify
|
|
92
|
+
to be installed.
|
|
93
|
+
|
|
94
|
+
## Run a build
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
graphify-php-build -- update .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Everything after `--` is passed to graphify unchanged; options before it belong to the wrapper:
|
|
101
|
+
|
|
102
|
+
| Option | Meaning |
|
|
103
|
+
|---|---|
|
|
104
|
+
| `--graph PATH` | the graph artifact to protect (default `$GRAPHIFY_OUT/graph.json`) |
|
|
105
|
+
| `--expect RESOLVER` | a resolver that must report; repeatable, defaults to `php_member_calls` |
|
|
106
|
+
|
|
107
|
+
Exit codes:
|
|
108
|
+
|
|
109
|
+
| Code | Meaning |
|
|
110
|
+
|---|---|
|
|
111
|
+
| 0 | every expected resolver reported `completed` or `skipped` |
|
|
112
|
+
| 2 | an expected resolver reported `failed`, or never finished |
|
|
113
|
+
| 3 | an expected resolver never reported at all |
|
|
114
|
+
| other | graphify's own exit code, when graphify itself failed |
|
|
115
|
+
|
|
116
|
+
The wrapper sets `PYTHONHASHSEED=0` before calling graphify. graphify re-execs itself to pin
|
|
117
|
+
that seed for `update`, `extract`, `cluster-only` and `label` (`__main__.py:486-525`), and the
|
|
118
|
+
re-exec would replace the process — losing both the registration and the gate. Setting the seed
|
|
119
|
+
graphify would have set skips the re-exec and keeps its determinism guarantee.
|
|
120
|
+
|
|
121
|
+
## Why the wrapper exists
|
|
122
|
+
|
|
123
|
+
graphify runs registered resolvers like this:
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
try:
|
|
127
|
+
resolver.resolve(per_file, all_nodes, all_edges)
|
|
128
|
+
except Exception as exc:
|
|
129
|
+
_LOG.warning("%s resolution failed, skipping: %s", resolver.name, exc)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
A resolver that raises is skipped and the build still publishes. A resolver that was never
|
|
133
|
+
registered — because the seam moved in a graphify upgrade, or because an install left this
|
|
134
|
+
package out — is not even logged. Both produce a valid graph with fewer `calls` edges, which is
|
|
135
|
+
exactly the shape of the defect this package was written to fix. The failure would be invisible
|
|
136
|
+
at the one moment it matters, and the warning goes to graphify's logger, which nothing running
|
|
137
|
+
the build reads.
|
|
138
|
+
|
|
139
|
+
So each resolver writes its own record — state, and counters that include the denominator,
|
|
140
|
+
because "resolved 400 calls" says nothing without "out of how many" — and `graphify-php-build`
|
|
141
|
+
reads that record and refuses to publish when an expected resolver did not complete. On a
|
|
142
|
+
refusal the previous graph is restored and the exit code is non-zero.
|
|
143
|
+
|
|
144
|
+
`skipped` with a reason is a success: a repository with no PHP type engine in `vendor/` is a
|
|
145
|
+
normal skip, and conflating it with a failure is how a missing layer becomes noise. `failed`,
|
|
146
|
+
and silence, are not.
|
|
147
|
+
|
|
148
|
+
The record path defaults to `graphify-out/.graphify-php-status.json` and is overridable with
|
|
149
|
+
`GRAPHIFY_PHP_STATUS`, so one machine can index many repositories without their builds sharing
|
|
150
|
+
a file.
|
|
151
|
+
|
|
152
|
+
## Routes
|
|
153
|
+
|
|
154
|
+
A second registered pass publishes what `#[Route]` attributes declare (Symfony), plus Laravel
|
|
155
|
+
and CodeIgniter 4 route files. Each declaration becomes one node and one `handled_by` edge to
|
|
156
|
+
the controller method that serves it. Access guards become `access_guard` nodes reached by
|
|
157
|
+
`guarded_by` and `checks_access` edges. The route schema, providers, guard rules and limits are
|
|
158
|
+
in [docs/routes.md](docs/routes.md).
|
|
159
|
+
|
|
160
|
+
## Verifying it works
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
PYTHONPATH=src python -m pytest tests/test_cli_end_to_end.py -q
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
That test generates a small PHP project in a temporary directory, runs graphify over it twice —
|
|
167
|
+
once plain, once with `register()` called first — and asserts the difference. On the generated
|
|
168
|
+
fixture the plain build produces **1** `calls` edge and the registered build **5**. It needs no
|
|
169
|
+
reference application and writes nothing outside `tmp_path`.
|
|
170
|
+
|
|
171
|
+
## Extending
|
|
172
|
+
|
|
173
|
+
Adding a third source — a language server, an LSIF index — means implementing one protocol,
|
|
174
|
+
`CallTargetSource` in `ports.py`, and adding it to the factory in `__init__.py`. `resolver.py`
|
|
175
|
+
depends on the protocols and nothing else, and does not change.
|
|
176
|
+
|
|
177
|
+
## CI
|
|
178
|
+
|
|
179
|
+
GitHub Actions runs three stages in order: **security** (gitleaks, trufflehog, pip-audit,
|
|
180
|
+
`php -l` over `php/`), **tests** (ruff lint and format check, pytest on Python 3.10–3.14) and
|
|
181
|
+
**build** (`python -m build`, then import and `graphify-php-build --help` from the installed
|
|
182
|
+
wheel). The same checks locally: `pip install -e ".[test,lint]"`, then `ruff check .`,
|
|
183
|
+
`ruff format --check .`, `python -m pytest`, and `for f in php/autoload.php php/src/CallGraph/*.php; do php -l "$f"; done`.
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
Apache-2.0.
|
|
@@ -38,6 +38,11 @@ title: Documentation
|
|
|
38
38
|
<strong>Architecture</strong>
|
|
39
39
|
<span>Understand the ports, source precedence, edge keys, and unresolved reasons.</span>
|
|
40
40
|
</a>
|
|
41
|
+
<a class="docs-card" href="routes.html">
|
|
42
|
+
<span class="docs-card-label">Reference</span>
|
|
43
|
+
<strong>Routes</strong>
|
|
44
|
+
<span>Look up route nodes, the Laravel and CodeIgniter providers, and access guards.</span>
|
|
45
|
+
</a>
|
|
41
46
|
<a class="docs-card" href="phpstan.html">
|
|
42
47
|
<span class="docs-card-label">Sources</span>
|
|
43
48
|
<strong>PHPStan source</strong>
|
|
@@ -1,155 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
PHP member-call resolution for [graphify](https://github.com/OxCom/graphify). It binds
|
|
4
|
-
`$this->emails->reminderSubmitWeek($user)` to the method node it actually calls, so a PHP graph
|
|
5
|
-
has a call graph instead of a list of names.
|
|
6
|
-
|
|
7
|
-
## The measurement
|
|
8
|
-
|
|
9
|
-
graphify ships cross-file member-call resolvers for Swift, Python, Ruby, TypeScript, C#, Java
|
|
10
|
-
and Rust, and none for PHP. Its PHP extractor marks `$obj->method()` as a member call and the
|
|
11
|
-
shared cross-file pass then drops it, because a bare `method` collides across the corpus and a
|
|
12
|
-
name-only match is not evidence.
|
|
13
|
-
|
|
14
|
-
On a reference Symfony application (584 PHP files, not shipped with this package), measured
|
|
15
|
-
from the published graph:
|
|
16
|
-
|
|
17
|
-
| | |
|
|
18
|
-
|---|---|
|
|
19
|
-
| PHP callable nodes | 3426 |
|
|
20
|
-
| `calls` edges in the whole graph | 2172 |
|
|
21
|
-
| PHP callables with an outgoing `calls` edge | 24.4 % |
|
|
22
|
-
| PHP callables with an incoming `calls` edge | 20.1 % |
|
|
23
|
-
|
|
24
|
-
Three quarters of the PHP callables in that graph are connected to nothing they call. Every
|
|
25
|
-
"what calls this", "what does this touch" and blast-radius question over PHP is answered from
|
|
26
|
-
that quarter.
|
|
27
|
-
|
|
28
|
-
## What it does
|
|
29
|
-
|
|
30
|
-
The pass runs inside graphify's build, after extraction:
|
|
31
|
-
|
|
32
|
-
1. collects every member call graphify left unresolved, from `per_file[*]["raw_calls"]`;
|
|
33
|
-
2. hands the sources the PHP files graphify parsed as the `corpus` they may read declarations
|
|
34
|
-
from. A leaf service class has nothing unresolved in it, so it never appears among the sites,
|
|
35
|
-
and a source indexing only those files cannot tell whether it declares the method being
|
|
36
|
-
called on it. The set is bounded by the build, never by a filesystem walk;
|
|
37
|
-
3. asks each configured **call target source** in precedence order for the receiver's class —
|
|
38
|
-
the precise source (a PHP type engine that already knows the project's types) first, the
|
|
39
|
-
tree-sitter parser second. A site the first source proves is never offered to the second, so
|
|
40
|
-
a weaker source can add reach but can never overwrite a stronger source's answer;
|
|
41
|
-
4. maps each `(class FQN, method)` to a graphify node id;
|
|
42
|
-
5. appends `calls` edges carrying the target's confidence (`EXTRACTED` when the type was read
|
|
43
|
-
from source, `INFERRED` when it was derived) and `_resolver: "graphify-php"`, which is how a
|
|
44
|
-
reader tells our edges from graphify's own and can drop them without a rebuild. `_via` names
|
|
45
|
-
the technique that proved each one (`tree_sitter:promoted-parameter`, `tree_sitter:self-scope`,
|
|
46
|
-
...).
|
|
47
|
-
|
|
48
|
-
The marker is not `_origin`: graphify overwrites that on every edge with `"ast"` after the
|
|
49
|
-
resolvers run (`extract.py:8285-8289`), where it means the eviction tier rather than the author.
|
|
50
|
-
|
|
51
|
-
### Scoped calls
|
|
52
|
-
|
|
53
|
-
`self::`, `parent::`, `static::` and `Class::method()` reach graphify with `is_member_call`
|
|
54
|
-
false and the **scope** as the callee — the method name is dropped
|
|
55
|
-
(`extractors/engine.py:6147-6152`). The resolver recovers it without parsing PHP: it asks the
|
|
56
|
-
graph which methods that class declares and offers each as a candidate, and the type source
|
|
57
|
-
refuses every name not actually written on that line. A class with ten methods costs ten
|
|
58
|
-
lookups and yields at most one edge.
|
|
59
|
-
|
|
60
|
-
`Class::method()` additionally already has a coarse `caller -> Class` edge, because graphify
|
|
61
|
-
resolves the scope name to the class node. Our method-level edge is a **second** edge between
|
|
62
|
-
different endpoints, so both are published. The narrow one carries `_refines` naming the coarse
|
|
63
|
-
one, so a consumer can collapse the pair instead of counting the call twice.
|
|
64
|
-
|
|
65
|
-
A source returns a target only when it can prove it. Chained calls, dynamic names, `static::`
|
|
66
|
-
and anything through `__call` are counted by reason, not guessed at: a wrong call edge is worse
|
|
67
|
-
than a missing one, and every counted reason is a line on the next version's work list.
|
|
68
|
-
|
|
69
|
-
## Install and register
|
|
70
|
-
|
|
71
|
-
graphify-php is not on PyPI. Install a clone in editable mode into graphify's own environment;
|
|
72
|
-
the PHPStan source needs the `php/` directory of the checkout, which the wheel does not ship:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
git clone https://github.com/OxCom/graphify-php.git ~/src/graphify-php
|
|
76
|
-
pipx inject --editable --include-apps graphifyy ~/src/graphify-php
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
The one runtime dependency is pyyaml. graphify and tree-sitter come from the environment that
|
|
80
|
-
runs the build; pinning them here would fight graphify's own pins. Virtual environments,
|
|
81
|
-
PHPStan, verification and troubleshooting: [docs/install.md](docs/install.md).
|
|
82
|
-
|
|
83
|
-
Registration is one call, made before graphify builds:
|
|
84
|
-
|
|
85
|
-
```python
|
|
86
|
-
import graphify_php
|
|
87
|
-
|
|
88
|
-
graphify_php.register()
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
It is idempotent and imports graphify lazily, so importing the package never requires graphify
|
|
92
|
-
to be installed.
|
|
93
|
-
|
|
94
|
-
## Run a build
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
graphify-php-build -- update .
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Everything after `--` is passed to graphify unchanged; options before it belong to the wrapper:
|
|
101
|
-
|
|
102
|
-
| Option | Meaning |
|
|
103
|
-
|---|---|
|
|
104
|
-
| `--graph PATH` | the graph artifact to protect (default `$GRAPHIFY_OUT/graph.json`) |
|
|
105
|
-
| `--expect RESOLVER` | a resolver that must report; repeatable, defaults to `php_member_calls` |
|
|
106
|
-
|
|
107
|
-
Exit codes:
|
|
108
|
-
|
|
109
|
-
| Code | Meaning |
|
|
110
|
-
|---|---|
|
|
111
|
-
| 0 | every expected resolver reported `completed` or `skipped` |
|
|
112
|
-
| 2 | an expected resolver reported `failed`, or never finished |
|
|
113
|
-
| 3 | an expected resolver never reported at all |
|
|
114
|
-
| other | graphify's own exit code, when graphify itself failed |
|
|
115
|
-
|
|
116
|
-
The wrapper sets `PYTHONHASHSEED=0` before calling graphify. graphify re-execs itself to pin
|
|
117
|
-
that seed for `update`, `extract`, `cluster-only` and `label` (`__main__.py:486-525`), and the
|
|
118
|
-
re-exec would replace the process — losing both the registration and the gate. Setting the seed
|
|
119
|
-
graphify would have set skips the re-exec and keeps its determinism guarantee.
|
|
120
|
-
|
|
121
|
-
## Why the wrapper exists
|
|
122
|
-
|
|
123
|
-
graphify runs registered resolvers like this:
|
|
124
|
-
|
|
125
|
-
```python
|
|
126
|
-
try:
|
|
127
|
-
resolver.resolve(per_file, all_nodes, all_edges)
|
|
128
|
-
except Exception as exc:
|
|
129
|
-
_LOG.warning("%s resolution failed, skipping: %s", resolver.name, exc)
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
A resolver that raises is skipped and the build still publishes. A resolver that was never
|
|
133
|
-
registered — because the seam moved in a graphify upgrade, or because an install left this
|
|
134
|
-
package out — is not even logged. Both produce a valid graph with fewer `calls` edges, which is
|
|
135
|
-
exactly the shape of the defect this package was written to fix. The failure would be invisible
|
|
136
|
-
at the one moment it matters, and the warning goes to graphify's logger, which nothing running
|
|
137
|
-
the build reads.
|
|
138
|
-
|
|
139
|
-
So each resolver writes its own record — state, and counters that include the denominator,
|
|
140
|
-
because "resolved 400 calls" says nothing without "out of how many" — and `graphify-php-build`
|
|
141
|
-
reads that record and refuses to publish when an expected resolver did not complete. On a
|
|
142
|
-
refusal the previous graph is restored and the exit code is non-zero.
|
|
143
|
-
|
|
144
|
-
`skipped` with a reason is a success: a repository with no PHP type engine in `vendor/` is a
|
|
145
|
-
normal skip, and conflating it with a failure is how a missing layer becomes noise. `failed`,
|
|
146
|
-
and silence, are not.
|
|
147
|
-
|
|
148
|
-
The record path defaults to `graphify-out/.graphify-php-status.json` and is overridable with
|
|
149
|
-
`GRAPHIFY_PHP_STATUS`, so one machine can index many repositories without their builds sharing
|
|
150
|
-
a file.
|
|
151
|
-
|
|
152
|
-
## Routes
|
|
1
|
+
# Routes
|
|
153
2
|
|
|
154
3
|
A second registered pass publishes what `#[Route]` attributes declare. Each declaration becomes
|
|
155
4
|
one node — labelled with the path template, carrying the route name, the HTTP methods and
|
|
@@ -209,7 +58,7 @@ when there is none):
|
|
|
209
58
|
exactly when a `handled_by` edge leaves the node. A node shared by several declarations is
|
|
210
59
|
`method` when any of them produced the edge.
|
|
211
60
|
|
|
212
|
-
|
|
61
|
+
## Laravel provider
|
|
213
62
|
|
|
214
63
|
The Laravel provider (`frameworks/laravel.py`) reads routes files loaded from
|
|
215
64
|
`bootstrap/app.php` `withRouting(web:, api:, apiPrefix:)`. Behaviour follows the framework source
|
|
@@ -272,7 +121,7 @@ Resource `create` and `edit` routes are refused when any file calls `resourceVer
|
|
|
272
121
|
Not covered: Laravel 10 `RouteServiceProvider`, Lumen, `Route::fallback`, invokable string
|
|
273
122
|
actions (`'App\Ctl'`), nested singletons, and `$this->middleware()` in a controller constructor.
|
|
274
123
|
|
|
275
|
-
|
|
124
|
+
## Laravel closure routes
|
|
276
125
|
|
|
277
126
|
A Laravel route whose action is a closure or arrow function (`Route::get('/', fn () => ...)`) is
|
|
278
127
|
published like an array action: path, methods, name, template and route-scope guards
|
|
@@ -282,7 +131,7 @@ still counted under `laravel-closure-action`. Its node key is
|
|
|
282
131
|
no method or class, so no method-scope or class-scope guard and no `checks_access` edge applies;
|
|
283
132
|
`authorization_state` comes from the route-scope guards alone.
|
|
284
133
|
|
|
285
|
-
|
|
134
|
+
## CodeIgniter 4 provider
|
|
286
135
|
|
|
287
136
|
The CodeIgniter provider (`frameworks/codeigniter.py`) is selected by a direct
|
|
288
137
|
`codeigniter4/framework` or `codeigniter4/codeigniter4` requirement. It reads the route files of
|
|
@@ -356,7 +205,7 @@ Not covered: auto-routed controllers, module `Config/Routes.php` files, Shield's
|
|
|
356
205
|
`$user->can()` grant calls (a typed receiver; follow-up), filter regex patterns beyond `*`,
|
|
357
206
|
Registrar-added globals, and `{locale}` rewriting.
|
|
358
207
|
|
|
359
|
-
|
|
208
|
+
## Access guards
|
|
360
209
|
|
|
361
210
|
Guards are `access_guard` nodes. Three relations reach them:
|
|
362
211
|
|
|
@@ -436,32 +285,3 @@ Limits:
|
|
|
436
285
|
Routing PHP and XML files and `src/Kernel.php` get a text check for `prefix` calls only.
|
|
437
286
|
- `checks_access` reads only direct `$this` calls in handler bodies. Closures, arrow functions,
|
|
438
287
|
anonymous classes and helper methods are not followed.
|
|
439
|
-
|
|
440
|
-
## Verifying it works
|
|
441
|
-
|
|
442
|
-
```bash
|
|
443
|
-
PYTHONPATH=src python -m pytest tests/test_cli_end_to_end.py -q
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
That test generates a small PHP project in a temporary directory, runs graphify over it twice —
|
|
447
|
-
once plain, once with `register()` called first — and asserts the difference. On the generated
|
|
448
|
-
fixture the plain build produces **1** `calls` edge and the registered build **5**. It needs no
|
|
449
|
-
reference application and writes nothing outside `tmp_path`.
|
|
450
|
-
|
|
451
|
-
## Extending
|
|
452
|
-
|
|
453
|
-
Adding a third source — a language server, an LSIF index — means implementing one protocol,
|
|
454
|
-
`CallTargetSource` in `ports.py`, and adding it to the factory in `__init__.py`. `resolver.py`
|
|
455
|
-
depends on the protocols and nothing else, and does not change.
|
|
456
|
-
|
|
457
|
-
## CI
|
|
458
|
-
|
|
459
|
-
GitHub Actions runs three stages in order: **security** (gitleaks, trufflehog, pip-audit,
|
|
460
|
-
`php -l` over `php/`), **tests** (ruff lint and format check, pytest on Python 3.10–3.14) and
|
|
461
|
-
**build** (`python -m build`, then import and `graphify-php-build --help` from the installed
|
|
462
|
-
wheel). The same checks locally: `pip install -e ".[test,lint]"`, then `ruff check .`,
|
|
463
|
-
`ruff format --check .`, `python -m pytest`, and `for f in php/autoload.php php/src/CallGraph/*.php; do php -l "$f"; done`.
|
|
464
|
-
|
|
465
|
-
## License
|
|
466
|
-
|
|
467
|
-
Apache-2.0.
|