-
Notifications
You must be signed in to change notification settings - Fork 0
Added phpcs #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added phpcs #32
Conversation
WalkthroughThe changes introduce PHP CodeSniffer to the project for code style enforcement, updating the Composer configuration, adding a PHPCS config file, and integrating code sniffing into the CI workflow. Minor code formatting adjustments and namespace improvements were made in source and test files, without altering application logic or exported entities. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant GitHub Actions
participant Composer
participant PHPCS
Developer->>GitHub Actions: Open Pull Request
GitHub Actions->>Composer: Run PHPUnit tests
GitHub Actions->>Composer: Run "composer phpcs"
Composer->>PHPCS: Execute code sniffing
PHPCS-->>GitHub Actions: Return style check results
GitHub Actions-->>Developer: Report test and style results
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
phpcs.xml (2)
5-10
: Verify and clarify CLI option tags
You’ve added<arg>
elements to enable progress, colors, and sniff codes by default. Please confirm that PHPCS recognizes the short flags (value="p"
,value="s"
) and the flag withoutvalue
for colors in this context. For better readability and maintainability, consider using the full option names instead of shorthand flags:- <arg value="p"/> + <arg name="report-progress"/> <!-- Use colors in output --> - <arg name="colors"/> + <arg name="colors"/> - <arg value="s"/> + <arg name="report-sniff-codes"/>
15-17
: Use<directory>
tags for clarity
PHPCS supports<directory>
to indicate folders explicitly. Switching from<file>
to<directory>
makes your intent clearer when targeting entire directories:- <file>src</file> - <file>tests</file> + <directory>src</directory> + <directory>tests</directory>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.github/workflows/on_pull_request.yml
(1 hunks)composer.json
(2 hunks)phpcs.xml
(1 hunks)src/DebugExtension.php
(1 hunks)src/DebugPrintVarModifier.php
(1 hunks)tests/DebugExtensionTest.php
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/DebugExtensionTest.php (1)
src/DebugExtension.php (1)
DebugExtension
(12-28)
🔇 Additional comments (11)
composer.json (3)
22-26
: Approve autoload-dev mapping for test namespace.
The new PSR-4autoload-dev
entry correctly mapsImponeer\Smarty\Extensions\Debug\Tests\
totests/
, ensuring test classes are properly autoloaded.
35-37
: Approve addition of PHP CodeSniffer to require-dev.
Includingsquizlabs/php_codesniffer
alongside PHPUnit inrequire-dev
enables local style checks without impacting production dependencies.
39-42
: Approve newphpcs
andphpcbf
scripts.
Adding these scripts underscripts
allows developers and CI to run style checks (composer phpcs
) and auto-fixes (composer phpcbf
) with a single command.src/DebugExtension.php (1)
23-23
: Approve formatting change inmatch
expression.
Inserting a space aftermatch
aligns with PSR-12 style requirements without altering behavior..github/workflows/on_pull_request.yml (1)
37-38
: Approve CI integration of PHP CodeSniffer.
The new workflow stepPHP CodeSniffer
runningcomposer phpcs
immediately after tests ensures style compliance on every pull request.tests/DebugExtensionTest.php (3)
3-3
: Approve namespace update for tests.
Moving the test class intoImponeer\Smarty\Extensions\Debug\Tests
aligns with the newautoload-dev
configuration.
9-9
: Approve addition ofstdClass
import.
ImportingstdClass
is required for the object-based data provider scenario.
84-84
: Approve spacing around concatenation operator.
Adjusting the concatenation to'eval:urlencode:' . $templateCode
conforms to PSR-12 binary operator spacing rules.phpcs.xml (3)
1-4
: Good structure and naming
The XML declaration, opening<ruleset>
tag with a descriptive name, and the<description>
element are all correctly set up to document the PSR-12 standard for this project.
12-13
: Base standard reference is correct
ReferencingPSR12
directly is the right choice to inherit the PSR-12 ruleset.
19-21
: Vendor exclusion is set correctly
Excluding*/vendor/*
ensures third-party code is skipped by PHPCS. This aligns with common practice.
Summary by CodeRabbit
Chores
Style
Tests