{"id":11773774,"name":"WorkOfStan/phpcs-fix","ecosystem":"actions","description":"Sniff the PHP code and beautify it if necessary.","homepage":"","licenses":"mit","normalized_licenses":["MIT"],"repository_url":"https://github.com/WorkOfStan/phpcs-fix","keywords_array":["code-quality","continuous-integration","phpcbf","phpcs","phpcs-standard","super-linter"],"namespace":"WorkOfStan","versions_count":3,"first_release_published_at":"2025-02-01T16:16:23.000Z","latest_release_published_at":"2025-05-31T17:33:20.000Z","latest_release_number":"v1.0.2","last_synced_at":"2026-03-27T07:30:04.148Z","created_at":"2025-06-08T01:09:53.490Z","updated_at":"2026-03-27T07:30:04.149Z","registry_url":"https://github.com/WorkOfStan/phpcs-fix","install_command":null,"documentation_url":null,"metadata":{"name":"PHP Code Beautifier and Fixer","description":"Sniff the PHP code and beautify it if necessary.","author":{"name":"Stanislav Rejthar","email":"rejthar@stanislavrejthar.com","url":"https://github.com/WorkOfStan"},"branding":{"icon":"check-circle","color":"blue"},"inputs":{"commit-changes":{"description":"If true, commit changes to the current branch","type":"boolean","default":false},"commit-message":{"description":"Commit message for the changes","type":"string","default":"PHP Code Beautifier fixes applied automatically"},"debug":{"description":"Enable extra debug output","type":"boolean","default":false},"extensions":{"description":"Comma delimited list of extensions to be sniffed","required":false,"type":"string","default":"php"},"ignore":{"description":"Ignore files based on a comma-separated list of patterns matching files and/or directories.","required":false,"type":"string","default":"vendor/"},"php-version":{"description":"PHP version to be used for running phpcs and phpcbf","required":false,"type":"string","default":"8.2"},"standard":{"description":"The name of, or the path to, the coding standard to use. Can be a comma-separated list specifying multiple standards.","required":false,"type":"string","default":""},"stop-on-manual-fix":{"description":"If true, the execution will stop when manual fixes are necessary.","type":"boolean","default":false}},"outputs":{"branch-name":{"description":"The branch where changes were committed"},"changed-files":{"description":"Comma-separated list of files changed by phpcbf"}},"runs":{"using":"composite","steps":[{"name":"Checkout code","uses":"actions/checkout@v4","with":{"ref":"${{ github.ref }}","fetch-depth":0}},{"name":"Fetch latest changes","run":"git pull origin ${{ github.ref }}","shell":"bash"},{"name":"Set up PHP","uses":"shivammathur/setup-php@v2","with":{"php-version":"${{ inputs.php-version }}","tools":"composer:v2"}},{"name":"Cache composer dependencies","uses":"actions/cache@v4","id":"vendor-cache","with":{"path":"${{ github.workspace }}/vendor/","key":"phpcs-fix-${{ runner.os }}-PHP${{ inputs.php-version }}-vendor-${{ hashFiles('**/composer.json') }}"}},{"name":"Use the latest PHPCS version","if":"${{ steps.vendor-cache.outputs.cache-hit != 'true' }}","run":"composer require --dev squizlabs/php_codesniffer --prefer-dist --no-progress","shell":"bash"},{"name":"Debug branches","if":"${{ inputs.debug == 'true' }}","run":"echo \"Debug 1. List All Local Branches\"\ngit branch\necho \"Debug 2. List All Remote Branches\"\ngit branch -r\necho \"Debug 3. List All References (Including Detached HEADs)\"\ngit show-ref\necho \"Debug 4. Check Your Current Checked-out Reference\"\ngit status\n","shell":"bash"},{"name":"Run PHP Code Sniffer","id":"phpcs","run":"# Determine which coding standard to use.\n# Priority:\n#   1. Use inputs.standard if provided (non-empty).\n#   2. If not, use the repository's own phpcs.xml if available.\n#   3. Otherwise, fall back to the action's default template. Which is a copy of https://github.com/super-linter/super-linter/blob/main/TEMPLATES/phpcs.xml\nif [ -n \"${{ inputs.standard }}\" ]; then\n  use_standard=\"${{ inputs.standard }}\"\nelif [ -f .github/linters/phpcs.xml ]; then\n  use_standard=\".github/linters/phpcs.xml\"\nelse\n  use_standard=\"$GITHUB_ACTION_PATH/.github/linters/super-linter-templates-phpcs.xml\"\nfi\necho \"USE_STANDARD=$use_standard\" \u003e\u003e \"$GITHUB_ENV\" # for subsequent steps\necho \"phpcs standard=$use_standard\"\nvendor/bin/phpcs --extensions=\"${{ inputs.extensions }}\" . --standard=\"$use_standard\" --ignore=\"${{ inputs.ignore }}\" || HAS_ISSUES=true\n# because of `||`, the previous command always exit 0\n\n# Default the variable if no issues were found\n: \"${HAS_ISSUES:=false}\"\necho \"HAS_ISSUES=$HAS_ISSUES\" \u003e\u003e $GITHUB_ENV\n","shell":"bash"},{"name":"Run PHP Code Beautifier if needed","id":"fix","if":"env.HAS_ISSUES == 'true'","run":"echo \"phpcbf standard=${{ env.USE_STANDARD }}\"\nPHPCBF_EXIT_CODE=0\nMORE_ISSUES=false\nvendor/bin/phpcbf --extensions=\"${{ inputs.extensions }}\" . --standard=\"${{ env.USE_STANDARD }}\" --ignore=\"${{ inputs.ignore }}\" || PHPCBF_EXIT_CODE=$?\nif [ ${PHPCBF_EXIT_CODE} -ne 0 ]; then\n  echo \"::notice title=PHPCBF wasn't idle::Non-zero code exit of phpcbf = ${PHPCBF_EXIT_CODE} (phpcbf wasn't idle)\"\n\n  vendor/bin/phpcs --extensions=\"${{ inputs.extensions }}\" . --standard=\"${{ env.USE_STANDARD }}\" --ignore=\"${{ inputs.ignore }}\" || MORE_ISSUES=true\n  # because of `||`, the previous command always exit 0\n  if [ \"${MORE_ISSUES}\" = \"true\" ]; then\n    echo \"::warning title=Some PHPCS issues remained.::Some phpcs issues remained. Manual fix necessary.\"\n  fi\nfi\n\n# restore composer.json before staging the changes\ngit checkout composer.json\n\n# Check for fixable changes\nif [ -z \"$(git status --porcelain)\" ]; then\n  echo \"::warning title=No fixable errors were found by PHPCBF::No fixable errors were found by phpcbf: Manual fix necessary. Compare to the PHP Code Sniffer section above.\"\n  if [ \"${{ inputs.stop-on-manual-fix }}\" = \"true\" ]; then\n    # Indicates an error\n    # This sets the output named branch-name to an empty value. Which is useful to signal “no branch was created” in a way that downstream steps can detect reliably.\n    echo \"branch-name=\" \u003e\u003e $GITHUB_OUTPUT\n    echo \"changed-files=\" \u003e\u003e $GITHUB_OUTPUT\n    exit 1\n  else\n    # Exiting gracefully\n    echo \"branch-name=\" \u003e\u003e $GITHUB_OUTPUT\n    echo \"changed-files=\" \u003e\u003e $GITHUB_OUTPUT\n    exit 0\n  fi\n  # The rest of the script must still be within the same step to really stop the execution\nfi\n\n# Only add changed files, safe for spaces\ngit status --porcelain | awk '{print $2}' | while IFS= read -r file; do git add \"$file\"; done\n\n# Determine branch name based on commit-changes input\nif [ \"${{ inputs.commit-changes }}\" == \"true\" ]; then\n  BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2\u003e/dev/null)\n  if [ \"$BRANCH_NAME\" == \"HEAD\" ] || [ -z \"$BRANCH_NAME\" ]; then\n    echo \"Detached HEAD detected. Checking out the PR branch directly from origin...\"\n    # Fetch the PR branch tip and force a local branch matching the remote head\n    # Note: ${{ github.head_ref }} is a GitHub Actions built-in variable that contains the name of the source branch of a pull request (PR).\n    #   It is only available during workflow runs triggered by pull_request events.\n    git fetch origin ${{ github.head_ref }} --depth=1\n    git checkout -B \"${{ github.head_ref }}\" \"origin/${{ github.head_ref }}\"\n    BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)\n  fi\n  NOTICE_MESSAGE=\"A PHPCBF commit was successfully added to the current branch: $BRANCH_NAME\"\nelse\n  # name includes timestamp and short_hash\n  BRANCH_NAME=\"phpcbf/fix-$(date +'%y%m%d%H%M%S')-$(git rev-parse --short HEAD)\"\n  git checkout -b \"$BRANCH_NAME\"\n  echo \"::warning title=New branch created::New branch created: Consider pull request for a new branch: $BRANCH_NAME (or delete it)\"\n  NOTICE_MESSAGE=\"A PHPCBF commit was successfully added to the new branch: $BRANCH_NAME\"\nfi\n\n# Configure Git user\ngit config user.name \"github-actions[bot]\"\ngit config user.email \"41898282+github-actions[bot]@users.noreply.github.com\"\n\n# Commit and push changes with custom message\ngit commit -m \"${{ inputs.commit-message }} on $(date +'%Y-%m-%d %H:%M:%S') UTC\"\ngit push origin \"$BRANCH_NAME\"\necho \"::notice title=PHPCBF commit added::${NOTICE_MESSAGE}\"\nCOMMIT_URL=${{ github.server_url }}/${{ github.repository }}/commit/$(git rev-parse HEAD)\necho \"::notice title=View the PHPCBF commit::${COMMIT_URL}\"\n\n# Set outputs\nCHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r HEAD | tr '\\n' ',' | sed 's/,$//')\necho \"branch-name=$BRANCH_NAME\" \u003e\u003e $GITHUB_OUTPUT\necho \"changed-files=${CHANGED_FILES}\" \u003e\u003e $GITHUB_OUTPUT\nif [ \"${{ inputs.debug }}\" = \"true\" ]; then\n  echo \"changed-files=${CHANGED_FILES}\"\nfi\n\n## Stop with an error if some manual fixes are required on top of automatic fixes\nif [ \"${{ inputs.stop-on-manual-fix }}\" = \"true\" ] \u0026\u0026 [ \"${MORE_ISSUES}\" = \"true\" ]; then\n  exit 1\nfi\n","shell":"bash"},{"name":"No changes output (when no fix needed)","if":"steps.fix.outcome == 'skipped'","run":"echo \"branch-name=\" \u003e\u003e $GITHUB_OUTPUT\necho \"changed-files=\" \u003e\u003e $GITHUB_OUTPUT\n","shell":"bash"}]},"default_branch":"main","path":null},"repo_metadata":{"id":272995050,"uuid":"918410671","full_name":"WorkOfStan/phpcs-fix","owner":"WorkOfStan","description":"Automatically apply PHP coding standard formatting and create a pull request to fix code style issues, ensuring compatibility with Super-Linter.","archived":false,"fork":false,"pushed_at":"2025-08-30T17:08:41.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-15T23:42:02.698Z","etag":null,"topics":["code-quality","continuous-integration","phpcbf","phpcs","phpcs-standard","super-linter"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WorkOfStan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-17T21:54:30.000Z","updated_at":"2025-05-31T17:33:23.000Z","dependencies_parsed_at":"2025-02-21T22:20:53.147Z","dependency_job_id":"e52c56a9-53cf-4ba7-a939-252320e420d8","html_url":"https://github.com/WorkOfStan/phpcs-fix","commit_stats":null,"previous_names":["workofstan/phpcs-fix"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/WorkOfStan/phpcs-fix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WorkOfStan","download_url":"https://codeload.github.com/WorkOfStan/phpcs-fix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275712384,"owners_count":25514205,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-18T02:00:09.552Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"},"owner_record":{"login":"WorkOfStan","name":null,"uuid":"26247074","kind":"user","description":null,"email":"","website":null,"location":null,"twitter":null,"company":null,"icon_url":"https://avatars.githubusercontent.com/u/26247074?u=b83ff998a561cfb60aab74a34cf11be83ba656af\u0026v=4","repositories_count":2,"last_synced_at":"2025-09-15T23:33:41.792Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/WorkOfStan","funding_links":[],"total_stars":null,"followers":1,"following":0,"created_at":"2022-11-14T05:32:19.443Z","updated_at":"2025-09-15T23:33:41.793Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WorkOfStan","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WorkOfStan/repositories"},"tags":[{"name":"v1.0.2","sha":"71591ebd4b41f5de9a276db741a71f731a581e30","kind":"commit","published_at":"2025-05-31T17:33:20.000Z","download_url":"https://codeload.github.com/WorkOfStan/phpcs-fix/tar.gz/v1.0.2","html_url":"https://github.com/WorkOfStan/phpcs-fix/releases/tag/v1.0.2","dependencies_parsed_at":"2025-06-09T04:12:13.613Z","dependency_job_id":null,"purl":"pkg:github/WorkOfStan/phpcs-fix@v1.0.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/tags/v1.0.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/tags/v1.0.2/manifests"},{"name":"v1.0.1","sha":"338c5f7baac415eced28915c4a025709ba4de251","kind":"commit","published_at":"2025-02-09T00:04:21.000Z","download_url":"https://codeload.github.com/WorkOfStan/phpcs-fix/tar.gz/v1.0.1","html_url":"https://github.com/WorkOfStan/phpcs-fix/releases/tag/v1.0.1","dependencies_parsed_at":"2025-06-09T04:12:13.614Z","dependency_job_id":null,"purl":"pkg:github/WorkOfStan/phpcs-fix@v1.0.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/tags/v1.0.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/tags/v1.0.1/manifests"},{"name":"v1.0.0","sha":"11109d3d999c61554027548d66be1fffa0b22ef5","kind":"commit","published_at":"2025-02-01T16:16:23.000Z","download_url":"https://codeload.github.com/WorkOfStan/phpcs-fix/tar.gz/v1.0.0","html_url":"https://github.com/WorkOfStan/phpcs-fix/releases/tag/v1.0.0","dependencies_parsed_at":"2025-06-09T04:12:13.620Z","dependency_job_id":null,"purl":"pkg:github/WorkOfStan/phpcs-fix@v1.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/tags/v1.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/tags/v1.0.0/manifests"}]},"repo_metadata_updated_at":"2025-09-18T05:08:46.354Z","dependent_packages_count":0,"downloads":null,"downloads_period":null,"dependent_repos_count":0,"rankings":{"downloads":null,"dependent_repos_count":34.34343434343434,"dependent_packages_count":0.0,"stargazers_count":38.393249262814486,"forks_count":29.330572808833676,"docker_downloads_count":null,"average":25.516814103770624},"purl":"pkg:githubactions/WorkOfStan/phpcs-fix","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/actions/WorkOfStan/phpcs-fix","docker_dependents_count":null,"docker_downloads_count":null,"usage_url":"https://repos.ecosyste.ms/usage/actions/WorkOfStan/phpcs-fix","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/actions/WorkOfStan/phpcs-fix/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":{"last_synced_at":"2025-08-31T12:05:00.488Z","issues_count":0,"pull_requests_count":20,"avg_time_to_close_issue":null,"avg_time_to_close_pull_request":568970.0,"issues_closed_count":0,"pull_requests_closed_count":19,"pull_request_authors_count":2,"issue_authors_count":0,"avg_comments_per_issue":null,"avg_comments_per_pull_request":0.5,"merged_pull_requests_count":9,"bot_issues_count":0,"bot_pull_requests_count":10,"past_year_issues_count":0,"past_year_pull_requests_count":20,"past_year_avg_time_to_close_issue":null,"past_year_avg_time_to_close_pull_request":568970.0,"past_year_issues_closed_count":0,"past_year_pull_requests_closed_count":19,"past_year_pull_request_authors_count":2,"past_year_issue_authors_count":0,"past_year_avg_comments_per_issue":null,"past_year_avg_comments_per_pull_request":0.5,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":10,"past_year_merged_pull_requests_count":9,"issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/workofstan%2Fphpcs-fix/issues","maintainers":[{"login":"WorkOfStan","count":10,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/WorkOfStan"}],"active_maintainers":[{"login":"WorkOfStan","count":10,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/WorkOfStan"}]},"versions_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/WorkOfStan%2Fphpcs-fix/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/WorkOfStan%2Fphpcs-fix/version_numbers","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/WorkOfStan%2Fphpcs-fix/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/WorkOfStan%2Fphpcs-fix/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/WorkOfStan%2Fphpcs-fix/codemeta","maintainers":[]}