Skip to content
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

Use {$var} instead of ${var} #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

GOD-oda
Copy link

@GOD-oda GOD-oda commented Feb 1, 2023

背景

php8.2${var}による文字列への埋め込みが非推奨になった

php8.2環境で、phpcs-psr4-sniffをインストールしphpcsを実行した結果

----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | An error occurred during processing; checking has been
   |       | aborted. The error message was: Using ${var} in strings
   |       | is deprecated, use {$var} instead in
   |       | /deploy/vendor/suin/phpcs-psr4-sniff/src/Suin/Sniffs/Classes/PSR4/AutoloadabilityInspectorsFactory.php
   |       | on line 85 (Internal.Exception)
----------------------------------------------------------------------

Time: 3.27 secs; Memory: 26MB

Script ./vendor/bin/phpcs handling the phpcs event returned with error code 1

@hibikiosawa4388
Copy link

メモ:

同じ問題にあたって psr4 の check 方法について調べていました。

composer 2.0 系でサポートされた composer dumpautoload --strict-psr によって
suin/phpcs-psr4-sniff と同様のチェックをできるかも知れません。

https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload

github action 例:

name: COMPOSER-DUMP-AUTOLOAD-STRICT-PSR

on:
  push:
    branches:
      - main
  pull_request:
    types: [synchronize, opened, reopened]
    paths:
      - '**/*.php'

jobs:
  check-psr4-by-composer-dump-autoload-strict-psr:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: Install Dependencies
        uses: docker://composer:2.4.1
        env:
          COMPOSER: composer.json
          COMPOSER_VENDOR_DIR: vendor
        with:
          entrypoint: /usr/bin/composer
          args: install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
          path: ${{ github.workspace }}
      - name: composer psr4 validate
        uses: docker://composer:2.4.1
        env:
          COMPOSER: composer.json
          COMPOSER_VENDOR_DIR: vendor
        with:
          entrypoint: /usr/bin/composer
          args: dump-autoload --strict-psr
          path: ${{ github.workspace }}

@bitwise-operators
Copy link

Is there any chance that this is going to get merged? Or has this repository been abandoned?

@dereuromark
Copy link

I tried to port it
This would be included in php-collective/code-sniffer#14

But so far it doesn't seem to work for me at all.. Reports nothing on actual issues.

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.

4 participants