# Pinstripe: everything in one file > Pinstripe is the code style for the Wayne State app stack: shared presets for Pint, PHPStan with Larastan, Rector, ESLint and Prettier. Your app runs them locally, and Preflight runs them in CI. The README and the Markdown twin of every page, joined. The index is https://pinstripe.apps.wayne.edu/llms.txt. Written by Squire's agent-ready kit; do not edit. --- ## README Source: https://github.com/waynestate/pinstripe/blob/HEAD/README.md ## Pinstripe **Sharp code. Every line.** The coding standard for the Wayne State app stack: shared presets for Pint, PHPStan (with Larastan for Laravel), Rector, and ESLint with Prettier. Your app points at them and adds only its own exceptions. Pinstripe is to code what a good suit is to a job interview: nobody notices it, everybody notices when it's missing. **Not to be confused with:** Pinstripe is the code style settings you run locally; Preflight runs them, and PROCTOR, in CI. Pinstripe's Rector set modernises code within the app's current PHP version, while Booster upgrades the app to a newer PHP version. Checks: `composer ci` (the same command CI runs on git.wayne.edu). No local PHP? This runs the same checks in Docker, on Windows (PowerShell), macOS and Linux alike: the suit arrives pre-pressed. ```sh docker run --rm -v "${PWD}:/app" -w /app composer:2.11.1@sha256:8de2184c6de224f4689e8f80ed5f5edaf0030b6b8b7839a22a2bcb6722ac87d0 sh -c "composer install --no-interaction && composer ci" ``` Documentation: the docs site is at [`site/docs/index.html`](https://github.com/waynestate/pinstripe/blob/HEAD/site/docs/index.html), built from `docs/` by Squire's shared builder and kept current by `composer ci`. The pages wear the front page's look through `docs/_header.html` and `docs/theme/pinstripe.css`: edit those two files, never the vendored kit. ### Where the code lives The canonical repository is [enterprise-apps/pinstripe](https://git.wayne.edu/enterprise-apps/pinstripe) on git.wayne.edu: clone over SSH (`git@git.wayne.edu:enterprise-apps/pinstripe.git`) or HTTPS (`https://git.wayne.edu/enterprise-apps/pinstripe.git`). Open issues and merge requests there, and tags are made there, by the maintainer, with an approver. GitHub ([waynestate/pinstripe](https://github.com/waynestate/pinstripe)) is a read-only push mirror of it, for the published packages only: nobody pushes to it, and Packagist and npm read from it. The pinstripes are sewn on git.wayne.edu; the GitHub mirror is the off-the-rack copy. Front page: [`site/index.html`](https://github.com/waynestate/pinstripe/blob/HEAD/site/index.html), a static tailor's shop you can open in a browser or serve from `site/`. On Citadel it is served by the raw-PHP deploy layer in [`deploy/`](https://github.com/waynestate/pinstripe/blob/HEAD/deploy/): a Squire kit whose front controller serves `site/` behind HELMET's security headers. For local development, keep serving `site/` directly. ### Use it in a raw PHP app Add Pinstripe as a dev dependency: ``` composer config allow-plugins.phpstan/extension-installer true composer require --dev waynestate/pinstripe:^0.4 ``` Pinstripe loads its PHPStan rules through `phpstan/extension-installer`, and Composer will not ask when it cannot prompt. If Composer stops because a package your app already locks (often an older PHPStan) does not fit, run the same `composer require` again with `-W`, as Composer suggests, so it may update that package too. `^0.4` gets you 0.4.0, the current release, with every [banned call](#banned-calls) below. Packagist reads the GitHub mirror, which can trail a release by a while. If Composer says it cannot find a 0.4 version, point it at the canonical repository first (it asks for your git.wayne.edu sign-in), then run the `composer require` again: ``` composer config repositories.pinstripe vcs https://git.wayne.edu/enterprise-apps/pinstripe.git ``` The npm package, `@waynestate/pinstripe`, is published by hand after each tag; `npm view @waynestate/pinstripe version` shows where it is. The ESLint and Prettier presets have not changed since 0.1.4, so any version from 0.1.4 up is today's cut. Point PHPStan at the raw config. `phpstan.neon`: ```neon includes: - vendor/waynestate/pinstripe/phpstan/raw.neon parameters: paths: - app ``` Add Composer scripts that run on every OS: ```json { "scripts": { "lint": "pint --test --config vendor/waynestate/pinstripe/pint/per.json", "fix": "pint --config vendor/waynestate/pinstripe/pint/per.json", "analyse": "phpstan analyse" } } ``` #### Show Pint findings in the merge request Add a second script that writes the report to a file: ```json { "scripts": { "lint:gitlab": "pint --test --config vendor/waynestate/pinstripe/pint/per.json --format=gitlab > pint-codequality.json" } } ``` Point GitLab at the artifact, and keep it when the job fails, which is exactly when it has something to show: ```yaml artifacts: when: always reports: codequality: pint-codequality.json ``` `--format=gitlab` writes GitLab's Code Quality JSON and `[]` when the code is clean, and Pinstripe tests both. Chalk marks wash out; these findings stay pinned to the merge request. #### Show PHPStan findings in the merge request PHPStan writes the same report with its own `gitlab` error format: ```json { "scripts": { "analyse:gitlab": "phpstan analyse --no-progress --error-format=gitlab > phpstan-codequality.json" } } ``` ```yaml artifacts: when: always reports: codequality: phpstan-codequality.json ``` Each finding carries its identifier (`pinstripe.banned.joinedSql`, `argument.type`) as the check name. Pinstripe tests both sides: the raw preset turns the null bug fixture into a non-empty report and the clean fixture into `[]`. A fitting note, pinned where the reviewer is already looking. `composer lint` fails on style. `composer fix` fixes it. Pint's `per` preset is the PER Coding Style, and `tests/fixtures/per` keeps a clean and a messy proof. `composer analyse` runs PHPStan at level 8, with deprecation checks too. Pinstripe ships `phpstan/phpstan-deprecation-rules`, loaded automatically by `phpstan/extension-installer`. Calling a `@deprecated` method fails the build. The tailor flags the old cut before the fabric is retired. ### Require strict types Opt-in. Point `composer lint` and `composer fix` at the strict preset instead of `per.json`: ```json { "scripts": { "lint": "pint --test --config vendor/waynestate/pinstripe/pint/per-strict.json", "fix": "pint --config vendor/waynestate/pinstripe/pint/per-strict.json" } } ``` `composer fix` adds `declare(strict_types=1);` to every file it touches, so run your tests first and commit the change on its own. Strict types leave no loose threads. #### The careful route on a big app A file that passes `'3'` to an `int` parameter works today and throws a `TypeError` the day it turns strict. On an old app, let Rector declare strict types only where nothing changes: `rector/strict-types.php` runs Rector's `SafeDeclareStrictTypesRector` and nothing else, so it skips every file whose calls, returns or property assignments lean on PHP's type juggling. Keep it in a config of its own, so the diff is only declarations: ```php withPaths([__DIR__ . '/src']); ``` `vendor/bin/rector process --dry-run -c rector-strict-types.php` lists the files that are ready, and the same command without `--dry-run` declares them. Run it again after other fixes add types, and the list grows. Switch `composer lint` to `per-strict.json` once every file is declared, so new files cannot slip in without it. Proven on fixtures: the preset must declare `tests/fixtures/rector-strict-types/src/Measure.php` and leave `Hem.php`, which passes a string to `str_repeat()`, alone. Measure twice, declare once. ### Use it in a Laravel app Same, with the Laravel parts: ``` composer config allow-plugins.phpstan/extension-installer true composer require --dev waynestate/pinstripe:^0.4 larastan/larastan ``` Pinstripe loads its PHPStan rules through `phpstan/extension-installer`, and Composer will not ask when it cannot prompt. If Composer stops because a package your app already locks (often an older PHPStan) does not fit, run the same `composer require` again with `-W`, as Composer suggests, so it may update that package too. Pinstripe pulls in `phpstan/extension-installer`, which registers Larastan for you. When Composer asks, allow the plugin (`config.allow-plugins` in your `composer.json`). Your `phpstan.neon` includes `vendor/waynestate/pinstripe/phpstan/laravel.neon` and nothing else: there is no Larastan line to add, and the scripts point at `vendor/waynestate/pinstripe/pint/laravel.json`. The Laravel preset also rejects `env()` outside `config/`: once the config is cached, `env()` returns null, so read config with `config()` instead. The rule is Larastan's, and `phpstan/laravel.neon` pins it on. The environment is not a hand-me-down: take the config out of the wardrobe. Proven on Laravel: `composer ci` lints a minimal Laravel 13 app (`tests/fixtures/laravel-app`) with `pint/laravel.json` and analyzes it with `phpstan/laravel.neon` on every run, and fails if the app stops passing. A smaller fixture (`tests/fixtures/laravel`) proves the preset really loads Larastan: it plants an undefined Eloquent property that only Larastan reports, and a clean twin it leaves alone. The combined fixture `tests/fixtures/laravel-vue` is one app tree with both PHP and Vue files, with `resources/js` beside `app/`. `composer ci` lints its PHP side with Pint and PHPStan, and `npm test` lints its Vue side with ESLint and Prettier, on every run, with one planted PHP error and two planted Vue defects that each preset must report. `tests/fixtures/raw-vue` is the same proof for a plain PHP app with a Vue front end and no Laravel, with one planted PHP error for the raw preset and the same two planted Vue defects. `tests/fixtures/laravel-inertia` is the same proof for WELD's shape, Laravel with Inertia and Vue: an Inertia controller and a page under `resources/js/Pages`, with the same planted PHP error and Vue defects. ### Use it for Vue Add Pinstripe as a dev dependency: ``` npm install --save-dev @waynestate/pinstripe eslint prettier ``` Create `eslint.config.js` and spread the preset. For TypeScript: ```js import pinstripe from '@waynestate/pinstripe/eslint/typescript' export default [...pinstripe] ``` For plain JavaScript, import `@waynestate/pinstripe/eslint/javascript` instead. The TypeScript preset lints with types (typescript-eslint's `recommendedTypeChecked`, through `projectService`), so it catches what the syntax alone cannot, such as a promise nobody awaits: `save()` called without `await` fails lint with `@typescript-eslint/no-floating-promises`, in a `.ts` file and in a `.vue` file alike. It reads the app's `tsconfig.json`, so that file must include the `.ts` and `.vue` files you lint. Typed linting is slower than syntax linting, so run it in CI rather than on every save. Proven on fixtures: `tests/js/typed` holds a clean `.ts` file that must pass and a floating promise in `.ts` and in `.vue` that must each fail (`npm test`). Point Prettier at the preset in `package.json`: ```json { "prettier": "@waynestate/pinstripe/prettier" } ``` Add scripts that run on every OS: ```json { "scripts": { "lint": "eslint .", "format": "prettier --write ." } } ``` `npm run lint` fails on style and accessibility, and on every Vue and accessibility finding: where the plugins' recommended configs report a rule as a warning, Pinstripe reports it as an error, so the editor, a local run and CI all agree on what fails. `npm run format` fixes the layout. The preset is the off-the-rack suit: it fits every app, and you only add your own cufflinks. If an app adopts Oxlint for speed, ESLint stays in the toolchain for `.vue` files, because Pinstripe's Vue and accessibility rules (eslint-plugin-vue and eslint-plugin-vuejs-accessibility) run only in ESLint. Page components under `Pages/` or `pages/` (Inertia) may have one-word names such as `Index`; everywhere else `vue/multi-word-component-names` still applies. #### Adopt gradually with the -warn presets An app that cannot fix every finding in one cut keeps the old behavior with the `-warn` twin of the preset: the same rules with the plugins' original severities, so findings that were warnings stay warnings. ```js import pinstripe from '@waynestate/pinstripe/eslint/javascript-warn' export default [...pinstripe] ``` For TypeScript, import `@waynestate/pinstripe/eslint/typescript-warn` instead. Once the codebase is clean, switch the import back to the strict preset, and every Vue and accessibility finding fails lint. #### Show ESLint findings in the merge request Add a second script that uses the gitlab formatter: ```json { "scripts": { "lint:gitlab": "eslint . --format gitlab" } } ``` Point GitLab at the artifact, and keep it when the job fails: ```yaml artifacts: when: always reports: codequality: gl-codequality.json ``` `--format gitlab` comes from `eslint-formatter-gitlab`, a dependency of Pinstripe, so it resolves from the app's own `node_modules` without anything extra to install. In GitLab CI the formatter reads the job's predefined variables: `CI_JOB_NAME` picks the job, `CI_PROJECT_DIR` keeps the report's paths relative to the project root, and the report path itself is read from that job's `artifacts: reports: codequality:` line in the CI config. When the config lives somewhere else (`CI_CONFIG_PATH` is empty or a URL), set `ESLINT_CODE_QUALITY_REPORT` to name the file instead. Pinstripe tests the formatter end to end: the bad Vue fixture becomes a non-empty Code Quality report. The chalk marks move into the merge request. ### Format Blade views Pinstripe's Prettier preset formats Blade templates too. It loads `prettier-plugin-blade`, a third-party Prettier plugin that Pinstripe depends on and pins to an exact version (3.3.3 today), so the Blade rules travel with the preset and cannot drift. An app that points Prettier at the preset gets Blade formatting with no extra install: Prettier resolves the `plugins` entry relative to the config file's package, and the plugin is a dependency of `@waynestate/pinstripe`, so the bare name resolves from any app that extends this config. The preset adds an override for `*.blade.php` that sets the `blade` parser and a 4-space tab width. The first time you run Prettier over an app, every Blade file changes once: the indent becomes 4 spaces, a space goes after directive names (`@vite (` instead of `@vite(`), and void tags self-close (`` becomes ``). That is a one-time reformat, not a recurring change. To reformat an existing app's views in one go: ``` npx prettier --write "resources/views/**/*.blade.php" ``` #### Adopting Do the reformat as its own commit, with nothing else in it, so the churn is easy to review and easy to back out. Then list that commit's hash in `.git-blame-ignore-revs` so `git blame` skips the reformat and stays useful: ``` # .git-blame-ignore-revs # One hash per line; blank lines and # comments are ignored. a1b2c3d4e5f60718293a4b5c6d7e8f9012345678 ``` and tell git to read it: ``` git config blame.ignoreRevsFile .git-blame-ignore-revs ``` With that in place, blame points at the person who last changed a line's meaning, not at the reformat. ### Use it for Rector Rector modernises code for the PHP version your app already supports. Add it as a dev dependency: ``` composer require --dev rector/rector ``` Create `rector.php` and use the Pinstripe preset, adding only your own paths: ```php withPaths([__DIR__ . '/src']); ``` The preset reads the PHP floor from your app's own `composer.json`, so it cannot drift out of step with the version the app actually runs on. Check with `vendor/bin/rector process --dry-run` and apply with `vendor/bin/rector process`. CREED's PHP floor reaches your app through PROCTOR: its `php-floor` check fails an app whose `require.php` still allows an end-of-life PHP, Booster moves the constraint, and Rector and PHPStan follow with no edit to the preset. The preset also turns on Rector's composer-based Laravel sets (`withComposerBased(laravel: true)`). Add `driftingly/rector-laravel` as a dev dependency and it applies the Laravel upgrade rules that match your app's installed `laravel/framework` version; without it the call is a no-op, so an app that does not want Laravel rules sees no change. Proven on fixtures: `composer ci` runs the preset against a modern app (`tests/fixtures/rector-clean`) and an old-style one (`tests/fixtures/rector-old`) on every run, and fails if the clean one changes or the old one is left alone. Rector is the tailor's press: it smooths old code to the standard without changing the cut. #### One level at a time, on a big old app On an app that has never met Rector, the base preset's four whole sets make one diff nobody can review. The opt-in `rector/levels.php` returns a function instead: name a rule family and how far up it goes, and Rector applies only that family's first rules, safest first. ```php withPaths([__DIR__ . '/src']); ``` The families are `deadCode`, `typeCoverage`, `codeQuality` and `php` (the PHP-version rules, still capped at your `require.php`), and each one stays off until you name it. Level 0 is the first rule, not "off". Dry-run, review, apply, commit, then raise the number by one in the next merge request; when every family runs whole, switch to `rector/base.php`. Three fixture configs in `tests/fixtures/rector-levels` prove that level 0 makes only the first change, level 2 adds the next ones, and one family never applies another's rules. A suit is altered one fitting at a time. ### Banned calls Every cut (raw, Laravel and strict) fails the build on a short list of calls no Wayne State app should ship. The list is `phpstan/disallowed.neon`, included from `base.neon`, and the rules are [spaze/phpstan-disallowed-calls](https://github.com/spaze/phpstan-disallowed-calls), which Pinstripe requires and the extension installer loads, so your `phpstan.neon` needs no new line. A `dd()` left in after debugging now turns the pipeline red, the same as any other PHPStan error. | Call | Why it is banned | Use instead | OWASP Top 10:2025 | ASVS 5.0 | |---|---|---|---|---| | `eval()` | Runs a string as PHP, so one untrusted value is remote code execution. | Write the code out, or pick a callable with `match`. | A05 Injection | V1.3.2 | | `extract()` | Turns array keys into variables, so request data can overwrite any variable in scope. | Read the keys you need by name, or destructure the array. | A05 Injection | V15.3.3 (closest: mass assignment) | | `var_dump()` | Debug output left in ships paths, config and secrets to the browser. | A PSR-3 logger (`Log::debug()` in Laravel), or Xdebug. | A02 Security Misconfiguration | V13.4.2 | | `dd()` | Dumps internals to the browser and halts the request in production. | The same. | A02 Security Misconfiguration | V13.4.2 | | `dump()` | The same leak as `var_dump()`, Symfony and Laravel flavored. | The same. | A02 Security Misconfiguration | V13.4.2 | | Laravel's `->dd()` and `->dump()` methods | The same leaks, called on a collection, query, request or HTTP response (`$users->dd()`, `->dumpRawSql()`, `Http::get($url)->dd()`). | The same. | A02 Security Misconfiguration | V13.4.2 | | `withoutVerifying()` | Turns off TLS certificate checks in Laravel's HTTP client (`PendingRequest`), so anyone on the path can read or change the traffic. | Keep verification on; for a private CA, pass its bundle through `withOptions` and the `verify` option. | A02 Security Misconfiguration | V12.3.2 | | `'verify' => false` | The same hole through Guzzle's `verify` option: Laravel's `withOptions()`, `new Client([...])`, and the options of `request()`, `send()`, `get()`, `post()` and the other verbs. | Set `verify` to the path of the CA bundle, or leave it out. | A02 Security Misconfiguration | V12.3.2 | | `curl_setopt()` and `curl_setopt_array()` with `CURLOPT_SSL_VERIFYPEER` false or `CURLOPT_SSL_VERIFYHOST` 0 | Turns off curl's certificate or host name check in raw PHP. | Keep both on; for a private CA, point `CURLOPT_CAINFO` at its bundle. | A02 Security Misconfiguration | V12.3.2 | | `stream_context_create()` with `ssl` `verify_peer` or `verify_peer_name` false, or `allow_self_signed` true | Turns off the same checks for `file_get_contents()` and the other stream functions. | Keep them on; for a private CA, set the `ssl` `cafile` option. | A02 Security Misconfiguration | V12.3.2 | | SQL joined from strings: `PDO::query()`, `prepare()` and `exec()`, mysqli (`query()`, `prepare()`, `mysqli_query()` and the rest), `oci_parse()` and its old alias `ociparse()`, and Laravel's `DB::select()`, `insert()`, `update()`, `delete()`, `statement()`, `scalar()`, `cursor()` and `fromQuery()` | A variable joined into the SQL (`'... id = ' . $id`, `"... {$id}"`, `sprintf()`) lets one untrusted value rewrite the query. | Keep the SQL a literal and bind every value (`?` or `:name` placeholders, `oci_bind_by_name()`). | A05 Injection | V1.2.4 | The ASVS column names the requirement each ban enforces in [OWASP ASVS 5.0.0](https://github.com/OWASP/ASVS/tree/v5.0.0/5.0/en). ASVS has no requirement for `extract()` by name; mass assignment (V15.3.3) is the closest. Each ban has a stable identifier: `pinstripe.banned.eval`, `pinstripe.banned.extract`, `pinstripe.banned.varDump`, `pinstripe.banned.dd`, `pinstripe.banned.dump`, `pinstripe.banned.withoutVerifying`, `pinstripe.banned.verifyFalse`, `pinstripe.banned.curlVerifyOff`, `pinstripe.banned.streamVerifyOff` and `pinstripe.banned.joinedSql`. The SQL ban stands on PHPStan's own `literal-string` type: literal pieces joined together, a class constant, a literal `.=` on a literal, and placeholders built with `implode()` from literals all stay literal and pass, while anything with a variable in it does not (an `int` too: bind it). Laravel already types `DB::raw()`, `DB::unprepared()` and the query builder's `whereRaw()`, `selectRaw()`, `orderByRaw()` and other raw methods as `literal-string`, so PHPStan reports a joined string there by itself (`argument.type`); Pinstripe covers the connection calls Laravel leaves as plain `string`. SQL that is safe but not literal (read from a `.sql` file, or a helper's return value) can say so: type the helper `@return literal-string`, or keep the call with a reasoned ignore. Apps that keep their queries in `.sql` files clear every report with one typed reader; the [Banned calls](https://pinstripe.apps.wayne.edu/docs/reference/banned-calls.html#sql-kept-in-sql-files) page has it. A wrapper that takes the whole SQL as a plain `string` is reported once, inside, and never at its callers, so type its parameter `literal-string` and PHPStan checks each caller; never baseline a wrapper. The PDO and mysqli methods are matched by the connection's type, so a connection PHPStan cannot type (a `global $db` from an old include) hides every joined query made on it: name the type (`/** @var \PDO $db */`, or better a typed property) and they are reported. Postgres's `pg_query()` is not covered, since its connection argument is optional and the SQL has no fixed position. Only the off switch is banned. Setting `CURLOPT_SSL_VERIFYPEER` to true, `verify` to a CA bundle, or `false` on an option that has nothing to do with TLS passes. The `curl_setopt()` ban is the one Pinstripe writes itself (`src/PHPStan/CurlVerifyOffRule.php`), because it needs the option and the value together, which spaze/phpstan-disallowed-calls cannot match; it reads and links like the others. Laravel's methods share the functions' identifiers: `dd()`, `ddRawSql()`, `ddHeaders()`, `ddBody()`, `ddJson()` and `ddSession()` report as `pinstripe.banned.dd`, and `dump()`, `dumpRawSql()`, `dumpHeaders()` and `dumpSession()` as `pinstripe.banned.dump`. Only methods Laravel itself declares are caught, so your own `dump()` method is fine, and so is the schema dump behind `php artisan schema:dump`. The `withoutVerifying()` ban catches both `Http::withoutVerifying()` and the method partway down a chain such as `Http::acceptJson()->withoutVerifying()`. Each message ends with its OWASP tag and carries a link to the [Banned calls](https://pinstripe.apps.wayne.edu/docs/reference/banned-calls.html) page. **Keeping one on purpose.** Use the ban's identifier and say why, as with any other ignore: ```php // @phpstan-ignore pinstripe.banned.varDump (CLI-only diagnostics; output goes to the operator's terminal) var_dump($report); ``` Fix the ones an existing app already has rather than baselining them: each is usually one line, and a baseline would hide the next one too. Joined SQL is the one an older app may have dozens of: bind what you can, and `pinstripe-baseline` can hold the rest while they come out (a baseline only shrinks, so no new one gets in). **Adding your own.** List more bans under the same parameters (`disallowedFunctionCalls`, `disallowedMethodCalls`, `disallowedStaticCalls`) in your app's `phpstan.neon`. NEON appends lists, so yours join Pinstripe's. **Not covered yet.** An off switch PHPStan cannot pin to a value: `'verify' => $verify`, or a curl option read from config. Those pass, so keep the value a literal where you can. Proven on fixtures: `tests/fixtures/raw-disallowed` makes each banned call once and must be reported for each, by identifier and with its OWASP tag, in both the raw and strict cuts; its clean twin defines methods named `dump()` and `dd()` and must stay green; `tests/fixtures/laravel/src/LeftoverDebugMethods.php` leaves seven of Laravel's `dd()` and `dump()` methods in and must be reported for each, while its twin `SchemaDump.php` stays green; `tests/fixtures/laravel/src/InsecureHttp.php` turns TLS checks off both ways; `InsecureTransport.php` (raw curl and streams, eight ways) and `VerifyFalse.php` (Laravel and Guzzle, five ways) must be reported for each, while their twins `SecureTransport.php` and `VerifiedHttp.php` stay green; `JoinedSql.php` (PDO, mysqli and oci8, nine ways) and `JoinedQueries.php` (Laravel, six of Pinstripe's and three of Laravel's own) must be reported for each, while `BoundSql.php` and `BoundQueries.php` bind their values and stay green; `SqlFiles.php` reads its SQL from `.sql` files through a typed reader and wrapper and stays green, while `JoinedThroughAWrapper.php` must be reported at each joined caller; `UntypedConnection.php` must pass a joined query on an untyped `global` connection and report the same query once the connection is typed; and the Laravel app fixture installs Pinstripe through Composer and must fail on a leftover `dd()` and on curl told to skip the certificate check, which proves the curl rule loads from `vendor/`. A suit with a `dd()` in the pocket does not leave the shop. #### Not banned yet `md5()`, `sha1()`, `rand()` and `mt_rand()` are weak for passwords, tokens and signatures, but they are fine for cache keys, checksums and other non-security uses, and apps across the fleet use them that way. Whether Pinstripe bans them (and how it would allow the safe uses) is an open call, so for now they pass. ### The strict cut New apps can include `vendor/waynestate/pinstripe/phpstan/strict.neon` instead of `raw.neon` or `laravel.neon`. It keeps the base cut and turns on `phpstan/phpstan-strict-rules`, so loose comparisons like `==` fail the build. Existing apps stay on the base cut and baseline their way over. PHPStan checks phpdoc method signatures from level 3 up, and `phpstan/phpstan-strict-rules` forces the two switches behind them on for every run it is installed for. The base cut pins `reportMaybesInMethodSignatures` and `reportStaticMethodSignatures` off so it stays exactly as documented; the strict cut keeps them on, so it also reports maybe-mismatched overrides and static method overrides. `phpstan/phpstan-strict-rules` forces eight more switches on for every run as well. Each one is decided below: low noise and real bugs stay on in every cut, noisy ones are pinned off in the base cut and turned on only in `strict.neon`. | Parameter | Raw and Laravel cuts | Strict cut | Why | |---|---|---|---| | `checkExplicitMixedMissingReturn` | on | on | A function declared to return `mixed` that can fall off the end is a real bug, and rare in practice. | | `checkFunctionNameCase` | on | on | A wrongly cased function name works on Windows and macOS and breaks on Linux. | | `checkInternalClassCaseSensitivity` | on | on | The same case bug for PHP's own classes. | | `checkStrictPrintfPlaceholderTypes` | on | on | `%d` fed a string is a real formatting bug, and rare. | | `checkDynamicProperties` | off | on | Floods legacy code with undeclared properties. | | `reportMaybesInPropertyPhpDocTypes` | off | on | Reports "maybe" phpdoc mismatches that legacy docblocks trip constantly. | | `reportWrongPhpDocTypeInVarTag` | off | on | Old `@var` tags are often loose; fixing them is cleanup, not bug hunting. | | `reportNonIntStringArrayKey` | off | on | Bleeding-edge check that is noisy on loosely keyed arrays. | Strict is the tailor's chalk line drawn before the first stitch. ### Adopting on an existing app Generate a baseline with `phpstan analyse --generate-baseline`, include it in your `phpstan.neon`, and only ever shrink it. New code gets no baseline. A baseline is a tailor's chalk line: it marks the fabric as it is, and every release you take it in, never let it out. Some errors cannot go into a baseline (PHPStan says so, and the run stays red): fix how PHPStan finds that code first. When the app bundles a third-party library, point Pint at your own folders instead of the whole app. The [Proof](https://pinstripe.apps.wayne.edu/docs/reference/proof.html) page shows both on 82 Wayne State apps. #### Ignore comments must say why Every cut sets `reportIgnoresWithoutComments` and `reportUnmatchedIgnoredErrors`, so the preset reports an `@phpstan-ignore` that has no comment in parentheses and one whose identifier no longer matches an error on that line. The correct form keeps the reason and the exit plan on the same line: ```php public function name(?string $v): string { // @phpstan-ignore return.type (why this is safe, and the plan to remove it) return $v; } ``` Pinstripe tests all three cases: the bare ignore fails, the unmatched ignore fails, and the commented one passes. An ignore without a reason is a pin left in the cushion: nobody remembers why it was there, and it pokes the next tailor. ### Baselines only shrink Pinstripe ships `pinstripe-baseline`, one PHP command that runs on every OS, to keep that promise. It reads both the NEON baseline and the PHP format (`phpstan-baseline.php`). A baseline is only for apps adopting Pinstripe late; new apps never set it. The app opts in from its own `composer.json`: ```json { "extra": { "pinstripe": { "legacy": true } } } ``` Every command checks the flag before it reads the baseline. Without it, `pinstripe-baseline` exits 2 with: ``` composer.json: a baseline is only for apps adopting Pinstripe late. Add "extra": { "pinstripe": { "legacy": true } } to composer.json to opt in; new apps never set it. ``` In a monorepo, point the command at another composer.json with `--composer=` (default: `composer.json` in the current working directory). ``` vendor/bin/pinstripe-baseline count phpstan-baseline.neon ``` prints how many errors the baseline ignores: the sum of each entry's `count`, 1 when `count` is absent. ``` vendor/bin/pinstripe-baseline check --max=42 phpstan-baseline.neon ``` exits 1 with `baseline grew: N errors, the most allowed is M` when the count is above the limit, 0 otherwise. To compare with the target branch instead of a fixed number, pass a git ref: ``` vendor/bin/pinstripe-baseline check --against=origin/main phpstan-baseline.neon ``` In GitLab CI the merge request's base SHA is already in the environment: ``` vendor/bin/pinstripe-baseline check --against=$CI_MERGE_REQUEST_DIFF_BASE_SHA phpstan-baseline.neon ``` A baseline is a tailor's chalk line, and this command is the tape measure: it fails the build the moment the line gets longer. The policy behind this section is recorded in [docs/adr/0001-phpstan-level-and-baseline-policy.md](https://github.com/waynestate/pinstripe/blob/HEAD/docs/adr/0001-phpstan-level-and-baseline-policy.md). ### Tested with Maintainers: how to build, test and release this project, and where its data comes from, is in [MAINTAINING.md](https://github.com/waynestate/pinstripe/blob/HEAD/MAINTAINING.md). - Pint 1.32.1 - PHPStan 2.3.3 - PHPStan extension-installer 1.4.3 - PHPStan strict-rules 2.1.0 - Larastan 3.13.2 - Rector 2.8.2 - PHPStan disallowed-calls 4.15.0 - ESLint 10.13.0 - Prettier 3.9.10 - eslint-plugin-vue 10.12.0 - eslint-plugin-vuejs-accessibility 2.6.3 - typescript-eslint 8.72.1 - Node 22, 24 and 26 (the JS presets run in CI on all three; the floor stays 22.13) ### Tool floors Can your app run Pinstripe's tools? Each row shows the floor the locked package itself declares, read verbatim from `composer.lock` and `package-lock.json` today and checked against them by `tests/ToolFloorsTest.php`, so a dependency bump forces a README update in the same change. PHP tools: | Tool | Locked version | Needs | | --- | --- | --- | | `laravel/pint` | v1.32.1 | `^8.3.0` | | `phpstan/phpstan` | 2.3.3 | `^7.4\|^8.0` | | `phpstan/phpstan-strict-rules` | 2.1.0 | `^7.4 \|\| ^8.0` | | `phpstan/phpstan-deprecation-rules` | 2.0.5 | `^7.4 \|\| ^8.0` | | `larastan/larastan` | v3.13.2 | `^8.2` | | `rector/rector` | 2.8.2 | `^7.4\|^8.0` | | `spaze/phpstan-disallowed-calls` | v4.15.0 | `^7.4 \|\| ^8.0` | Node tools: | Tool | Locked version | Needs | | --- | --- | --- | | `eslint` | 10.13.0 | `^20.19.0 \|\| ^22.13.0 \|\| >=24` | | `eslint-plugin-vue` | 10.12.0 | `^18.18.0 \|\| ^20.9.0 \|\| >=21.1.0` | | `typescript-eslint` | 8.72.1 | `^18.18.0 \|\| ^20.9.0 \|\| >=21.1.0` | | `prettier` | 3.9.10 | `>=14` | - Pinstripe itself needs PHP 8.3 or newer and Node 22.13 or newer, so the Pint floor is the binding PHP floor. - Pint only reads and rewrites files, so an app still on an older PHP can run Pint with a PHP 8.3 or newer binary (for example a container) while the app itself keeps its runtime. - ESLint 10 is what sets the Node floor: Node 20 before 20.19 is out. Measure twice, cut once: these floors are cut from the lock files, and the test keeps the hem honest. ### Supply chain Pinstripe's own installs are hardened in the repo's `.npmrc`, and apps should copy both lines into their own `.npmrc`: ``` ignore-scripts=true min-release-age=3 ``` `ignore-scripts=true` stops npm from running any lifecycle script (`preinstall`, `install`, `postinstall`) while installing dependencies, so a package cannot execute code merely by being installed. `min-release-age=3` makes npm refuse to install a release published fewer than 3 days ago, leaving time to pull a compromised publish before it reaches a lockfile. The stack's Renovate `minimumReleaseAge` rule waits the same 3 days before updating, so the two guards agree. New cloth rests on the rail for three days before it is cut. The guard is proven, not claimed: `tests/js/npm-hardening.test.mjs` installs a local package whose `postinstall` drops a marker file, once with the flag and once without, and the marker appears only without it. The lock gets the same care: `eslint-config-prettier` is floored at `^10.1.8`, past the releases hit by CVE-2025-54313. ### Coming next Nothing on the cutting table right now: the banned calls link to their CREED rule, and the PHP floor comes from CREED through PROCTOR. Preflight's pint, phpstan and eslint jobs already run your app's Pinstripe config. ### The cast --- Source: https://pinstripe.apps.wayne.edu/ Code style for the Wayne State app stack ## Pinstripe Sharp code. Every line. Shared presets for **Pint**, **PHPStan** with Larastan, **Rector**, **ESLint** for Vue and **Prettier**. Your app's config points at them and adds only its own exceptions. You run them on your machine, and Preflight runs the same config in CI on every push. [Book a fitting](https://pinstripe.apps.wayne.edu/#fitting) [Try it on today](https://pinstripe.apps.wayne.edu/#try) **[WELD](https://weld.apps.wayne.edu/) already has it.** WELD starts with a copy of the Laravel presets. Install Pinstripe yourself to bring the same settings to an app you already have. Version 0.4.0 is cut and [just off the cutting table](https://pinstripe.apps.wayne.edu/#try). Walk-ins welcome. Scroll, and the tailor gets to work ### The fitting One PHP class before and after the fitting. Before: the constructor assigns a property by hand, greet() has no return type and its brace on the same line, the array uses array(), and strlen() is given a value that might be null. After: the property is promoted into the constructor, greet() returns string with its brace on its own line, the array is short, and the null case is handled. As it walked in ``` final class Greeter { private string $name;1 public function __construct(string $name) { $this->name = $name; } public function greet()2 {3 $parts = array('Hello', $this->name)4; return implode(', ', $parts); } public function length(?string $nick): int { return strlen($nick)5; } } ``` Pressed ``` final class Greeter { public function __construct(private string $name) { } public function greet(): string { $parts = ['Hello', $this->name]; return implode(', ', $parts); } public function length(?string $nick): int { return strlen($nick ?? ''); } } ``` Alterations No. 0.4.0 1. Rector Promote the property into the constructor. 2. Rector Add the return type, `: string`. 3. Pint The method's brace goes on its own line (PER). 4. Rector `array()` becomes `[]`. 5. PHPStan · level 8 `$nick` might be null. PHPStan only reports this one; you write the fix. Pressed 0 errors at level 8, and the class still does what it did. Cut from Pinstripe's own test fixtures (`raw-messy`, `rector-old`, `raw-nullbug`), where the real tools run on every `composer ci`. Every preset is a piece of the suit ### The pieces There are seven, each named for a part of the suit. The status comes from `BEST_PRACTICES.md`: a piece is **Enforced** when a test runs the real tool and checks that clean code passes and broken code fails. 1. The cut Pint `pint/per.json` `pint/laravel.json` The PER Coding Style for raw PHP, and Laravel's own preset for Laravel apps. Enforced 2. The inseam PHPStan `phpstan/raw.neon` `phpstan/laravel.neon` Level 8 for new code. An ignore without a comment is an error, and so is a `dd()`, an `eval()`, TLS checks turned off or SQL joined from strings. Enforced 3. The lining Larastan `phpstan/laravel.neon` Loaded by `phpstan/extension-installer`, so there's no include line to add. Enforced 4. The press Rector `rector/base.php` `rector/strict-types.php` `rector/levels.php` Reads your PHP version from `composer.json`. It runs the dead code, code quality, type declaration and early return sets. The strict-types press declares `strict_types` only in files it cannot break, and the levels press takes a big old app up one rule at a time. Enforced 5. The buttonholes ESLint `eslint/javascript.js` `eslint/typescript.js` Vue 3's recommended rules plus vuejs-accessibility, so an image with no alt fails the lint. Enforced 6. The hem Prettier `prettier/index.json` Single quotes, semicolons, 100 columns, trailing commas. Enforced 7. The chalk line Baseline `phpstan analyse --generate-baseline` For an existing app: record today's errors, then shrink the list. `pinstripe-baseline` fails the build if it grows. Yours The hem is pressed: `tests/js/prettier.test.mjs` runs the real Prettier on a clean and a messy cut in every `npm test`. #### Every piece has a mirror Each preset is tested on code it should accept and code it should reject. If a preset stops catching the bad code, the tests fail. It fits - `raw-clean` passes Pint and PHPStan - `laravel-app` passes the Laravel presets - `BoundSql` binds every value and `SecureTransport` keeps TLS on, so no ban fires - `rector-clean` is left alone by Rector - `clean-js` and `clean-ts` lint clean - `typed/clean.ts` passes with typed linting on - a clean JS module and a clean Vue SFC pass Prettier It catches - `raw-messy` fails Pint - `raw-nullbug`: PHPStan reports the null - `Leftovers` and `JoinedSql`: every banned call, by name - `rector-old` gets altered - an `` without alt, a `v-for` without `:key` - a `save()` nobody awaits, in `.ts` and in `.vue` - double quotes and a missing semicolon fail Prettier Measured on every shape - Raw PHP `raw-clean` - Raw PHP with Vue `raw-vue` - Laravel with Blade `laravel-app` - Blade with Vue `laravel-vue` - Inertia and Vue `laravel-inertia` Every shape Sourdough starts has a small app of its own in the fixtures, and every run lints it: the clean code must pass and each planted mistake must be found. What this shop will not sew ### House rules Every cut, raw, Laravel and strict, fails the build on a short list of calls no Wayne State app should ship. Each refusal says why and what to use instead, ends with its OWASP Top 10:2025 tag, and has a stable identifier, so keeping one on purpose takes one line with a reason. [Every banned call, with its fix](https://pinstripe.apps.wayne.edu/docs/reference/banned-calls.html) Notice by order of the tailor 1. `eval()` `extract()` A string runs as PHP, or request data overwrites any variable in scope. Instead Write the code out, and read the keys you need by name. A05 Injection 2. `var_dump()` `dd()` `dump()` `$users->dd()` Debug output left in ships paths, config and secrets to the browser. Instead A PSR-3 logger (`Log::debug()` in Laravel), or Xdebug. A02 Security Misconfiguration 3. `withoutVerifying()` `'verify' => false` `CURLOPT_SSL_VERIFYPEER` `verify_peer` TLS checks turned off, so anyone on the path can read or change the traffic. Instead Keep them on; for a private CA, point the client at its bundle. A02 Security Misconfiguration 4. `"... id = " . $id` into PDO, mysqli, `oci_parse()` or `DB::select()` A variable joined into the SQL lets one untrusted value rewrite the query. Instead Keep the SQL a literal, with `?` or `:name`, and bind every value. A05 Injection Keeping one on purpose ``` // @phpstan-ignore pinstripe.banned.varDump (CLI-only diagnostics) var_dump($report); ``` Pick your pattern ### Made to measure Each pattern starts with its install line, then shows the config files your app keeps. A Laravel app with a Vue front end uses two of them. Piece A · cut 1 #### Raw PHP No framework. Pint with PER, PHPStan at level 8. Install ``` composer config allow-plugins.phpstan/extension-installer true composer require --dev waynestate/pinstripe:^0.4 ``` Pinstripe loads its PHPStan rules through `phpstan/extension-installer`, and Composer will not ask when it cannot prompt. `^0.4` gets you 0.4.0, the current release. Composer cannot find it yet? Packagist reads the GitHub mirror, which can trail a release: the [Raw PHP guide](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html#add-the-dependency) has the one line that installs it from git.wayne.edu. phpstan.neon ``` includes: - vendor/waynestate/pinstripe/phpstan/raw.neon parameters: paths: - app ``` composer.json, scripts ``` "lint": "pint --test --config vendor/waynestate/pinstripe/pint/per.json", "fix": "pint --config vendor/waynestate/pinstripe/pint/per.json", "analyse": "phpstan analyse" ``` Composer scripts, so they run the same on Windows, macOS and Linux. Piece B · cut 1 #### Laravel Laravel's Pint preset, and PHPStan with Larastan. Install ``` composer config allow-plugins.phpstan/extension-installer true composer require --dev waynestate/pinstripe:^0.4 larastan/larastan ``` Pinstripe loads its PHPStan rules through `phpstan/extension-installer`, and Composer will not ask when it cannot prompt. phpstan.neon ``` includes: - vendor/waynestate/pinstripe/phpstan/laravel.neon ``` That's the whole file. Larastan registers itself through `phpstan/extension-installer`; allow the plugin when Composer asks. Scripts point at `pint/laravel.json`. Every CI run checks these presets against a minimal Laravel 13 app in the fixtures. Piece C · cut 1 #### Vue An ESLint flat config with the accessibility rules, and Prettier for formatting. Install ``` npm install --save-dev @waynestate/pinstripe eslint prettier ``` eslint.config.js ``` import pinstripe from '@waynestate/pinstripe/eslint/typescript' export default [...pinstripe] ``` Plain JavaScript? Import `eslint/javascript` instead. package.json ``` "prettier": "@waynestate/pinstripe/prettier" ``` Alterations · fits A and B #### Rector Rector updates old code to use what your app's current PHP version allows. It reads that version from your `composer.json`, so there's no second copy to keep in step. Moving to a newer PHP is Booster's job. Install, alongside Pinstripe ``` composer require --dev rector/rector ``` rector.php ``` withPaths([__DIR__ . '/src']); ``` Hand it to your agent ### Fitted by your agent Four prompts for whatever coding agent you use. Copy one, or open it in OpenCode, Claude Code, Codex or ChatGPT. Each one names the pattern and what the agent must leave alone, and tells it to ask you before it guesses. #### Get started with Pinstripe Works out what kind of app this is and which presets fit, then lists every file it would add. It changes nothing yet. A prompt for your coding agent. Copy it as it stands: ```text You are a coding agent fitting Pinstripe to the app in this folder, at Wayne State University. Pinstripe is the coding standard of WELD, the Wayne State application stack: shared presets for Pint, PHPStan (with Larastan for Laravel), Rector, and ESLint with Prettier. The app points at them and adds only its own exceptions. Read first: - https://pinstripe.apps.wayne.edu/llms.txt, the index of Pinstripe's pages, each one as Markdown; llms-full.txt beside it holds the README with every install line. Fetch what you need; do not work from memory. - ADVISOR, the stack's MCP server, if it is connected: read_project_docs for pinstripe answers from Pinstripe's own README, and list_stack_rules gives the CREED rules for this app's permutation. If it is not connected, say so and work from the pages. How to add it: https://advisor.apps.wayne.edu/llms.txt - This app's composer.json, package.json if there is one, and any pint.json, phpstan.neon, rector.php, ESLint or Prettier config it already has. Task: 1. Say which kind of app this is: raw PHP or Laravel (with Blade, or with Inertia), and whether it has a Vue front end. 2. Say which Pinstripe pieces fit: the raw cut or the Laravel cut for the PHP side, the ESLint and Prettier presets for Vue, and Rector if I want it. 3. List the exact files you would add or change, with their content, taken from the README for that kind of app. Change nothing yet. 4. If the app already has code, plan a PHPStan baseline: generated once, included, and only ever shrunk. Constraints: - Point at the presets in vendor/waynestate/pinstripe and node_modules/@waynestate/pinstripe. Never copy a preset into the app. - PHPStan stays at level 8. Never lower it to get a run green; a baseline is how an existing app catches up. - Use Composer and npm scripts, so every command runs the same on Windows, macOS and Linux. Where a command does differ, give the PowerShell and the bash form. - Ask me before you guess: an app kind you cannot tell, an existing config that disagrees with a preset, or anything that touches CI or a deploy. Output: the app kind, the pieces that fit, then the planned files as numbered steps, then your questions. ``` #### Or cut from your pattern #### Pinstripe in a raw PHP app Adds Pint with PER, PHPStan at level 8 and the Composer scripts, plus a baseline if existing code fails. A prompt for your coding agent. Copy it as it stands: ```text You are a coding agent adding Pinstripe to a raw PHP app (no framework) at Wayne State University. Pinstripe is the coding standard of WELD, the Wayne State application stack. Read first: - https://pinstripe.apps.wayne.edu/llms.txt, then the README in llms-full.txt beside it: its raw PHP section has every line you need. - ADVISOR, the stack's MCP server, if it is connected: read_project_docs for pinstripe, and list_stack_rules with permutation raw-php (raw-php-vue if the app builds Vue). If it is not connected, say so and work from the pages. - composer.json, and the folders that hold the app's PHP code. Task: 1. Add Pinstripe with `composer require --dev waynestate/pinstripe:^0.4`. 2. Write phpstan.neon: include vendor/waynestate/pinstripe/phpstan/raw.neon and list the app's own code folders under paths. 3. Add the lint, fix and analyse Composer scripts from the README, with Pint pointed at vendor/waynestate/pinstripe/pint/per.json. 4. Run `composer lint` and `composer analyse`. If existing code fails, generate a baseline with `phpstan analyse --generate-baseline`, include it, and report its size with `vendor/bin/pinstripe-baseline count phpstan-baseline.neon`. 5. Only if I ask for Rector: `composer require --dev rector/rector`, a rector.php that uses Pinstripe's base preset with the app's own paths, then `vendor/bin/rector process --dry-run`, and show me the diff. Constraints: - The raw cut is Pint with PER and PHPStan at level 8. Never lower the level and never edit a preset; the app's own exceptions go in the app's own files. - Run `composer fix` only when I say so: it rewrites files. - Ask me before you guess, and before you touch CI or anything that deploys. Output: the files you added or changed, the lint and analyse results (with the baseline count if there is one), then your questions. ``` #### Pinstripe in a Laravel app Adds Laravel's Pint preset and PHPStan with Larastan. It works for Blade apps and Inertia apps. A prompt for your coding agent. Copy it as it stands: ```text You are a coding agent adding Pinstripe to a Laravel app (with Blade, or with Inertia and Vue) at Wayne State University. Pinstripe is the coding standard of WELD, the Wayne State application stack. Read first: - https://pinstripe.apps.wayne.edu/llms.txt, then the README in llms-full.txt beside it: its Laravel section has every line you need. - ADVISOR, the stack's MCP server, if it is connected: read_project_docs for pinstripe, and list_stack_rules with permutation laravel-blade, laravel-blade-vue or laravel-inertia-vue, whichever this app is. If it is not connected, say so and work from the pages. - composer.json (config.allow-plugins included), and any pint.json and phpstan.neon the app already has. Task: 1. Add Pinstripe and Larastan with `composer require --dev waynestate/pinstripe:^0.4 larastan/larastan`. Allow phpstan/extension-installer when Composer asks: it registers Larastan, so there is no Larastan line to add. 2. Make phpstan.neon include vendor/waynestate/pinstripe/phpstan/laravel.neon and nothing else, as the README shows. 3. Add lint, fix and analyse Composer scripts like the raw PHP ones in the README, with Pint pointed at vendor/waynestate/pinstripe/pint/laravel.json. 4. Run `composer lint` and `composer analyse`. If existing code fails, generate a baseline with `phpstan analyse --generate-baseline`, include it, and report its size with `vendor/bin/pinstripe-baseline count phpstan-baseline.neon`. 5. If the app has a Vue front end, say so: the ESLint and Prettier presets are a separate order. Constraints: - PHPStan stays at level 8 with the Larastan lining. Never lower it and never edit a preset. - If the app already has a pint.json or phpstan.neon, show me what would change before you replace it. - Ask me before you guess, and before you touch CI, migrations or anything that deploys. Output: the files you added or changed, the lint and analyse results (with the baseline count if there is one), then your questions. ``` #### Pinstripe on the Vue side Adds the ESLint and Prettier presets to your Vue front end and reports the accessibility findings first. A prompt for your coding agent. Copy it as it stands: ```text You are a coding agent adding Pinstripe's ESLint and Prettier presets to the Vue front end of an app at Wayne State University: a Laravel app with Inertia or with Vue islands in Blade, or a raw PHP app with a Vue front end. Pinstripe is the coding standard of WELD, the Wayne State application stack. Read first: - https://pinstripe.apps.wayne.edu/llms.txt, then the README in llms-full.txt beside it: its Vue section has every line you need. - ADVISOR, the stack's MCP server, if it is connected: read_project_docs for pinstripe, and policy_lookup for Node. If it is not connected, say so and work from the pages. - package.json, its lock file, and any ESLint or Prettier config the app already has. Task: 1. Check that Node is 22.13 or newer. 2. Add the presets with `npm install --save-dev @waynestate/pinstripe eslint prettier`. 3. Write eslint.config.js that spreads @waynestate/pinstripe/eslint/typescript, or @waynestate/pinstripe/eslint/javascript if the app has no TypeScript. 4. Point Prettier at @waynestate/pinstripe/prettier in package.json, and add the lint and format scripts from the README. 5. Run `npm run lint` and report the findings, the accessibility ones first. Run `npm run format` only when I say so: it rewrites files. Constraints: - The lock file stays committed; a missing one is a finding. - Never turn an accessibility rule off to get a run green. Fix the markup, or ask me. - Ask me before you guess, and before you replace an existing ESLint or Prettier config. Output: the files you added or changed, the lint findings grouped by rule, then your questions. ``` The agent reads the same pages you do: [llms.txt](https://pinstripe.apps.wayne.edu/llms.txt) lists them, [llms-full.txt](https://pinstripe.apps.wayne.edu/llms-full.txt) holds them all in one file, and this page has a [Markdown twin](https://pinstripe.apps.wayne.edu/index.md). Nothing here phones home. The buttons only copy text or open the tool you picked. Real today ### Try it on To see the presets work before you add them to an app, clone Pinstripe and run its own checks. `composer ci` runs Pint, PHPStan, Larastan and Rector against the fixtures, and `npm test` runs the ESLint and Prettier presets. The commands are the same on Windows, macOS and Linux. You need PHP 8.3 or newer, Composer, and Node 22.13 or newer. Just off the cutting table 0.4.0 brings two Rector presets for the suit that has hung in the back of the closet since PHP 5: `rector/levels.php` lets an app that has never met Rector take it in one notch at a time, and `rector/strict-types.php` declares strict types only on the files that already fit. Both are opt-in, so nothing you wear today gets any tighter. [Upgrading](https://pinstripe.apps.wayne.edu/docs/upgrading.html) walks an app through each release. Fitting room any OS ``` $ git clone https://github.com/waynestate/pinstripe.git $ cd pinstripe $ composer install $ composer ci $ npm ci $ npm test ``` CI runs this on PHP 8.3, 8.4 and 8.5. The whole wardrobe ### Worn across the stack Most of the stack's PHP projects check their own code with Pinstripe. WELD starts from a copy of its Laravel presets, and every app Sourdough makes comes with it already on, measured for all five shapes. - [WayneUI](https://wayneui.apps.wayne.edu/) The interface - [CREED](https://creed.apps.wayne.edu/) The written standards - [PROCTOR](https://proctor.apps.wayne.edu/) Checks an app against them - [Preflight](https://preflight.apps.wayne.edu/) Shared CI - [SESAME](https://sesame.apps.wayne.edu/) Sign-in - [HELMET](https://helmet.apps.wayne.edu/) Security headers - Pinstripe The tailor (you are here) - [Sourdough](https://sourdough.apps.wayne.edu/) Starts an app in any of the five shapes - [WELD](https://weld.apps.wayne.edu/) The Laravel and Vue starter - [Squire](https://squire.apps.wayne.edu/) Carries the release - [Parity](https://parity.apps.wayne.edu/) Citadel on your computer - [Rollcall](https://rollcall.apps.wayne.edu/) Every app answers present - [ADVISOR](https://advisor.apps.wayne.edu/) What applies to your app - [Drawbridge](https://drawbridge.apps.wayne.edu/) The sign-in gateway - [Booster](https://booster.apps.wayne.edu/) Keeps your PHP current --- Source: https://pinstripe.apps.wayne.edu/docs/adr/0001-phpstan-level-and-baseline-policy.html ## ADR-0001: PHPStan level 8 and baselines that only shrink [#](https://pinstripe.apps.wayne.edu/docs/adr/0001-phpstan-level-and-baseline-policy.html#adr-0001-phpstan-level-8-and-baselines-that-only-shrink) Status: Accepted ### Context [#](https://pinstripe.apps.wayne.edu/docs/adr/0001-phpstan-level-and-baseline-policy.html#context) Pinstripe is the coding standard for the Wayne State app stack, and PHPStan is its static analysis cut. Until now the level, the baseline policy and the place where the policy is enforced lived only in config comments and README prose, so each reader had to reassemble the decision from scattered notes. Two populations need different handling: new code should be held to the full level from the first commit, while existing apps carry legacy findings they cannot fix in one pass. The policy has to say what each population owes and where the promise is checked. The preset files already encode most of this: `phpstan/base.neon` carries the level and the ignore rules, the other presets are the cuts, and `bin/pinstripe-baseline` is the tool. What was missing was one document naming the decision. ### Decision [#](https://pinstripe.apps.wayne.edu/docs/adr/0001-phpstan-level-and-baseline-policy.html#decision) - New code runs at PHPStan level 8, set once in `phpstan/base.neon`; the PHP version is inferred from the consumer's composer.json, not pinned in the preset. - Every cut keeps `reportIgnoresWithoutComments` and `reportUnmatchedIgnoredErrors` on, so an `@phpstan-ignore` needs a reason in parentheses and must still match an error on its line. - The base cut keeps phpstan-strict-rules off (`strictRules.allRules: false`) even though the package ships in `require` and the extension installer loads it for every run; `phpstan/strict.neon` is the opt-in strict cut that turns those rules back on. - Of the extra parameters phpstan-strict-rules forces on, the four low-noise ones (`checkExplicitMixedMissingReturn`, `checkFunctionNameCase`, `checkInternalClassCaseSensitivity`, `checkStrictPrintfPlaceholderTypes`) stay on in every cut; the four noisy ones are pinned off in the base cut and turned on only in `phpstan/strict.neon`, and the README table records each decision. - Laravel apps include `phpstan/laravel.neon`, which adds Larastan (registered through `phpstan/extension-installer`) and pins `noEnvCallsOutsideOfConfig` on; plain PHP apps include `phpstan/raw.neon`, which is the base cut alone. - Pinstripe ships `phpstan/phpstan-deprecation-rules`, loaded automatically by `phpstan/extension-installer`, so calling a `@deprecated` method fails the build in every cut. - New apps can include `phpstan/strict.neon` instead of `raw.neon` or `laravel.neon`; existing apps stay on the base cut and baseline their way over. - An existing app may generate a baseline once with `phpstan analyse --generate-baseline` and include it in its `phpstan.neon`; new code gets no baseline. The baseline tool reads both the NEON baseline and the PHP format (`phpstan-baseline.php`). - The count a baseline holds is the sum of each entry's `count`, 1 when `count` is absent, and `pinstripe-baseline count` prints it. - `bin/pinstripe-baseline check` fails the build (exit 1) when the baseline grows, either against a fixed limit with `--max=` or against a git ref with `--against=`; in GitLab CI the merge request's base SHA is already in the environment as `$CI_MERGE_REQUEST_DIFF_BASE_SHA`. Exit codes: 0 ok, 1 the baseline grew, 2 usage or baseline problem. - Enforcement point, per `.gitlab-ci.yml`: a `composer-ci` job runs `composer install --no-interaction --no-progress --prefer-dist` and then `composer ci`, which runs the checks defined by the "ci" script in composer.json. - Enforcement point, per the README's "Baselines only shrink" section: it shows the same `pinstripe-baseline check` command (with `--max` or `--against`) and says it fails the build the moment the line gets longer. ### Consequences [#](https://pinstripe.apps.wayne.edu/docs/adr/0001-phpstan-level-and-baseline-policy.html#consequences) Good: - Every app, new or existing, is held to one documented level, and the ignore-comment rules make every exception carry its reason and exit plan. - Legacy debt is bounded and measurable: a baseline marks the fabric as it is, and the tape measure fails the build the instant it is let out. Costs: - Existing apps carry a baseline file they must keep shrinking, and every merge request needs the check wired in before the promise means anything. - Level 8 with deprecation checks and the ignore-comment rules raises the bar for legacy code, so some apps fail until they fix their findings or record them in a baseline. The chalk line stays on the suit, and we take it in every release: nobody in this shop sells extensions to the tape measure. --- Source: https://pinstripe.apps.wayne.edu/docs/changelog.html ## Changelog [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#changelog) All notable changes to Pinstripe are documented here. ### Unreleased [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#unreleased) - Fixed: the contributing guide names Preflight 0.9.0, the tag CI pins, where it still said 0.8.0. Content only. - Changed: the deploy kit is Squire 0.11.1 (was 0.10.7): the release script fetches PROCTOR when `--no-dev` left it out and installs the frontend from a `yarn.lock`, the HAProxy pin is current, the fallback base follows the app's PHP line, and the parity scripts carry the deprecation note. - Changed: CI pins Preflight 0.9.0 (components and the a11y checker copy). - Changed: `deploy/` requires PROCTOR `^0.16`, whose `ci-pipelines` check no longer asks for a GitHub workflow (D-069); `^0.15` failed the `wayneui-copies` job. - Removed: the GitHub Actions workflow; CI runs on git.wayne.edu only (the GitHub copy is a mirror). - Site: the line under the hero's buttons says "Version 0.4.0 is cut" (it still said 0.3, with 0.3.0's news). The number carries `data-docs-version` like the hang tag, so the docs builder rewrites it at every release and `composer docs:check` fails while it is stale; the words name no feature and link to the "Just off the cutting table" note, which the release steps already rewrite. New `FrontPageTest::testTheHeroNoteWearsTheVersionStamp` fails `composer ci` if the number is typed by hand again. - Docs: the README shows the Docker command for `composer ci`, so the checks run with no local PHP. ### 0.4.0 (2026-11-11) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-4-0-2026-11-11) - Docs: every install line says `^0.4` (README, front page, its agent prompts, the Raw PHP, Laravel and Proof pages), since `^0.3` does not allow 0.4.0, and the Upgrading section's steps say to move the constraint rather than `composer update`. The front page's "Just off the cutting table" note names 0.4.0 and its two opt-in Rector presets. - CI pins Preflight 0.8.0 on GitLab; MAINTAINING.md and the contributing guide say so (the GitHub workflow stays on 0.5.0, the newest tag on the mirror it can call). - Added: `rector/strict-types.php`, an opt-in Rector preset for the careful route to strict types on an old app. It runs Rector's `SafeDeclareStrictTypesRector` and nothing else, so it adds `declare(strict_types=1)` only to files whose calls, returns and property assignments already pass the types they ask for, and leaves the rest for a later run. Opt-in, so no app sees a change until it points a config at it. New fixture `tests/fixtures/rector-strict-types` with `PresetsTest::testRectorStrictTypesPresetDeclaresOnlyTheSafeFile` and `testRectorStrictTypesPresetLeavesTheCoercingFileAlone`; the README, Require strict types and Rector guides show it, and BEST_PRACTICES.md gains the row (24 rows, 24 Enforced). - Added: `rector/levels.php`, an opt-in Rector preset for an app that has never met Rector. It returns a function: `$levels(deadCode: 0)` runs only the first dead-code rule, and you raise the number one merge request at a time, then start `typeCoverage`, `codeQuality` or `php` the same way (each family stays off until named, and naming none throws). It wraps Rector's own `withDeadCodeLevel`, `withTypeCoverageLevel`, `withCodeQualityLevel` and `withPhpLevel`, and leaves out the import tidying and Laravel rules that touch every file. Opt-in, so no app sees a change until it points a config at it. New fixture `tests/fixtures/rector-levels` with four `PresetsTest::testRectorLevelsPreset*` tests; the README and Rector guide show the climb, and BEST_PRACTICES.md gains the row (25 rows, 25 Enforced). - Site: the front page's "Just off the cutting table" note says what 0.3.2 brought (it still led with 0.3.0), and new `tests/FrontPageTest.php` fails `composer ci` while the note names anything but the newest CHANGELOG release, so it cannot fall behind again. The release steps in MAINTAINING.md and on the Releasing page say to rewrite it in the release commit. - Site: the install card's "`^0.3` gets you" line names 0.3.2, the current release (it still said 0.3.1). The version carries `data-docs-version` like the hang tag, so the docs builder rewrites it at every release and `composer docs:check` fails while it is stale. - Docs: Banned calls gains "Type the connection, or the ban cannot see it": the PDO and mysqli bans match by the connection's type, so a joined query on an untyped `global $db` passes, and one `@var \PDO` (or a typed property) gets it reported. It was one line under "Other ways out"; now it is its own section with both halves proven by new fixture `UntypedConnection.php` and `PresetsTest::testPhpStanSeesJoinedSqlOnlyOnATypedConnection` (raw and strict cuts). No rule changed. - Docs: the Upgrading page has a draft section for the next release (the two opt-in Rector presets, no breaking change), and its three oldest headings carry their dates. New `tests/UpgradingTest.php` fails `composer ci` while a CHANGELOG release has no Upgrading section, or the two disagree on a date or the order, so a release cannot ship without its fitting notes. The release steps in MAINTAINING.md and on the Releasing page say to rename the draft in the release commit. - Tests: the TypeScript preset's typed linting is proven, not only claimed. New fixtures in `tests/js/typed` (a `tsconfig.json`, a clean `.ts` file, and a `save()` nobody awaits in `floating.ts` and `FloatingSave.vue`) and three `npm test` cases: the clean file has no findings, and each floating promise fails with `@typescript-eslint/no-floating-promises` as an error. The README and Vue guide gain "Typed linting" (what it catches, that it reads the app's `tsconfig.json`, and to run it in CI), and the front page's mirror gains the pair. No preset changed. - Site: the front page's mirror ("Every piece has a mirror") names every fixture the tests run, not half of them. "It fits" gains `BoundSql` and `SecureTransport` (the clean ways past the bans), "It catches" gains `Leftovers` and `JoinedSql`, and a new row of size labels sews on one per app shape Sourdough starts (raw PHP, raw PHP with Vue, Laravel with Blade, Blade with Vue, Inertia and Vue), each with its fixture's name. The labels drop in and their running stitch sews round one after another; under reduced motion they are simply there. - Site: Parity's hanger on the front page's rail links its site, parity.apps.wayne.edu, like every other part's. It hung there unlinked while Parity had no site; now it has one, and the stack's environment script already points a pre-production page at Parity's pre-production site. - Site: the hero's hang tag can be read on a phone. Its handwriting was 12px and its labels 7px at 390 px wide; now the writing never drops below 17px (with a hairline stroke behind the thin hand), the labels never below 9px, and the labels and values line up in two columns like a real ticket. The tag is wider, and the extra width hangs out past the cloth into the margin, so it covers no more of the label than before. The README hero is rebuilt to match. ### 0.3.2 (2026-11-10) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-3-2-2026-11-10) - Changed: the deploy layer requires PROCTOR ^0.15 (locked 0.15.0, was ^0.12): 0.13 checks the release cooldown against the CREED policy, 0.14 adds `script-pair` and 0.15 adds `mysql56-ci`; all only warn, nothing breaks. - Docs: the Proof page says its 82-app run used the presets as they were on `main` on 2026-11-05, not "as they are on main". - Added: `node scripts/readme-art/build.mjs --check` rebuilds the README art in a temp folder and fails when `docs/readme/` is stale (SVGs byte for byte, images by pixels within a small tolerance), and the `readme-art` CI job runs it. The license badge says `license`, not `licence`. - Changed: the deploy layer requires PROCTOR ^0.12 (locked 0.12.0, was ^0.11): two new warning-only checks, nothing breaks. - Docs: the proof page's last run is 2026-11-10 at e42cf2f (113 PHP tests, 36 npm tests with the raw-vue and laravel-inertia fixtures). - Changed: the deploy kit is Squire 0.10.7 (was 0.10.6): it ships a `.gitattributes` that pins line endings, so the deploy layer clears PROCTOR's line-ending warnings. - Changed: the Vue presets let Inertia page components under `Pages/` or `pages/` have one-word names such as `Index` and `Show` (`vue/multi-word-component-names` is off there only). - Tests: a Laravel plus Inertia plus Vue fixture (tests/fixtures/laravel-inertia) proves the presets on WELD's app shape, so every stack app shape now has a fixture. - Docs: the ban tables in the README and on the Banned calls page name the OWASP ASVS 5.0 requirement each ban enforces (V1.2.4, V1.3.2, V12.3.2, V13.4.2, and V15.3.3 as the closest fit for `extract()`). The messages keep their OWASP Top 10 tags. - Tests: a raw PHP plus Vue fixture (tests/fixtures/raw-vue) proves the presets on that app shape too, with one planted PHP error and two planted Vue defects. - Changed: the GitHub workflow calls Preflight 0.5.0 (was 0.1.4), now that GitHub's copy of Preflight has the tag; MAINTAINING.md and the contributing guide name the 0.5.0 pins. - Changed: the docs, agent-ready and deploy kits are Squire 0.10.6 (was 0.10.5): the docs builder and agent-ready generator see every file on Docker Desktop mounts. - Site: `assets/stack-env.js` knows Parity, so a pre-production page links Parity's pre-production site and a dev page links its local `site/` folder. Until now Parity, of all parts, was the one link that ignored its environment. - Changed: Deploy kit refreshed to Squire 0.10.5 (was 0.10.2). ### 0.3.1 (2026-11-09) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-3-1-2026-11-09) A patch: no preset passes or fails anything it did not in 0.3.0. It adds proof and docs (PHPStan findings in the merge request, the fix for SQL kept in `.sql` files), keeps Code Quality reports when a lint job fails, and brings the deploy kit and CI pins up to date. - Docs: Parity joins the party. The README cast ("Fifteen parts, one fitting room") and the front page's rail carry Parity next to Squire, with its spirit-level mark: the stack's new tool that runs Citadel on your computer (its PHP image, its proxy and MySQL 5.6). 0.1.0 is coming and it has no site yet, so its tag links nowhere. With fifteen parts the rail hangs three rows of five on wide screens, so no part is left hanging alone at the end. Every good suit gets a fitting at home before the big day, and the hem comes out level. - Changed: the deploy kit is Squire 0.10.0 (was 0.7.1): release.sh keeps Composer and npm download caches in the app folder and the gate takes SQUIRE_PHP_RUNTIME; the compose file, health.php and .env.squire.example follow the template, and the portable image files are added (build.sh keeps its deliberate SQUIRE_BUILD_REVISION=2 marker). - Docs: every install line says `^0.3` (it said `^0.1`, which stops at 0.1.4), with the one `composer config repositories` line that installs 0.3.0 from git.wayne.edu while Packagist's GitHub mirror trails the release; the npm notes say the ESLint and Prettier presets have not changed since 0.1.4. The front page drops its "0.1.4 on Packagist and npm" note and a "coming soon" chip for the CREED PHP floor (built in 0.2.0), keeps a Docs link in the header at phone width, and gains House rules: a notice of the banned call families with their OWASP tags, struck through in chalk and stamped as they scroll in (already struck and stamped with reduced motion). - Docs: truth pass. The `laravel-vue` fixture's Vue side runs under `npm test`, not `composer ci` (README, Laravel guide); MAINTAINING.md and Contributing list all five `composer ci` steps, the Node 22, 24 and 26 matrix, every CI component and job, and `spaze/phpstan-disallowed-calls` among the runtime dependencies; the release steps no longer say to set the version twice, and `npm pack` lists `LICENSE` too; Banned calls says `ociparse()` is reported as deprecated on every supported PHP, not only 8.4 and newer; the Baselines guide gains the `legacy` opt-in and `--composer=`; the Vue guide covers the error-level presets and their `-warn` twins; Upgrading 0.1.3 no longer lists the docs site (it shipped in 0.1.4); and BEST_PRACTICES.md marks three rows proven in one direction only (`pint/laravel.json`, `pint/laravel-strict.json`, ESLint GitLab output) as Checked, a status it now defines. - Changed: CI's `composer-ci` and `wayneui-copies` jobs, and the Docker-only command in MAINTAINING.md and Contributing, use Composer 2.11.1 pinned by its multi-arch list digest (was 2.10.3, which is no longer maintained; 2.11 fixes GHSA-c968-33g3-wh7p and GHSA-fm2w-xgf2-f9fh). - Changed: the deploy kit is Squire 0.10.2 (was 0.10.0): the fallback base names its images in full and copies Composer 2.11.1 from a `COMPOSER_IMAGE` build argument, `.squire/php.ini` sets `session.cookie_samesite = Lax`, and the portable image drops `node_modules/` after the build; build.sh takes the template's note on what a Citadel Update runs and keeps its deliberate SQUIRE_BUILD_REVISION=2 marker. - Changed: the front-page deploy layer requires HELMET `^1.3` (was `^1.0`, locked 1.3.0, was 1.0.0), PROCTOR `^0.11` (was `^0.8`, locked 0.11.1, was 0.8.0) and CREED `^0.1.8` (was `^0.1`, locked 0.1.8, was 0.1.7). `proctor check` still passes on `deploy/`. - Docs: MAINTAINING.md names the maintainer as a role (the stack maintainer), reached through an issue on git.wayne.edu, not a person; the CI file's cache comment drops an internal decision number. - Added: the three presets the truth pass marked Checked are Enforced again, each now proven in both directions: `PresetsTest::testPintLaravelPresetRejectsTheMessyFixture` (`pint/laravel.json` fails the messy fixture), `PresetsTest::testPintLaravelStrictPresetAcceptsTheStrictTypesLaravelCleanFixture` (`pint/laravel-strict.json` passes a new Laravel-style clean fixture, `tests/fixtures/strict-types/laravel-clean`), and a `gitlab-formatter.test.mjs` case where the clean Vue fixture gives an empty Code Quality report. Two stale comments are fixed: the GitHub workflow names its real Preflight pin (0.1.4, not 0.1.2), and `PresetsTest` says the `ociparse()` deprecation is expected on every PHP version, not only 8.4 and newer. - Added: BEST_PRACTICES.md (and its docs page) ends the table with a tally, today 22 rows, 22 Enforced, 0 Checked, and `BestPracticesTest::testTheTallyCountsTheTable` recounts it on every run, so a new row or one slipping back to Checked moves the tally in the same change. - Docs: Banned calls shows the fix for the joined-SQL report older apps meet most: SQL kept in `.sql` files, read by one helper typed `@return literal-string` with a single reasoned ignore (its file name is `literal-string` too, so a request value cannot pick the file). It also says to type a wrapper's SQL parameter `literal-string` and never baseline it, because a plain-`string` wrapper is reported once, inside, and hides every caller. Both are proven: new fixtures `SqlFiles.php` (green in the raw and strict cuts) and `JoinedThroughAWrapper.php` (each joined caller reported as `argument.type`, the loose wrapper once), with `PresetsTest::testPhpStanAcceptsSqlReadFromFilesThroughATypedWrapper` and `PresetsTest::testPhpStanReportsSqlJoinedThroughAWrapperAtTheCaller`. No rule changed. - Added: "Show PHPStan findings in the merge request" (README and the Raw PHP guide): an `analyse:gitlab` script with PHPStan's own `--error-format=gitlab`, each finding named by its identifier. New `PresetsTest::testPhpStanGitlabFormatReportsTheNullBugAsCodeQualityJson` and `testPhpStanGitlabFormatIsAnEmptyArrayForTheCleanFixture` prove both sides, and BEST_PRACTICES.md gains the row (23 rows, 23 Enforced). - Fixed: the Pint, PHPStan and ESLint Code Quality snippets set `artifacts: when: always`. Without it GitLab keeps a job's artifacts only when the job passes, so a lint job that found something, the one time the report matters, uploaded nothing. - Docs: no internal decision numbers in public text. This changelog's 0.2.0 and 0.1.5 entries, the CI file, the deploy layer's composer.json and a comment on the front page drop numbers that pointed into a private repository, and the old entries say "an internal GitLab" instead of naming it. - Fixed: the Composer package's description (what Packagist shows) names the Rector preset and the banned calls; it said "shared Pint and PHPStan presets". ### 0.3.0 (2026-11-09) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-3-0-2026-11-09) - Added: every cut bans SQL joined from strings (`pinstripe.banned.joinedSql`, OWASP A05:2025): a variable concatenated, interpolated or `sprintf()`'d into the SQL given to `PDO::query()`, `prepare()` or `exec()`, mysqli's `query()`, `prepare()`, `mysqli_query()` and the rest, `oci_parse()` (and the old alias `ociparse()`), or Laravel's `DB::select()`, `insert()`, `update()`, `delete()`, `statement()`, `scalar()`, `cursor()` and `fromQuery()`. No taint rule: spaze/phpstan-disallowed-calls asks for PHPStan's own `literal-string` type, so literal SQL with bindings, class constants and literal pieces joined together pass; Laravel already types `DB::raw()`, `DB::unprepared()` and the `*Raw()` builder methods that way, and a test now holds it to that. Breaking for apps that build SQL from variables. New fixtures `JoinedSql.php`, `BoundSql.php`, `JoinedQueries.php` and `BoundQueries.php`. - Docs: the Best practices docs page carries BEST_PRACTICES.md word for word again (it had fallen behind: no ESLint GitLab output row, no banned-call rows), and BEST_PRACTICES.md gains rows for `phpstan/strict.neon` and `phpstan/disallowed.neon`. New `tests/BestPracticesTest.php` keeps them in step: every test and file the table names exists, each row has one known status, an Enforced row names its proof, and the docs page matches. - Fixed: the `Http::withoutVerifying()` ban (the static entry) carries the same tip as the others, linking to the Banned calls page and the CREED rule; `BannedCallLinksTest::testEveryBanCarriesAnIdentifierAndATip` now reads `phpstan/disallowed.neon` and fails on any entry without a message, identifier or tip. - Added: every cut bans TLS checks turned off: `curl_setopt()` and `curl_setopt_array()` with `CURLOPT_SSL_VERIFYPEER` false or `CURLOPT_SSL_VERIFYHOST` 0 (`pinstripe.banned.curlVerifyOff`), `stream_context_create()` with `ssl` `verify_peer` or `verify_peer_name` false or `allow_self_signed` true (`pinstripe.banned.streamVerifyOff`), and Guzzle's `verify` option set to false through Laravel's `withOptions()`, `new GuzzleHttp\Client()` or a request's options (`pinstripe.banned.verifyFalse`), each tagged OWASP A02:2025. The `curl_setopt()` ban is Pinstripe's first PHPStan rule of its own (`src/PHPStan/CurlVerifyOffRule.php`), since it needs the option and the value together; the rest are spaze/phpstan-disallowed-calls entries. Breaking for apps that skip the certificate check. New fixtures `InsecureTransport.php`, `SecureTransport.php`, `VerifyFalse.php`, `VerifiedHttp.php` and the Laravel app's `banned/InsecureCurl.php`. - Added: Laravel's own `dd()` and `dump()` methods are banned too (`$users->dd()`, `DB::table('users')->dumpRawSql()`, `$request->dump()`, `Http::get($url)->dd()`, `Http::dump()` and the rest of the family), under the functions' identifiers `pinstripe.banned.dd` and `pinstripe.banned.dump`; only methods Laravel declares match, so an app's own `dump()` and the schema dump behind `php artisan schema:dump` pass. Breaking for Laravel apps with one left in. New fixtures `tests/fixtures/laravel/src/LeftoverDebugMethods.php` and `SchemaDump.php`. - Changed: CI pins the Preflight components to 0.4.0 (the proctor job clones the full history, so the override-approver check can read git blame). ### 0.2.0 (2026-11-08) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-2-0-2026-11-08) - Changed: every banned call's tip links to the CREED rule it enforces (code handbook, Banned patterns) as well as to Pinstripe's banned-calls page; `tests/BannedCallLinksTest.php` keeps it that way. - Docs: the README says how CREED's PHP floor reaches the tools (PROCTOR's php-floor check, then Booster; the presets keep reading composer.json); "Coming next" is empty for now, since both items it named are built. - Changed: the deploy layer runs Squire's kit 0.7.1 (was 0.6.0): `.squire/php.ini` no longer sets the deprecated `session.sid_*` lines, web requests get a `disable_functions` list and Apache hardening (`.squire/php-web.ini`, `.squire/apache-hardening.conf`), and opcache gets production settings with `SQUIRE_OPCACHE_VALIDATE` as the one switch. - Added: CI runs Preflight's a11y component (0.3.1) on site/, every page in light and dark at 320 and 1280 px with the WCAG 1.4.10 reflow check, blocking. - Changed: CI pins the Preflight components to 0.3.1 (fixed cache keys, and caches saved even when a job fails). - Changed: CI saves its Composer and npm caches even when a job fails, so a retry after a dropped download fetches only what is missing. - Changed: CI caches Composer and npm downloads under a fixed key, so a lock change downloads only what changed. - Changed: HELMET moves to `^1.0`, its first stable release, wherever this repo requires it. - Fixed: the docs menu closes with Escape and hands focus back to its button (docs kit synced from Squire). - Fixed: the docs kit's copy button no longer covers the first line of code when it says Copied or Failed: over the code it keeps its resting width and shows a check or a cross when the word does not fit (docs kit synced from Squire). - Fixed: the front page's version chip shows the full version the docs show (size 0.1.4, was size 0.1). It carries `data-docs-version` now, so the docs builder (synced from Squire) rewrites it at every release and `composer docs:check` fails while it is stale. - Changed: the deploy layer requires PROCTOR ^0.8 (locked 0.8.0). - Changed: the pipeline pins every Preflight CI component to 0.3.0 ([preflight@0.3.0](mailto:preflight@0.3.0)); component image inputs are plain image names, since Preflight adds the Dependency Proxy prefix itself. - Added: a test that proves `npm install --ignore-scripts` stops a postinstall script, and the eslint-config-prettier floor is ^10.1.8, past the releases hit by CVE-2025-54313. - Added: banned calls. Every PHPStan cut includes the new `phpstan/disallowed.neon`, which bans `eval()`, `extract()`, `var_dump()`, `dd()`, `dump()` and Laravel's `PendingRequest::withoutVerifying()` (the `Http::withoutVerifying()` facade call too) through `spaze/phpstan-disallowed-calls` `^4.15` (now in `require`, locked 4.15.0, loaded by the extension installer). Each message says why and what to use instead, ends with its OWASP Top 10:2025 tag (A05 Injection or A02 Security Misconfiguration), and has a stable identifier (`pinstripe.banned.*`) for a reasoned ignore. Breaking for apps with one left in: a leftover `dd()` now fails the pipeline. `md5()`, `sha1()`, `rand()` and `mt_rand()` are not banned; that call is open. New README section and docs page, Banned calls; new fixtures `tests/fixtures/raw-disallowed`, `tests/fixtures/laravel/src/InsecureHttp.php` and `tests/fixtures/laravel-app/banned`. - Added: the Rector preset turns on the composer-based Laravel sets (`withComposerBased(laravel: true)`); apps that install driftingly/rector-laravel get the Laravel upgrade rules for their installed version, and apps without it see no change. - Changed: the front page's `deploy/build.sh` revision marker is 2, for a Citadel build-cache test (does a full Update run the edited `build.sh`?). - Fixed: the pipeline's PROCTOR jobs no longer pass `--policy`, which PROCTOR 0.7 refuses in CI; PROCTOR checks against the CREED policy it bundles. - Changed: the front page's deploy layer (`deploy/`) runs Squire's kit 0.6.0 (was 0.5.0): `scripts/release.sh` asks PROCTOR's deploy gate for a go or no-go on each release (a report, not a stop, unless `SQUIRE_PROCTOR=enforce`), and `.env.squire.example` lists the new setting. The layer's pins move to HELMET `^0.4` (locked 0.4.0) and PROCTOR `^0.7` (locked 0.7.0). - Fixed: the front page says Sourdough starts all five app shapes and that every app it makes comes with Pinstripe on; it said raw PHP only, and that Sourdough apps did not include Pinstripe yet. - Changed: CI caches Composer and npm downloads per lock file (`.composer-cache`, keyed on `composer.lock` and `deploy/composer.lock`, and `.npm-cache`), so a pipeline stops fetching every package from Packagist and npm on every run. Images already come through the Dependency Proxy. - Changed: the front page's deploy layer (`deploy/`) runs Squire's kit 0.5.0 (was 0.3.4): `oracle-check.php` arrives, `scripts/release.sh`, `scripts/parity.ps1` and `.squire/base-fallback.Dockerfile` take the new templates, and `docker-compose.squire.yml`, which Renovate had edited, is Squire's template again, so `squire init --check` passes. `site/assets/stack-env.js` takes the stack's one copy, with bindingless catch blocks. - Changed: The canonical repository is git.wayne.edu; docs, links and package metadata no longer point at the archived internal copy. - Added: The Proof page records its last run. ### 0.1.5 (2026-11-09) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-1-5-2026-11-09) A patch on the 0.1 line, cut from 0.1.4 on the `0.1.x` branch, for consumers that pin `^0.1` (Booster among them). It changes no preset; 0.2.0 and 0.3.0 already carry the same fix. - Fixed: the deploy kit's lock (`deploy/composer.lock`) names git.wayne.edu and GitHub for CREED, HELMET and PROCTOR instead of the archived internal host. - Changed: The canonical repository is git.wayne.edu; docs, links and package metadata no longer point at the archived internal copy. ### 0.1.4 (2026-11-06) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-1-4-2026-11-06) - Fixed: `pinstripe-baseline` mutes deprecations while it loads the app's autoloader, so an old package in the app no longer prints PHP warnings ahead of the count a script reads (found by the 2026-11-05 proof run; new test in tests/BaselineTest.php). - Added: a public Proof page (`docs/reference/proof.md`, under Reference): the presets run against 82 Wayne State applications, what held, what the run caught in Pinstripe, and what it does not prove. - Docs: the install steps say to rerun `composer require` with `-W` when a package the app already locks blocks it; Adopting on an existing app covers errors PHPStan cannot baseline and keeping Pint off bundled third-party code. - Security: the front-page deploy layer moves to Symfony 7.4.23 (symfony/http-foundation and symfony/yaml advisories, including CVE-2026-118514). - Changed: the docs, README and front page say the npm package, `@waynestate/pinstripe`, is at 0.1.3 (published); the docs pages' dark mode is now charcoal suiting instead of the green cloth, and wide tables shade the edge they scroll toward. - Changed: the docs pages wear the front page's look: its header and main menu (Docs marked current), Bodoni titles with the gold chalk line, pattern-piece callouts and pager, the gold Copy pill and the green footer, plus a dark mode cut from the green cloth. The theme lives in `docs/_header.html` and `docs/theme/pinstripe.css`, named by the `theme` key in `docs/docs.json`; the vendored docs builder and kit are synced from Squire's unified builder (theme hook, callouts, copy button and keyboard fixes). - Added: `min-release-age=3` to the repo `.npmrc` beside the existing `ignore-scripts=true`, with a comment naming the unit (days) and the agreeing Renovate `minimumReleaseAge` rule, so npm waits 3 days before installing a freshly published release and never runs dependency lifecycle scripts; the README gains a "Supply chain" section that explains both settings and tells apps to copy both lines into their own `.npmrc`. - Changed: `pinstripe-baseline` now requires the app's composer.json to carry `"extra": { "pinstripe": { "legacy": true } }` before it counts or checks a baseline; this is breaking for existing baseline users, who must add the flag, because a baseline is only for apps adopting Pinstripe late and new apps never set it. - Added: `--composer=` to `pinstripe-baseline count` and `check` (default `composer.json` in the current working directory), so tests and monorepos can point at another composer.json. - Changed: the ESLint presets (`eslint/javascript.js` and `eslint/typescript.js`) fail lint on every Vue and accessibility finding: rules the plugins' recommended configs report as warnings are raised to errors, so the editor, a local `npm run lint` and CI agree on what fails. Pre-1.0 break: apps that keep the old behavior (those findings as warnings) spread the new `-warn` export instead. - Added: `eslint/javascript-warn.js` and `eslint/typescript-warn.js`, exported as `@waynestate/pinstripe/eslint/javascript-warn` and `@waynestate/pinstripe/eslint/typescript-warn`, which keep the exact previous behavior (the plugins' plain recommended configs, warnings stay warnings) for apps adopting the stricter presets gradually; `tests/js/presets.test.mjs` gains four tests around a `tests/js/warn-tier` fixture whose only findings (`vue/attributes-order`, `vue/no-v-html`) were warnings before, proving the strict presets report them as errors and the `-warn` presets keep them as warnings. - Added: a docs site (site/docs/) built by the shared docs builder from docs/, checked in composer ci. - Added: `eslint-formatter-gitlab` as a dependency and `tests/js/gitlab-formatter.test.mjs`, which lints the bad Vue fixture with the javascript preset, runs the results through ESLint's `gitlab` formatter, and asserts the Code Quality report is a non-empty JSON array whose findings each carry a description, fingerprint, severity and location, so `eslint --format gitlab` shows ESLint findings in GitLab merge requests; the README gains a "Show ESLint findings in the merge request" note for the Vue section. - Added: `prettier-plugin-blade` (pinned to 3.3.3, no caret) as a dependency and a `*.blade.php` override in `prettier/index.json` (parser `blade`, 4-space tab width), so the Prettier preset formats Blade views; `tests/js/blade.test.mjs` checks a clean and a messy Blade fixture through Prettier's Node API, and the README gains a "Format Blade views" section with the one-time reformat command and an adopting note. - Changed: Blade files now format with prettier-plugin-blade; the first run rewrites every Blade file (4-space indent, a space after directive names such as `@vite (`, void tags self-closed), so reformat in its own commit. ### 0.1.3 (2026-11-03) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-1-3-2026-11-03) - Added: `docs/adr/0001-phpstan-level-and-baseline-policy.md`, the ADR recording the PHPStan level 8 cut, the baseline policy (generated once for an existing app, never for new code, and only ever shrunk), and the `composer ci` / `composer-ci` pipeline enforcement point, plus a README note that apps adopting Oxlint keep ESLint for `.vue` files because the Vue and accessibility plugins run only in ESLint. - Changed: the install instructions now include `composer config allow-plugins.phpstan/extension-installer true`, so a non-interactive install works. - Added: a Node matrix to the `npm-test` jobs on GitLab and GitHub (Node 22, 24 and 26), so the ESLint and Prettier presets are proven on all three majors; the floor stays 22.13. - Changed: the front-page deploy layer pins HELMET ^0.3, PROCTOR ^0.4 and CREED ^0.1 (lock: HELMET 0.3.0, PROCTOR 0.4.0, CREED 0.1.6). - Changed: CI pins Preflight 0.1.4 (GitLab component includes and the GitHub reusable workflow tag). - Added: `tests/fixtures/laravel-vue`, a combined Laravel + Vue fixture with `resources/js` beside `app/`, so one app tree is linted by Pint and PHPStan (PHP side) and ESLint and Prettier (Vue side) on every run; it carries one planted PHP error (`bad/BrokenGreeting.php`) and two planted Vue defects (`resources/js/bad/Broken.vue` missing a `v-for` key, `resources/js/bad/NoAlt.vue` missing an `alt`), and `tests/js/presets.test.mjs` gains five tests for the Vue side. ### 0.1.2 (2026-11-03) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-1-2-2026-11-03) - Added: PHPUnit tests for the PHPStan ignore rules in `phpstan/base.neon`, which run the raw preset against three one-class fixtures in `tests/fixtures/raw-ignores` and prove an `@phpstan-ignore` without a comment fails, an ignore that matches no error fails, and a commented ignore passes. - Added: PHPUnit tests for Pint's `--format=gitlab` output, which prove the messy `per` fixture becomes a non-empty GitLab Code Quality JSON array and the clean fixture becomes `[]`. - Added: a "Tool floors" section in the README with the PHP or Node floor of each locked tool, read verbatim from `composer.lock` and `package-lock.json` and checked by `tests/ToolFloorsTest.php`, so a dependency bump fails `composer ci` until the table is re-cut. - Added: `phpstan/laravel.neon` pins Larastan's `noEnvCallsOutsideOfConfig` rule on, with `tests/fixtures/laravel/src/EnvLeak.php` and `tests/fixtures/laravel/src/ConfigRead.php` proving the Laravel preset reports an `env()` call outside `config/` and accepts a `config()` call there. - Added: PHPUnit tests for the opt-in strict-types Pint presets, which run the real Pint against clean and missing fixtures for `pint/per-strict.json` and `pint/laravel-strict.json` and assert each strict config declares its preset and the `declare_strict_types` rule. - Added: `tests/js/prettier.test.mjs`, which runs the Prettier preset through Prettier's Node API on clean and messy JS and Vue fixtures and on the preset's own options, so `npm test` enforces the preset like the ESLint ones. - Added: PHPUnit tests for `pinstripe-baseline check --against=`, which build a throwaway git repository in a temp dir and assert the count at the ref and the exit codes. - Added: `npm-test` CI jobs on GitLab and GitHub that run `npm ci` then `npm test` on Node 22, so the ESLint and Prettier presets are covered in CI. - Changed: the GitHub workflow pins Preflight's reusable workflow by tag (0.1.2) instead of a SHA, as its comment intended. - Added: agent-ready site (prompt blocks, Markdown twins, llms.txt), from Squire's kit. - Pinned symfony/mime v7.4.22 in composer.lock, the fixed version for CVE-2026-45070 (PKSA-wtxr-p26d-nn42, GHSA-vqc8-7275-q272), so the audit step of `composer ci` passes. - Changed: project names written as words except acronyms. - Changed: the deploy layer's Squire kit is refreshed to 0.3.3 (release options can now live in ./.env.squire). - Changed: the deploy layer's Squire kit is refreshed to 0.3.4 (the local .env.squire file is now git-ignored). - Fixed: stale capability claims in the site and README. - Added: `tests/PackageVersionTest.php`, which fails `composer ci` when the `version` in `package.json` does not match the newest `## X.Y.Z (date)` heading in `CHANGELOG.md` or, on a tag pipeline, the tag itself, so npm can always publish from the tag; `package.json` is now 0.1.1, the version the 0.1.1 tag shipped without. - Changed: CI pulls its Docker Hub images through the GitLab Dependency Proxy (the group's CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX), so pipelines no longer hit Docker Hub's anonymous pull limit. - Changed: `deploy/composer.json` drops `minimum-stability: dev` (every constraint resolves at stable), and the PROCTOR job for `deploy/` in `.gitlab-ci.yml` drops `allow_failure`, since PROCTOR now passes on `deploy/`. - Changed: docs and package metadata name an internal GitLab as the canonical repository, with git.wayne.edu and GitHub as read-only mirrors, until git.wayne.edu has CI runners. ### 0.1.1 (2026-10-29) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-1-1-2026-10-29) - Fixed the raw and Laravel PHPStan cuts inheriting `reportMaybesInMethodSignatures` and `reportStaticMethodSignatures` from `phpstan/phpstan-strict-rules`, which made them report phpdoc method signature issues they should not; `base.neon` now pins both to false and `strict.neon` keeps them on. - Pinned the other eight parameters `phpstan/phpstan-strict-rules` forces on: four low-noise ones stay on in every cut, and `checkDynamicProperties`, `reportMaybesInPropertyPhpDocTypes`, `reportWrongPhpDocTypeInVarTag` and `reportNonIntStringArrayKey` are off in `base.neon` and on in `strict.neon`; the README lists each decision. ### 0.1.0 (2026-10-29) [#](https://pinstripe.apps.wayne.edu/docs/changelog.html#0-1-0-2026-10-29) - Added `bin/pinstripe-baseline`, which counts a PHPStan baseline's ignored errors (`count`) and fails when the baseline grows (`check --max=` or `check --against=`), so baselines only shrink. - Added `phpstan/strict.neon`, an opt-in PHPStan preset for new apps that turns on `phpstan/phpstan-strict-rules`. - Added `tests/fixtures/per`, a Pint fixture proving the `per` preset is the PER Coding Style. --- Source: https://pinstripe.apps.wayne.edu/docs/contributing.html ## Contributing [#](https://pinstripe.apps.wayne.edu/docs/contributing.html#contributing) This page explains how to build, test and change Pinstripe, and the rules every change must keep. ### Build and test [#](https://pinstripe.apps.wayne.edu/docs/contributing.html#build-and-test) | Task | Command | | --- | --- | | Install | `composer install` | | All PHP checks (what CI runs) | `composer ci` | | JS preset tests, Windows | `npm ci; npm test` | | JS preset tests, Linux and macOS | `npm ci && npm test` | With only Docker: ``` docker run --rm -v "${PWD}:/app" -w /app composer:2.11.1@sha256:8de2184c6de224f4689e8f80ed5f5edaf0030b6b8b7839a22a2bcb6722ac87d0 sh -c "composer install --no-interaction && composer ci" ``` `composer ci` runs `composer validate --strict`, PHPUnit, the agent-ready check (`php bin/agent-ready.php --check`), `composer audit` and the docs check (`php bin/docs-site.php --check`). The PHPUnit suite is the real check: it installs fixture apps and runs Pint, PHPStan and Rector with each preset against planted code, so a preset that stops catching something fails a test. `npm test` (`node --test`) covers the JS presets, and the pipeline runs it on Node 22, 24 and 26, so a broken ESLint or Prettier preset fails the build too. ### CI [#](https://pinstripe.apps.wayne.edu/docs/contributing.html#ci) - **GitLab:** Preflight's `php-test` (PHP 8.3, 8.4, 8.5), `composer-audit`, `proctor` (on `deploy/`) and `a11y` (on `site/`) components, pinned to 0.9.0, plus `composer-ci`, `npm-test` (Node 22, 24 and 26) and `wayneui-copies` jobs. - Green means `composer ci` passed on all three PHP versions and `npm test` passed on Node 22, 24 and 26. ### Changing a preset [#](https://pinstripe.apps.wayne.edu/docs/contributing.html#changing-a-preset) - A stricter preset breaks consumers' builds. Add the rule with a fixture that proves it, note it in the CHANGELOG, and ship it in a minor version so consumers opt in. - Keep the "Tested with" versions in the README in step with what the fixtures actually install. - When PHPStan, Pint, Larastan or Rector release a major version, bump the constraint here first and run the full suite. ### Rules a change must keep [#](https://pinstripe.apps.wayne.edu/docs/contributing.html#rules-a-change-must-keep) Every preset is enforced by a test that runs the real tool against a fixture, so a preset that stops working fails `composer ci` here instead of failing a developer's app. A preset is **Enforced** when a test asserts both directions: a clean fixture passes, and a deliberately broken one is caught. The PHP presets run under `composer ci` (PHPUnit); the JavaScript presets run under `npm test`. Both run in CI on GitLab and GitHub, so a preset that stops working fails the pipeline before it reaches an app. ### Related [#](https://pinstripe.apps.wayne.edu/docs/contributing.html#related) - [Best practices](https://pinstripe.apps.wayne.edu/docs/reference/best-practices.html) - [Releasing](https://pinstripe.apps.wayne.edu/docs/deploying/releasing.html) - [Upgrading](https://pinstripe.apps.wayne.edu/docs/upgrading.html) - [Changelog](https://pinstripe.apps.wayne.edu/docs/changelog.html) --- Source: https://pinstripe.apps.wayne.edu/docs/deploying/releasing.html ## Releasing [#](https://pinstripe.apps.wayne.edu/docs/deploying/releasing.html#releasing) This page sets out the steps to release Pinstripe, from the CHANGELOG to the npm publish. 1. Move the lines under `## Unreleased` in `CHANGELOG.md` to a new `## X.Y.Z (YYYY-MM-DD)` heading. 2. Set the same version in `package.json`, in the same release commit: `tests/PackageVersionTest.php` fails otherwise. In the same commit, rewrite the front page's "Just off the cutting table" note (`site/index.html`, then `composer site:agent-ready`) to lead with the new version and what it brought: `tests/FrontPageTest.php` fails while it names an older one. And rename the `## Unreleased` draft in `docs/upgrading.md` to the same `## X.Y.Z (YYYY-MM-DD)` heading (write the section if there is no draft: what changed for an app, the steps, how to verify): `tests/UpgradingTest.php` fails while a release has no section there. 3. `composer ci` and `npm test` green locally, then the git.wayne.edu pipeline green for that commit. 4. Run a secrets scan of the history and check that nothing internal is in the tree. 5. Tag `X.Y.Z` (no `v`) on git.wayne.edu. The push mirror carries the tag to GitHub, and Packagist picks it up from there. 6. **npm is published by hand,** after the tag, from a clean checkout of the tagged commit, by an owner of the `@waynestate` npm scope with two-factor auth: ``` npm ci --ignore-scripts npm test npm pack --dry-run npm publish --access public ``` `npm pack --dry-run` should list only `eslint/`, `prettier/`, `LICENSE`, `README.md` and `package.json`. Publishing cannot be undone, so check the version first with `npm view @waynestate/pinstripe version`. 7. A release needs a maintainer's approval. Never move or delete a published tag. Warning A release needs a maintainer's approval. Never move or delete a published tag. ### Related [#](https://pinstripe.apps.wayne.edu/docs/deploying/releasing.html#related) - [Changelog](https://pinstripe.apps.wayne.edu/docs/changelog.html) - [Best practices](https://pinstripe.apps.wayne.edu/docs/reference/best-practices.html) - [Tested with and tool floors](https://pinstripe.apps.wayne.edu/docs/reference/tested-with.html) --- Source: https://pinstripe.apps.wayne.edu/docs/guides/adopting.html ## Adopting on an existing app [#](https://pinstripe.apps.wayne.edu/docs/guides/adopting.html#adopting-on-an-existing-app) Adopt Pinstripe on an existing app by baselining the legacy findings once, then keeping every exception honest. ### Generate the baseline once [#](https://pinstripe.apps.wayne.edu/docs/guides/adopting.html#generate-the-baseline-once) Generate a baseline with `phpstan analyse --generate-baseline`, include it in your `phpstan.neon`, and only ever shrink it. New code gets no baseline. A baseline is a tailor's chalk line: it marks the fabric as it is, and every release you take it in, never let it out. Some errors cannot go into a baseline. PHPStan says `Some errors could not be put into baseline` and the run stays red; on the 2026-11-05 [proof run](https://pinstripe.apps.wayne.edu/docs/reference/proof.html) these were classes that extend a class PHPStan cannot find, usually because that code lives in a folder outside `paths` or in a nested app with its own `vendor/`. Fix how PHPStan finds the code first (add the folder to `paths`, or to `scanDirectories` when it is not yours), then generate the baseline again. ### Keep Pint off code that is not yours [#](https://pinstripe.apps.wayne.edu/docs/guides/adopting.html#keep-pint-off-code-that-is-not-yours) When the app bundles a third-party library in its own tree (a PDF or spreadsheet library copied in years ago), point Pint at your own folders instead of the whole app, for example `pint --test --config vendor/waynestate/pinstripe/pint/per.json src public`. Restyling a library you do not maintain makes every later update of it a conflict, and very large generated files, such as a PDF library's font maps, can keep Pint busy for many minutes. ### Ignore comments must say why [#](https://pinstripe.apps.wayne.edu/docs/guides/adopting.html#ignore-comments-must-say-why) Every cut sets `reportIgnoresWithoutComments` and `reportUnmatchedIgnoredErrors`, so the preset reports an `@phpstan-ignore` that has no comment in parentheses and one whose identifier no longer matches an error on that line. The correct form keeps the reason and the exit plan on the same line: ```php public function name(?string $v): string { // @phpstan-ignore return.type (why this is safe, and the plan to remove it) return $v; } ``` Pinstripe tests all three cases: the bare ignore fails, the unmatched ignore fails, and the commented one passes. Warning An ignore without a reason is a pin left in the cushion: nobody remembers why it was there, and it pokes the next tailor. ### Related [#](https://pinstripe.apps.wayne.edu/docs/guides/adopting.html#related) - [The strict cut](https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html) - [Baselines only shrink](https://pinstripe.apps.wayne.edu/docs/guides/baselines.html) - [Raw PHP apps](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html) - [Laravel apps](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html) - [ADR-0001: PHPStan level 8 and baselines](https://pinstripe.apps.wayne.edu/docs/adr/0001-phpstan-level-and-baseline-policy.html) --- Source: https://pinstripe.apps.wayne.edu/docs/guides/baselines.html ## Baselines only shrink [#](https://pinstripe.apps.wayne.edu/docs/guides/baselines.html#baselines-only-shrink) Keep a PHPStan baseline from growing by counting it and failing the build the moment it does. Pinstripe ships `pinstripe-baseline`, one PHP command that runs on every OS, to keep that promise. It reads both the NEON baseline and the PHP format (`phpstan-baseline.php`). ### Opt in first [#](https://pinstripe.apps.wayne.edu/docs/guides/baselines.html#opt-in-first) A baseline is only for apps adopting Pinstripe late; new apps never set it. The app opts in from its own `composer.json`: ```json { "extra": { "pinstripe": { "legacy": true } } } ``` Every command checks the flag before it reads the baseline. Without it, `pinstripe-baseline` exits 2 and says how to add it. In a monorepo, point the command at another composer.json with `--composer=` (default: `composer.json` in the current working directory). ### Count the baseline [#](https://pinstripe.apps.wayne.edu/docs/guides/baselines.html#count-the-baseline) ``` vendor/bin/pinstripe-baseline count phpstan-baseline.neon ``` prints how many errors the baseline ignores: the sum of each entry's `count`, 1 when `count` is absent. ### Check against a limit [#](https://pinstripe.apps.wayne.edu/docs/guides/baselines.html#check-against-a-limit) ``` vendor/bin/pinstripe-baseline check --max=42 phpstan-baseline.neon ``` exits 1 with `baseline grew: N errors, the most allowed is M` when the count is above the limit, 0 otherwise. ### Check against the target branch [#](https://pinstripe.apps.wayne.edu/docs/guides/baselines.html#check-against-the-target-branch) To compare with the target branch instead of a fixed number, pass a git ref: ``` vendor/bin/pinstripe-baseline check --against=origin/main phpstan-baseline.neon ``` In GitLab CI the merge request's base SHA is already in the environment: ``` vendor/bin/pinstripe-baseline check --against=$CI_MERGE_REQUEST_DIFF_BASE_SHA phpstan-baseline.neon ``` ### The policy [#](https://pinstripe.apps.wayne.edu/docs/guides/baselines.html#the-policy) An existing app may generate a baseline once with `phpstan analyse --generate-baseline` and include it in its `phpstan.neon`; new code gets no baseline. The count a baseline holds is the sum of each entry's `count`, 1 when `count` is absent, and `pinstripe-baseline count` prints it. `bin/pinstripe-baseline check` fails the build (exit 1) when the baseline grows, either against a fixed limit with `--max=` or against a git ref with `--against=`; in GitLab CI the merge request's base SHA is already in the environment as `$CI_MERGE_REQUEST_DIFF_BASE_SHA`. Exit codes: 0 ok, 1 the baseline grew, 2 usage or baseline problem. Note A baseline is a tailor's chalk line, and this command is the tape measure: it fails the build the moment the line gets longer. The policy behind this section is recorded in [the ADR](https://pinstripe.apps.wayne.edu/docs/adr/0001-phpstan-level-and-baseline-policy.html). ### Related [#](https://pinstripe.apps.wayne.edu/docs/guides/baselines.html#related) - [Adopting on an existing app](https://pinstripe.apps.wayne.edu/docs/guides/adopting.html) - [The strict cut](https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html) - [Raw PHP apps](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html) - [Laravel apps](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html) --- Source: https://pinstripe.apps.wayne.edu/docs/guides/laravel.html ## Laravel apps [#](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html#laravel-apps) This guide shows how to point a Laravel app at Pinstripe's shared presets for Pint and PHPStan, with the Laravel parts included. ### Install [#](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html#install) Add Pinstripe and Larastan as dev dependencies: ``` composer config allow-plugins.phpstan/extension-installer true composer require --dev waynestate/pinstripe:^0.4 larastan/larastan ``` `^0.4` gets you 0.4.0, the current release. If Composer cannot find it yet (Packagist reads the GitHub mirror, which can trail a release), add the canonical repository first, as [Raw PHP apps](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html#add-the-dependency) shows. Note Pinstripe loads its PHPStan rules through `phpstan/extension-installer`, and Composer will not ask when it cannot prompt. Pinstripe pulls in `phpstan/extension-installer`, which registers Larastan for you. When Composer asks, allow the plugin (`config.allow-plugins` in your `composer.json`). If Composer stops because a package your app already locks (often an older PHPStan) does not fit, run the same `composer require` again with `-W`, as Composer suggests, so it may update that package too. ### Configure [#](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html#configure) Your `phpstan.neon` includes `vendor/waynestate/pinstripe/phpstan/laravel.neon` and nothing else: there is no Larastan line to add, and the scripts point at `vendor/waynestate/pinstripe/pint/laravel.json`. ### The env() rule [#](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html#the-env-rule) The Laravel preset also rejects `env()` outside `config/`: once the config is cached, `env()` returns null, so read config with `config()` instead. The rule is Larastan's, and `phpstan/laravel.neon` pins it on. The environment is not a hand-me-down: take the config out of the wardrobe. ### Banned calls [#](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html#banned-calls) Every cut also fails on `eval()`, `extract()`, `var_dump()`, `dd()`, `dump()` and the HTTP client's `withoutVerifying()`, whether you call it as `Http::withoutVerifying()` or partway down a chain, and on the long way round to the same hole, `withOptions(['verify' => false])` (Guzzle's `verify` option set to false, in Laravel or in Guzzle itself). Laravel's own `dd()` and `dump()` methods count as well (`$users->dd()`, `DB::table('users')->dumpRawSql()`, `$request->dump()`, `Http::get($url)->dd()`), under the same identifiers as the functions. So does SQL joined from strings: `DB::select('... id = ' . $id)` and the connection's other calls (`insert()`, `update()`, `delete()`, `statement()`, `scalar()`, `cursor()`, `fromQuery()`) want literal SQL with bindings, and Laravel's own `literal-string` types already hold `DB::raw()`, `DB::unprepared()` and `whereRaw()` and the other raw builder methods to the same rule. The [Banned calls](https://pinstripe.apps.wayne.edu/docs/reference/banned-calls.html) page says why and what to use instead. ### Proven on Laravel [#](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html#proven-on-laravel) `composer ci` lints a minimal Laravel 13 app (`tests/fixtures/laravel-app`) with `pint/laravel.json` and analyzes it with `phpstan/laravel.neon` on every run, and fails if the app stops passing. A smaller fixture (`tests/fixtures/laravel`) proves the preset really loads Larastan: it plants an undefined Eloquent property that only Larastan reports, and a clean twin it leaves alone. The combined fixture `tests/fixtures/laravel-vue` is one app tree with both PHP and Vue files, with `resources/js` beside `app/`. `composer ci` lints its PHP side with Pint and PHPStan, and `npm test` lints its Vue side with ESLint and Prettier, on every run, with one planted PHP error and two planted Vue defects that each preset must report. ### Related [#](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html#related) - [Raw PHP apps](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html) - [Require strict types](https://pinstripe.apps.wayne.edu/docs/guides/strict-types.html) - [The strict cut](https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html) - [Adopting on an existing app](https://pinstripe.apps.wayne.edu/docs/guides/adopting.html) - [Best practices](https://pinstripe.apps.wayne.edu/docs/reference/best-practices.html) --- Source: https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html ## Raw PHP apps [#](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html#raw-php-apps) Point a raw PHP app at the Pinstripe presets: Pint for style, PHPStan at level 8 for analysis. ### Add the dependency [#](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html#add-the-dependency) Add Pinstripe as a dev dependency: ```bash composer config allow-plugins.phpstan/extension-installer true composer require --dev waynestate/pinstripe:^0.4 ``` Pinstripe loads its PHPStan rules through `phpstan/extension-installer`, and Composer will not ask when it cannot prompt. If Composer stops because a package your app already locks (often an older PHPStan) does not fit, run the same `composer require` again with `-W`, as Composer suggests, so it may update that package too. `^0.4` gets you 0.4.0, the current release, with every [banned call](https://pinstripe.apps.wayne.edu/docs/reference/banned-calls.html). Packagist reads the GitHub mirror, which can trail a release by a while. If Composer says it cannot find a 0.4 version, point it at the canonical repository first (it asks for your git.wayne.edu sign-in), then run the `composer require` again: ```bash composer config repositories.pinstripe vcs https://git.wayne.edu/enterprise-apps/pinstripe.git ``` The npm package, `@waynestate/pinstripe`, is published by hand after each tag; `npm view @waynestate/pinstripe version` shows where it is. The ESLint and Prettier presets have not changed since 0.1.4, so any version from 0.1.4 up is today's cut. ### Point PHPStan at the raw config [#](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html#point-phpstan-at-the-raw-config) `phpstan.neon`: ```neon includes: - vendor/waynestate/pinstripe/phpstan/raw.neon parameters: paths: - app ``` ### Add Composer scripts [#](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html#add-composer-scripts) Add Composer scripts that run on every OS: ```json { "scripts": { "lint": "pint --test --config vendor/waynestate/pinstripe/pint/per.json", "fix": "pint --config vendor/waynestate/pinstripe/pint/per.json", "analyse": "phpstan analyse" } } ``` `composer lint` fails on style. `composer fix` fixes it. Pint's `per` preset is the PER Coding Style, and `tests/fixtures/per` keeps a clean and a messy proof. `composer analyse` runs PHPStan at level 8, with deprecation checks too. Pinstripe ships `phpstan/phpstan-deprecation-rules`, loaded automatically by `phpstan/extension-installer`. Calling a `@deprecated` method fails the build. The tailor flags the old cut before the fabric is retired. It also fails on `eval()`, `extract()`, `var_dump()`, `dd()` and `dump()`, and on TLS checks turned off through curl (`CURLOPT_SSL_VERIFYPEER` false, `CURLOPT_SSL_VERIFYHOST` 0), a stream context (`verify_peer` false) or Guzzle (`'verify' => false`), and on SQL joined from strings through PDO, mysqli or `oci_parse()` (bind the values instead): the [Banned calls](https://pinstripe.apps.wayne.edu/docs/reference/banned-calls.html) page says why and what to use instead. ### Show Pint findings in the merge request [#](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html#show-pint-findings-in-the-merge-request) Add a second script that writes the report to a file: ```json { "scripts": { "lint:gitlab": "pint --test --config vendor/waynestate/pinstripe/pint/per.json --format=gitlab > pint-codequality.json" } } ``` Point GitLab at the artifact, and keep it when the job fails, which is exactly when it has something to show: ```yaml artifacts: when: always reports: codequality: pint-codequality.json ``` `--format=gitlab` writes GitLab's Code Quality JSON and `[]` when the code is clean, and Pinstripe tests both. Chalk marks wash out; these findings stay pinned to the merge request. ### Show PHPStan findings in the merge request [#](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html#show-phpstan-findings-in-the-merge-request) PHPStan writes the same report with its own `gitlab` error format: ```json { "scripts": { "analyse:gitlab": "phpstan analyse --no-progress --error-format=gitlab > phpstan-codequality.json" } } ``` ```yaml artifacts: when: always reports: codequality: phpstan-codequality.json ``` Each finding carries its identifier (`pinstripe.banned.joinedSql`, `argument.type`) as the check name. Pinstripe tests both sides: the raw preset turns the null bug fixture into a non-empty report and the clean fixture into `[]`. ### Related [#](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html#related) - [Overview](https://pinstripe.apps.wayne.edu/docs/index.html) - [Require strict types](https://pinstripe.apps.wayne.edu/docs/guides/strict-types.html) - [Laravel apps](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html) - [The strict cut](https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html) - [Baselines only shrink](https://pinstripe.apps.wayne.edu/docs/guides/baselines.html) --- Source: https://pinstripe.apps.wayne.edu/docs/guides/rector.html ## Rector [#](https://pinstripe.apps.wayne.edu/docs/guides/rector.html#rector) This guide shows how to use the Pinstripe Rector preset to modernize code for the PHP version your app already supports. ### Install [#](https://pinstripe.apps.wayne.edu/docs/guides/rector.html#install) Add Rector as a dev dependency: ``` composer require --dev rector/rector ``` ### Configure [#](https://pinstripe.apps.wayne.edu/docs/guides/rector.html#configure) Create `rector.php` and use the Pinstripe preset, adding only your own paths: ```php withPaths([__DIR__ . '/src']); ``` The preset reads the PHP floor from your app's own `composer.json`, so it cannot drift out of step with the version the app actually runs on. ### Laravel upgrade rules [#](https://pinstripe.apps.wayne.edu/docs/guides/rector.html#laravel-upgrade-rules) The preset turns on Rector's composer-based Laravel sets with `withComposerBased(laravel: true)`. Add `driftingly/rector-laravel` as a dev dependency and the preset applies the Laravel upgrade rules that match your app's installed `laravel/framework` version: ``` composer require --dev driftingly/rector-laravel ``` Without the package the call is a no-op, so an app that does not want Laravel rules sees no change. ### Run [#](https://pinstripe.apps.wayne.edu/docs/guides/rector.html#run) Check with `vendor/bin/rector process --dry-run` and apply with `vendor/bin/rector process`. ### Strict types, file by file [#](https://pinstripe.apps.wayne.edu/docs/guides/rector.html#strict-types-file-by-file) A second, opt-in preset, `rector/strict-types.php`, adds `declare(strict_types=1)` only to the files where it cannot change what the code does. Keep it in its own config so its diff is only declarations. [Require strict types](https://pinstripe.apps.wayne.edu/docs/guides/strict-types.html) walks through it. ### One level at a time, on a big old app [#](https://pinstripe.apps.wayne.edu/docs/guides/rector.html#one-level-at-a-time-on-a-big-old-app) On an app that has never met Rector, the base preset's four whole sets make one diff nobody can review. The opt-in preset `rector/levels.php` returns a function instead: name a rule family and how far up it goes, and Rector applies only that family's first rules, safest first. ```php withPaths([__DIR__ . '/src']); ``` | Family | What it runs | | --- | --- | | `deadCode` | Rector's dead-code rules: unused foreach keys first, then useless casts, and on up. | | `typeCoverage` | Return, parameter and property types, from the rules that can only be right (a closure that returns nothing gets `: void`) upward. | | `codeQuality` | Code-quality fixes, smallest first. | | `php` | The PHP-version rules one at a time, still capped at the PHP floor in your `composer.json`. | Each family stays off until you name it, and calling `$levels()` with none throws. Level 0 is the first rule, not "off". The climb: 1. Dry-run with `vendor/bin/rector process --dry-run`, review the diff, apply it, run your tests, commit. 2. Raise the number by one in the next merge request. 3. When a family is whole (Rector says so when the level passes its last rule), start the next one: `$levels(deadCode: 40, typeCoverage: 0)`. 4. When every family runs whole, switch to `rector/base.php`. The levels preset leaves out the base preset's import tidying and Laravel upgrade rules on purpose, because each of those touches every file at once. A suit is altered one fitting at a time. ### Proven on fixtures [#](https://pinstripe.apps.wayne.edu/docs/guides/rector.html#proven-on-fixtures) `composer ci` runs the preset against a modern app (`tests/fixtures/rector-clean`) and an old-style one (`tests/fixtures/rector-old`) on every run, and fails if the clean one changes or the old one is left alone. Rector is the tailor's press: it smooths old code to the standard without changing the cut. The levels preset has its own fixture, `tests/fixtures/rector-levels`, with one planted fix per step and three configs: `deadCode: 0` must change only the unused foreach key, `deadCode: 2` must also drop the useless cast, and `typeCoverage: 0` must type the closure and touch no dead code. ### Related [#](https://pinstripe.apps.wayne.edu/docs/guides/rector.html#related) - [Raw PHP apps](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html) - [The strict cut](https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html) - [Require strict types](https://pinstripe.apps.wayne.edu/docs/guides/strict-types.html) - [Adopting on an existing app](https://pinstripe.apps.wayne.edu/docs/guides/adopting.html) - [Best practices](https://pinstripe.apps.wayne.edu/docs/reference/best-practices.html) --- Source: https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html ## The strict cut [#](https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html#the-strict-cut) Point a new app at the strict PHPStan cut so loose comparisons and the strict rules fail the build. ### Choose the strict cut [#](https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html#choose-the-strict-cut) New apps can include `vendor/waynestate/pinstripe/phpstan/strict.neon` instead of `raw.neon` or `laravel.neon`. It keeps the base cut and turns on `phpstan/phpstan-strict-rules`, so loose comparisons like `==` fail the build. Existing apps stay on the base cut and baseline their way over. ### What the strict cut adds [#](https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html#what-the-strict-cut-adds) PHPStan checks phpdoc method signatures from level 3 up, and `phpstan/phpstan-strict-rules` forces the two switches behind them on for every run it is installed for. The base cut pins `reportMaybesInMethodSignatures` and `reportStaticMethodSignatures` off so it stays exactly as documented; the strict cut keeps them on, so it also reports maybe-mismatched overrides and static method overrides. ### The eight extra switches [#](https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html#the-eight-extra-switches) `phpstan/phpstan-strict-rules` forces eight more switches on for every run as well. Each one is decided below: low noise and real bugs stay on in every cut, noisy ones are pinned off in the base cut and turned on only in `strict.neon`. | Parameter | Raw and Laravel cuts | Strict cut | Why | | --- | --- | --- | --- | | `checkExplicitMixedMissingReturn` | on | on | A function declared to return `mixed` that can fall off the end is a real bug, and rare in practice. | | `checkFunctionNameCase` | on | on | A wrongly cased function name works on Windows and macOS and breaks on Linux. | | `checkInternalClassCaseSensitivity` | on | on | The same case bug for PHP's own classes. | | `checkStrictPrintfPlaceholderTypes` | on | on | `%d` fed a string is a real formatting bug, and rare. | | `checkDynamicProperties` | off | on | Floods legacy code with undeclared properties. | | `reportMaybesInPropertyPhpDocTypes` | off | on | Reports "maybe" phpdoc mismatches that legacy docblocks trip constantly. | | `reportWrongPhpDocTypeInVarTag` | off | on | Old `@var` tags are often loose; fixing them is cleanup, not bug hunting. | | `reportNonIntStringArrayKey` | off | on | Bleeding-edge check that is noisy on loosely keyed arrays. | Note Strict is the tailor's chalk line drawn before the first stitch. ### Related [#](https://pinstripe.apps.wayne.edu/docs/guides/strict-cut.html#related) - [Adopting on an existing app](https://pinstripe.apps.wayne.edu/docs/guides/adopting.html) - [Baselines only shrink](https://pinstripe.apps.wayne.edu/docs/guides/baselines.html) - [Raw PHP apps](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html) - [Laravel apps](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html) - [ADR-0001: PHPStan level 8 and baselines](https://pinstripe.apps.wayne.edu/docs/adr/0001-phpstan-level-and-baseline-policy.html) --- Source: https://pinstripe.apps.wayne.edu/docs/guides/strict-types.html ## Require strict types [#](https://pinstripe.apps.wayne.edu/docs/guides/strict-types.html#require-strict-types) Opt in to `declare(strict_types=1)` so every file Pint touches carries the declaration. ### Point the scripts at the strict preset [#](https://pinstripe.apps.wayne.edu/docs/guides/strict-types.html#point-the-scripts-at-the-strict-preset) Opt-in. Point `composer lint` and `composer fix` at the strict preset instead of `per.json`: ```json { "scripts": { "lint": "pint --test --config vendor/waynestate/pinstripe/pint/per-strict.json", "fix": "pint --config vendor/waynestate/pinstripe/pint/per-strict.json" } } ``` Warning `composer fix` adds `declare(strict_types=1);` to every file it touches, so run your tests first and commit the change on its own. Strict types leave no loose threads. ### The careful route on a big app [#](https://pinstripe.apps.wayne.edu/docs/guides/strict-types.html#the-careful-route-on-a-big-app) A file that passes `'3'` to an `int` parameter works today and throws a `TypeError` the day it turns strict. On an old app, let Rector declare strict types only where nothing changes. `rector/strict-types.php` runs Rector's `SafeDeclareStrictTypesRector` and nothing else: it reads every call, attribute, return and property assignment in a file, and declares strict types only when none of them leans on PHP's type juggling. The other files are left for a later run. Keep it in a config of its own, so its diff is only declarations and lands in a commit of its own: ```php withPaths([__DIR__ . '/src']); ``` Then: 1. `vendor/bin/rector process --dry-run -c rector-strict-types.php` lists the files that are ready. 2. `vendor/bin/rector process -c rector-strict-types.php` declares them. Run your tests and commit. 3. Run it again after other fixes (Rector's type declarations, PHPStan findings) add types: the list grows. 4. Once every file is declared, point `composer lint` at `per-strict.json` or `laravel-strict.json`, so a new file cannot slip in without it. Measure twice, declare once. ### Covered by tests [#](https://pinstripe.apps.wayne.edu/docs/guides/strict-types.html#covered-by-tests) Pinstripe runs the real Pint against clean and missing fixtures for `pint/per-strict.json` and `pint/laravel-strict.json`, and asserts each strict config declares its preset and the `declare_strict_types` rule. It also runs the real Rector with `rector/strict-types.php` on `tests/fixtures/rector-strict-types`: the preset must declare `Measure.php`, whose calls pass the types they ask for, and leave `Hem.php` (it passes the string `'3'` to `str_repeat()`) and the already strict `Lapel.php` alone. ### Related [#](https://pinstripe.apps.wayne.edu/docs/guides/strict-types.html#related) - [Overview](https://pinstripe.apps.wayne.edu/docs/index.html) - [Raw PHP apps](https://pinstripe.apps.wayne.edu/docs/guides/raw-php.html) - [Laravel apps](https://pinstripe.apps.wayne.edu/docs/guides/laravel.html) - [Rector](https://pinstripe.apps.wayne.edu/docs/guides/rector.html) --- Source: https://pinstripe.apps.wayne.edu/docs/guides/vue.html ## Vue [#](https://pinstripe.apps.wayne.edu/docs/guides/vue.html#vue) This guide shows how to point a Vue app at Pinstripe's ESLint and Prettier presets. ### Install [#](https://pinstripe.apps.wayne.edu/docs/guides/vue.html#install) Add Pinstripe as a dev dependency: ``` npm install --save-dev @waynestate/pinstripe eslint prettier ``` ### Configure ESLint [#](https://pinstripe.apps.wayne.edu/docs/guides/vue.html#configure-eslint) Create `eslint.config.js` and spread the preset. For TypeScript: ```js import pinstripe from '@waynestate/pinstripe/eslint/typescript' export default [...pinstripe] ``` For plain JavaScript, import `@waynestate/pinstripe/eslint/javascript` instead. #### Typed linting [#](https://pinstripe.apps.wayne.edu/docs/guides/vue.html#typed-linting) The TypeScript preset lints with types (typescript-eslint's `recommendedTypeChecked`, through `projectService`), so it catches what the syntax alone cannot. A promise nobody awaits is the classic: the save button looks done, and the error vanishes into the night. ```ts async function save(): Promise {} save() // @typescript-eslint/no-floating-promises: await it, return it, or mark it with void ``` That fails lint in a `.ts` file and in a `.vue` file's `