Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add PHP CS Fixer rule to format GraphQL heredocs#73

Merged
ruudk merged 2 commits into
mainfrom
claude/graphql-phpcsfixer-heredoc
May 15, 2026
Merged

Add PHP CS Fixer rule to format GraphQL heredocs#73
ruudk merged 2 commits into
mainfrom
claude/graphql-phpcsfixer-heredoc

Conversation

@ruudk
Copy link
Copy Markdown
Owner

@ruudk ruudk commented May 15, 2026

Introduces GraphQLHeredocFixer which reformats the GraphQL operation
inside <<<'GRAPHQL' ... GRAPHQL nowdoc strings using
webonyx/graphql-php Printer::doPrint, indented to match the heredoc.
Only single-quoted nowdocs are touched (a heredoc would interpolate
GraphQL $variables); invalid GraphQL is left untouched. Runs before
heredoc_indentation so re-indentation stays a no-op.

Wired into .php-cs-fixer.php and applied to the existing fixtures so
they use the canonical formatting. Covered by a functional test that
drives the real php-cs-fixer token pipeline over fixture files, and
documented in the README.

https://claude.ai/code/session_0172zkGgfrZ2KQ8ngMJ1X3zr

claude added 2 commits May 15, 2026 18:02
Introduces GraphQLHeredocFixer which reformats the GraphQL operation
inside `<<<'GRAPHQL' ... GRAPHQL` nowdoc strings using
webonyx/graphql-php Printer::doPrint, indented to match the heredoc.
Only single-quoted nowdocs are touched (a heredoc would interpolate
GraphQL $variables); invalid GraphQL is left untouched. Runs before
heredoc_indentation so re-indentation stays a no-op.

Wired into .php-cs-fixer.php and applied to the existing fixtures so
they use the canonical formatting. Covered by a functional test that
drives the real php-cs-fixer token pipeline over fixture files, and
documented in the README.

https://claude.ai/code/session_0172zkGgfrZ2KQ8ngMJ1X3zr
Avoids php-cs-fixer's @internal extension API (AbstractFixer,
WhitespacesAnalyzer) so the PHPStan internal-class ignores can be
dropped. Indentation is now detected from the token stream directly,
and the fixer is registered the standard way via
registerCustomFixers() instead of the TicketSwap NameWrapper.

https://claude.ai/code/session_0172zkGgfrZ2KQ8ngMJ1X3zr
@ruudk ruudk force-pushed the claude/graphql-phpcsfixer-heredoc branch from 40356f4 to b1f2684 Compare May 15, 2026 18:03
@ruudk ruudk merged commit a95b4ae into main May 15, 2026
3 checks passed
@ruudk ruudk deleted the claude/graphql-phpcsfixer-heredoc branch May 15, 2026 18:04
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