You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,6 +110,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
110
110
111
111
-**A Laravel project that requires Larastan gets PHPStan diagnostics too.** PHPStan auto-detection looked only for a direct `phpstan/phpstan` dependency in `composer.json`, so a project that requires `larastan/larastan` and lets it pull `phpstan/phpstan` in transitively never had `vendor/bin/phpstan` recognised, even though the binary was right there. A Laravel project is now recognised through a direct dependency on `larastan/larastan`, or a fork of it such as `calebdw/larastan`, instead: plain PHPStan does not understand Eloquent magic, facades, or container bindings, so a Laravel project that depends on `phpstan/phpstan` directly but has not installed Larastan is still left alone rather than run through an analyser that would misread its own framework.
112
112
-**A project with its own `phpstan.neon` gets PHPStan diagnostics regardless of what `composer.json` declares.** PHPStan auto-detection depended entirely on a `composer.json` dependency, so a project that hand-authors a `phpstan.neon` or `phpstan.neon.dist` config, whether it depends on `phpstan/phpstan` transitively, installs a Larastan fork the dependency check does not otherwise certify, or wires PHPStan up some other way entirely, never had `vendor/bin/phpstan` recognised. A `phpstan.neon`/`phpstan.neon.dist` file at the workspace root is now itself enough to certify PHPStan on a project, including a Laravel one that has not installed Larastan.
113
+
-**A project with its own `phpcs.xml` gets phpcbf as its formatter, even when `squizlabs/php_codesniffer` is only a transitive dependency.** Formatter auto-detection looked only for a direct `squizlabs/php_codesniffer` entry in `require-dev`, so a project that instead depends on a rules package like `slevomat/coding-standard` or `cakephp/cakephp-codesniffer`, which pull PHP_CodeSniffer in transitively, never had `vendor/bin/phpcbf` recognised even though the binary was right there. A `phpcs.xml`, `.phpcs.xml`, `phpcs.xml.dist`, or `.phpcs.xml.dist` file at the workspace root now certifies phpcbf on its own. Closes #374.
113
114
-**A custom Eloquent builder keeps the model it was built for.**`SiteCertificate::query()->whereKey($id)->firstOrFail()` resolved to the base `Model`, or reported `subject type 'TModel' could not be resolved`, whenever the model routed its queries through a custom builder. PHP has no generics, so almost nobody writes `@template`/`@extends` on a builder subclass: `class SiteCertificateBuilder extends Builder {}` is the whole class, and the model was lost at whichever method on the chain returns it. The model the query was started from now travels through the builder to the end of the chain, so the result of `firstOrFail()`, `first()`, `get()`, and the rest completes, hovers, and is checked as the concrete model, whether the builder is declared with generics or without. A builder specialised this way also keeps everything the ordinary resolution gives it, including the query-builder methods it reaches through `@mixin`. Closes #362.
114
115
-**`array_filter()` reports the type the filter leaves behind.** A callback that tests the value it is handed proves something about every entry that survives, but the result kept whatever element type went in, so `array_filter($values, fn ($v) => $v !== null)` still looked like it could hold `null` and returning it from a function declared `int[]` was reported as a type error. The surviving values are now narrowed the way the body of an `if` narrows the variable it guards, whether the test is written as an `is_…()` call, a comparison against `null`, an `instanceof` check, or a callable string such as `'is_int'`. The keys were already narrowed this way in the modes that hand the callback a key, and both halves narrow together under `ARRAY_FILTER_USE_BOTH`. Closes #376.
115
116
-**A deprecation warning belongs to the variable it is written on.** The deprecated-usage check typed its subject from a cache keyed by variable name and class, so two methods of the same class that reuse a parameter name shared one entry and whichever type was bound first won. A Laravel controller with a `Request $request` method above a `PendingRequest $request` method reported `Illuminate\Http\Request::get is deprecated` on the HTTP client call, where `get()` is the ordinary way to make a request, and renaming either parameter made the warning vanish. Every subject is now typed in the scope it is written in, so each method, closure, and `instanceof` branch gets its own answer, and a genuine deprecation is still reported no matter which order the methods appear in.
Copy file name to clipboardExpand all lines: docs/configuration.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,7 +143,7 @@ The file is optional. Unknown keys are silently ignored, so the file is forward-
143
143
PHPantom ships a built-in PHP formatter (mago-formatter) that works out of the box, so `textDocument/formatting` requests are answered without any setup. The formatter is chosen per project in this order:
144
144
145
145
1.**Explicit config wins.** A tool path set under `[formatting]` in `.phpantom.toml` (`pint`, `php-cs-fixer`, or `phpcbf`) is always used. Setting a tool to `""` disables it.
146
-
2.**Composer `require-dev` wins over the built-in formatter.** If `composer.json` lists `laravel/pint`, `friendsofphp/php-cs-fixer`, or `squizlabs/php_codesniffer` in `require-dev`, PHPantom resolves the binary through Composer's bin-dir and runs it as a subprocess. These tools discover their own project config (`pint.json`, `.php-cs-fixer.php`, `.phpcs.xml`, etc.) as they normally would.
146
+
2.**Composer `require-dev` wins over the built-in formatter.** If `composer.json` lists `laravel/pint`, `friendsofphp/php-cs-fixer`, or `squizlabs/php_codesniffer` in `require-dev`, PHPantom resolves the binary through Composer's bin-dir and runs it as a subprocess. A `phpcs.xml`, `.phpcs.xml`, `phpcs.xml.dist`, or `.phpcs.xml.dist` file at the workspace root certifies phpcbf the same way, so a project that only pulls `squizlabs/php_codesniffer` in transitively (e.g. through `slevomat/coding-standard`) is still detected. These tools discover their own project config (`pint.json`, `.php-cs-fixer.php`, `.phpcs.xml`, etc.) as they normally would.
147
147
3.**Otherwise, the built-in formatter is used.**
148
148
149
149
The built-in formatter defaults to the PER-CS 2.0 style. If a `mago.toml` is present at the workspace root, its `[formatter]` table is honoured instead, so PHPantom formats with the same preset and settings your project already uses with the Mago CLI:
0 commit comments