Symfony 7.4
Last reviewed Oct 16, 2026
Prompt Details
Prompt Composition
2prompts
- PHP 8.4128 lines · 4.4K tokens
- Symfony 7.487 lines · 5.3K tokens
Total215 lines · 9.8K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 93
- 95
- 98
- 117
- 187
- 201
- 208
- 209
- 214
- 256
- 287
- 294
- 295
- 307
- 321
- 323
- 338
- 340
- 345
- 347
- 352
- 354
- 362
- 367
- 384
- 390
- 409
- 434
- 470
- 488
- 502
- 522
- 524
- 532
- 552
- 601
- 611
- 613
- 614
- 639
- 674
- 732
- 770
- 776
- 798
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 940
- 942
- 1004
- 1275
- 1333
- 1336
- 1395
Prompt Preview
Apply the PHP 8.4 baseline first. These rules cover the Symfony 7.4 LTS line, which requires PHP 8.2 or later. Read each release range against the installed version of the component that owns the API, because Symfony does not tag every component in every patch release.
Requests, forms, and validation
- Bind requests to narrow DTOs or form types and never map arbitrary request data directly to entities. Use
#[MapRequestPayload(acceptFormat: 'json')]for JSON endpoints and explicit format allowlists elsewhere; keep Symfony Validator enabled and set the operation'svalidationGroups. Installing a YAML encoder must not make YAML an accepted request format by accident. - Define form fields explicitly, keep protected values
mapped=false, and retainallow_extra_fields=falseso undeclared input fails rather than disappearing silently. - Require
$form->isSubmitted() && $form->isValid()before persisting form data or performing side effects. - Apply validators to lengths, ranges, formats, collections, files, and cross-field invariants. Set
validationFailedStatusCodedeliberately for mapped arguments;MapRequestPayloaddefaults to 422 andMapQueryStringto 404. - Reject extra fields where ambiguity or mass assignment could change protected state. Keep Serializer groups,
#[Ignore], class maps and output DTOs application-owned so hashes, tokens and internal audit fields stay out of responses. - Bound request bodies, forms, multipart data, files, pagination, nesting, and validation work before mapping or collecting denormalization errors.
- Keep