openapi-php-sdk icon indicating copy to clipboard operation
openapi-php-sdk copied to clipboard

Add PSR-12 enforcement via PHP_CodeSniffer

Open muhammadshaharyaraulakh opened this issue 5 months ago โ€ข 1 comments

๐Ÿ“‹ Description

Brief description of the changes made in this PR.

Enforces PSR-12 coding style across the src/ directory by integrating PHP_CodeSniffer. Auto-fixed existing violations using PHPCBF and manually resolved remaining warnings to achieve a fully clean baseline โ€” zero errors, zero warnings. โœจ Type of Change

๐Ÿ› Bug fix (fixes an issue) โœจ New feature (adds functionality) ๐Ÿ”ง Refactoring (code restructuring without functional changes) ๐Ÿ“š Documentation (updates to documentation) ๐Ÿงช Tests (adding or modifying tests) ๐Ÿ”’ Security (security-related fixes) โšก Performance (performance improvements) ๐ŸŽจ Style (formatting changes, no logic changes)

๐Ÿ” Main Changes

Added squizlabs/php_codesniffer to require-dev in composer.json Added .phpcs.xml configuration file targeting PSR-12 for the src/ directory Added composer run cs and composer run cs-fix scripts via phpcs and phpcbf Auto-fixed formatting violations in src/OauthClient.php and src/Transports/CurlTransport.php using PHPCBF Manually fixed constant visibility warnings in src/OauthClient.php Manually fixed long method signature in src/ApiException.php Suppressed intentional PSR-1 side-effects warning in src/Bootstrap.php

๐Ÿงช Testing

I have tested the changes locally I have added/updated unit tests All tests pass (./vendor/bin/phpunit) I have verified PHP 8.0+ compatibility

๐Ÿ“ Additional Notes vendor/bin/phpcs reports zero errors and zero warnings across all 10 scanned files. No logic or functionality was changed โ€” only formatting and style enforcement tooling was added. ๐Ÿ”— Related Issue Closes #22

muhammadshaharyaraulakh avatar Jun 07 '26 07:06 muhammadshaharyaraulakh

Ready for review @francescobianco vendor/bin/phpcs reports zero errors and zero warnings locally. Happy to make any adjustments based on your feedback

muhammadshaharyaraulakh avatar Jun 07 '26 07:06 muhammadshaharyaraulakh

Thanks @muhammadshaharyaraulakh for the excellent contribution! ๐ŸŽ‰

I've reviewed the PR and I'm happy to accept it. Having a clean PSR-12 baseline and the associated tooling in place is a great improvement for the project, and I appreciate the care taken to keep this as a style-only change without affecting functionality.

Before merging, I'd just ask one small thing: please follow our contributor onboarding guide to add yourself as an official contributor to the project:

๐Ÿ‘‰ https://github.com/openapi/contributors

We're always happy to welcome new contributors to the OpenAPI community, and we'd love to recognize your contribution properly.

Thanks again for your work, and welcome aboard! ๐Ÿš€

francescobianco avatar Jun 29 '26 15:06 francescobianco