> ## Documentation Index
> Fetch the complete documentation index at: https://differens.ossl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# PHP

> Semantic diffing for PHP

## PHP extractor

The PHP extractor maps tree-sitter PHP CST nodes to canonical concepts. Class, method, and function names come from the standard `name` field; property names come from the property element's `name` field, keeping the `$`.

### Detected concepts

| tree-sitter node type | Canonical concept |
| - | - |
| `class_declaration` | Class |
| `interface_declaration` | Interface |
| `trait_declaration` | Trait |
| `enum_declaration` | Enum |
| `method_declaration` | Method |
| `function_definition` | Function |
| `namespace_definition` | Namespace |
| `namespace_use_declaration` | Import |
| `property_declaration` | Variable |
| `formal_parameters` | Parameters |
| `function_call_expression` | CallExpression |
| `array_creation_expression` | ArrayLiteral |

### Example

Renaming a method:

```php theme={null}
<?php
// old.php
class Counter { function total($n) { return $n + 1; } }
```

```php theme={null}
<?php
// new.php
class Counter { function sum($n) { return $n + 1; } }
```

Running `differens old.php new.php`:

```
~ renamed method `total` to `sum` in class `Counter`
```

### Known limitations

* Heredoc and nowdoc bodies are string literals; changes inside them report as value changes, not line edits.
* Attribute syntax is parsed structurally; attribute argument edits report as value changes.
