Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

command 'phpstan:init' should not return 0 when file not overriden

オープン
#58 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php
領域
cli

調査の方向性

Start by locating the phpstan:init command and inspect how it handles an existing phpstan.neon file in non-interactive mode. Reproduce the case with --dest and an existing file, then verify that the process reports a nonzero exit status when no file is copied, while preserving the successful status for an actual installation.

索引モデルが issue の本文から書いたものです。

説明

Use case :

  • the command is invoked from a script (external symfony command for example), in non-interactive mode (interactive mode is not possible in this context)
  • phpstan.neon file already exists

Was the command successful ? I think not, the new file was not copied/installed, we can't consider the init process is a success.
So in this case, command should return 1 or another code maybe 2, but not 0. (2 or more is best option I suppose).

Furthermore, there is another argument for arguing that the command should return 1.
Because of the non possible interaction, symfony has started to fill the errorOutput content, which means that symfony considers that an error happend. ($installPhpStanConfiguration->getErrorOutput() has content, see below).

Example :

$this->io->write("Installation of {$this->getScriptName()} configuration file : ", false);
$installPhpStanConfiguration = new Process(['php', 'vendor/bin/prestashop-coding-standards', 'phpstan:init', '--dest', getcwd()]);
$installPhpStanConfiguration->start();
$installPhpStanConfiguration->wait();

 if (!$installPhpStanConfiguration->isSuccessful()) {
            $this->io->error('failed !');
            throw new RuntimeException("{$this->getPackageName()} configuration : {$installPhpStanConfiguration->getErrorOutput()}");
        }
// The process is reported to successful even if the new file was not written :( 
// fun fact : isSuccessuf() is true but getErrorOutput() has content
// at this point, we should parse the getErrorOutput()  content to guess if an error happened.
主要言語
PHP
スター
37
フォーク
20
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PrestaShop/php-dev-tools のほかの issue

PrestaShop/php-dev-tools の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。