Skip to content

Commit ebcddc7

Browse files
committed
Add execution order note to quick start guide for clarity on type hint evaluation
1 parent a9d7a30 commit ebcddc7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

docs/getting-started/quick-start.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ processUser(-5, 'Alice');
7474
// Throws: TypeError: processUser(): Argument $id must be of type positive-int, negative int (-5) given
7575
```
7676

77+
> **Execution Order Note:** Native PHP type hints (e.g., `int $id`, `string $username`) are evaluated by PHP's C-engine before function execution begins. TypePHP's extended DocBlock contracts (e.g., `positive-int`, `non-empty-string`) execute at function entry. If a native type hint fails, PHP throws its native `TypeError` before TypePHP guard rails execute.
78+
7779
---
7880

7981
## Return Contracts (`@return`)
@@ -224,3 +226,4 @@ namespace App\Legacy;
224226

225227
> **Technical Note & Coding Convention:**
226228
> Under the hood, TypePHP scans the raw file contents for `@typephp-ignore-file` before performing AST transformations, meaning the tag will function regardless of its position in the file. However, you should always place `@typephp-ignore-file` at the very top of the file (right after `<?php`) as a clean coding convention.
229+
```

0 commit comments

Comments
 (0)