From 70e510b149a2ffaa465b41f35a994d517714a6f1 Mon Sep 17 00:00:00 2001 From: Jitendra Adhikari Date: Sun, 2 Oct 2022 22:23:32 +0700 Subject: [PATCH 1/3] chore(travis): retire it :( --- .travis.yml | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8fb96f6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: php - -php: - - 8.0 - - 8.1 - -install: - - composer install --prefer-dist - -before_script: - - for P in src tests; do find $P -type f -name '*.php' -exec php -l {} \;; done - -script: - - composer test:cov - -after_success: - - bash <(curl -s https://codecov.io/bash) From 9b4da7dc9e59538a2e5fc9dd3dda9e1d8a7d9e10 Mon Sep 17 00:00:00 2001 From: Jitendra Adhikari Date: Sun, 2 Oct 2022 22:31:00 +0700 Subject: [PATCH 2/3] build(workflow): add github action build --- .github/workflows/build.yml | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ca4a9bf --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,62 @@ +name: Build + +on: + push: + pull_request: + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + + tests: + name: Tests + env: + extensions: pcov + + strategy: + matrix: + include: + - php: '8.0' + - php: '8.1' + - php: '8.2' + fail-fast: true + + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + coverage: "none" + ini-values: date.timezone=Asia/Bangkok,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,zend.assertions=1 + php-version: "${{ matrix.php }}" + extensions: "${{ env.extensions }}" + tools: flex + + - name: Before run + run: | + echo COLUMNS=120 >> $GITHUB_ENV + for P in src tests; do find $P -type f -name '*.php' -exec php -l {} \;; done + + - name: Install dependencies + run: composer install --no-progress --ansi -o + + - name: Run tests + run: composer test:cov + + - name: Codecov + run: bash <(curl -s https://codecov.io/bash) From 81989697967cbbbed77a690ecc5af5ba62ec8573 Mon Sep 17 00:00:00 2001 From: Jitendra Adhikari Date: Sun, 2 Oct 2022 22:31:58 +0700 Subject: [PATCH 3/3] fix: adapt for strict type php8 --- src/Helper/Shell.php | 6 +++--- src/Output/Writer.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Helper/Shell.php b/src/Helper/Shell.php index c45ec30..2d57bf3 100644 --- a/src/Helper/Shell.php +++ b/src/Helper/Shell.php @@ -58,8 +58,8 @@ class Shell /** @var resource The actual process resource returned from proc_open */ protected $process = null; - /** @var int Process starting time in unix timestamp */ - protected int $processStartTime = 0; + /** @var float Process starting time in unix timestamp */ + protected float $processStartTime = 0; /** @var array Status of the process as returned from proc_get_status */ protected ?array $processStatus = null; @@ -104,7 +104,7 @@ protected function isWindows(): bool protected function setInput(): void { - \fwrite($this->pipes[self::STDIN_DESCRIPTOR_KEY], $this->input); + \fwrite($this->pipes[self::STDIN_DESCRIPTOR_KEY], $this->input ?? ''); } protected function updateProcessStatus(): void diff --git a/src/Output/Writer.php b/src/Output/Writer.php index 23e691f..54add92 100644 --- a/src/Output/Writer.php +++ b/src/Output/Writer.php @@ -200,7 +200,7 @@ public function colorizer(): Color */ public function __get(string $name): self { - if (\strpos($this->method, $name) === false) { + if ($this->method === null || !\str_contains($this->method, $name)) { $this->method .= $this->method ? \ucfirst($name) : $name; }