|
| 1 | +Here is the updated `README.md` reflecting that the CLI binary automatically type-checks any specified script without needing to register it in `typephp.php`: |
| 2 | + |
| 3 | +```markdown |
1 | 4 | <h1 align="center">TypePHP</h1> |
2 | 5 |
|
3 | 6 | <p align="center"> |
@@ -76,23 +79,27 @@ Simply run your tests or use your local development server (**Laravel**, **Symfo |
76 | 79 |
|
77 | 80 | ## Executing Standalone Scripts (CLI Runner) |
78 | 81 |
|
79 | | -For standalone, single-execution PHP scripts that do not have an explicit autoloader entry point, run them directly with the TypePHP CLI binary: |
| 82 | +You can run any standalone PHP script directly with the TypePHP CLI binary: |
80 | 83 |
|
81 | 84 | ```bash |
82 | 85 | vendor/bin/typephp script.php |
83 | 86 | ``` |
84 | 87 |
|
| 88 | +Targeting a file directly with the CLI binary automatically type-checks that file—**even if it is not registered in `typephp.php` or falls outside your configured `include` paths**. |
| 89 | + |
| 90 | +Any secondary files required or included by your script will continue to respect your project's configured `include` and `exclude` paths. |
| 91 | + |
85 | 92 | --- |
86 | 93 |
|
87 | 94 | ## Type-Checking Files Anywhere (`"*"` Wildcard Glob) |
88 | 95 |
|
89 | | -By default, TypePHP checks standard application folders (`src/**`, `app/**`, `tests/**`). To type-check PHP files anywhere in your project root while still respecting your excluded folders, set the `"*"` wildcard glob in `typephp.php`: |
| 96 | +By default, TypePHP checks standard application folders (`src/**`, `app/**`, `tests/**`). To type-check PHP files anywhere in your project root during regular application runs while still respecting your excluded folders, set the `"*"` wildcard glob in `typephp.php`: |
90 | 97 |
|
91 | 98 | ```php |
92 | 99 | // typephp.php |
93 | 100 | return [ |
94 | 101 | 'include' => [ |
95 | | - '*', // Intercepts and type-checks PHP files anywhere in the project |
| 102 | + '*', |
96 | 103 | ], |
97 | 104 | 'exclude' => [ |
98 | 105 | 'vendor/**', |
@@ -167,14 +174,14 @@ Define generic templates and TypePHP tracks their state per object instance in m |
167 | 174 | class Collection |
168 | 175 | { |
169 | 176 | /** @param T $item */ |
170 | | - public function add(mixed $item): void { /* ... */ } |
| 177 | + public function add(mixed $item): void { } |
171 | 178 | } |
172 | 179 |
|
173 | 180 | // Prebind T = User to this specific instance in WeakMap memory |
174 | 181 | /** @var Collection<User> $users */ |
175 | 182 | $users = new Collection(); |
176 | 183 |
|
177 | | -$users->add(new User('Alice')); // Valid |
| 184 | +$users->add(new User('Alice')); |
178 | 185 |
|
179 | 186 | $users->add(new Product('SKU-100')); |
180 | 187 | // Throws TypeError: Argument $item (template T = User) must be of type User, Product given |
@@ -207,7 +214,7 @@ class DatabaseService |
207 | 214 |
|
208 | 215 | $service = new DatabaseService(); |
209 | 216 |
|
210 | | -$service->connect(['driver' => 'pdo_mysql']); // Valid |
| 217 | +$service->connect(['driver' => 'pdo_mysql']); |
211 | 218 |
|
212 | 219 | $service->connect(['driver' => 'pdo_invalid']); |
213 | 220 | // Throws TypeError: Argument $params['driver'] must be a key of DriverManager::DRIVER_MAP |
|
0 commit comments