Skip to content

feat!: drop the Request::getContentType() fallbacks - #8517

Merged
soyuka merged 2 commits into
api-platform:mainfrom
Maxcastel:feat/drop-request-get-content-type-fallbacks
Sep 11, 2026
Merged

feat!: drop the Request::getContentType() fallbacks#8517
soyuka merged 2 commits into
api-platform:mainfrom
Maxcastel:feat/drop-request-get-content-type-fallbacks

Conversation

@Maxcastel

@Maxcastel Maxcastel commented Sep 9, 2026

Copy link
Copy Markdown
Contributor
Q A
Branch? main
Tickets n/a
License MIT
Doc PR n/a
  • getContentTypeFormat() was added in Symfony 6.2
  • getContentType() was removed in Symfony 7.0

https://github.com/symfony/symfony/blob/7.4/src/Symfony/Component/HttpFoundation/CHANGELOG.md

The Symfony floor is ^7.4 || ^8.0, so the guard always evaluates to true and the fallback calls a method that cannot exist.

@soyuka
soyuka merged commit 906a36d into api-platform:main Sep 11, 2026
16 of 111 checks passed
soyuka added a commit to soyuka/core that referenced this pull request Sep 11, 2026
api-platform#8517 removed the Request::getContentType() fallbacks and the
method_exists() guards around getContentTypeFormat(), but kept the
ignore patterns targeting them, so phpstan reports them as unmatched.
Neither has a call site left.
soyuka added a commit that referenced this pull request Sep 11, 2026
* fix(test): use the extracted ApiTestCase namespace

#7887 moved the test helpers to ApiPlatform\Test and deleted
src/Symfony/Bundle/Test. 11 test files still referenced the old FQCN,
either merged on main after #7887 or brought up from 4.3/4.4. The
resulting fatal took down the whole PHPUnit matrix and PHPStan.

Also stubs getFunction('csp_nonce') on the Twig double in
EntrypointActionTest: #8310 updated GraphiQlActionTest but missed this
one, which builds the same GraphiQlAction.

* feat(symfony): deprecate the moved test helper classes

#7887 moved eight public classes out of api-platform/symfony without a
deprecation path, so user test suites extending ApiTestCase break on a
plain "class not found". Restore them at the old FQCNs as deprecated
shims delegating to ApiPlatform\Test.

Client, Response, ArraySubset and MatchesJsonSchema are final and
cannot be subclassed, so they are class_alias'd; the traits are wrapped;
ApiTestCase subclasses. Adds api-platform/test and
symfony/deprecation-contracts to the component requirements.

* fix(symfony): satisfy cs-fixer and phpstan on the shims

CS Fixer's fully_qualified_strict_types applies to docblocks, so the
{@see} tags must use the imported alias. PHPStan reports trait.unused
for the three trait shims, which exist only for BC and are legitimately
used nowhere in the monorepo.

* fix: drop phpstan ignores left dead by #8517

#8517 removed the Request::getContentType() fallbacks and the
method_exists() guards around getContentTypeFormat(), but kept the
ignore patterns targeting them, so phpstan reports them as unmatched.
Neither has a call site left.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants