[{"data":1,"prerenderedAt":4},["ShallowReactive",2],{"docs:\u002Fdocs\u002Ftooling\u002Fci":3},"\u003Cp>A Phaenon project&#39;s pipeline is a PHP project&#39;s pipeline with a few steps changed. \u003Ccode>composer install\u003C\u002Fcode> brings the compiler and builds the outputs; the checker&#39;s findings go on the pull request;\nPHPUnit and PHPStan run on the outputs as before, and what they report goes through \u003Ccode>phn trace\u003C\u002Fcode> so\nthat it points at \u003Ccode>.phn\u003C\u002Fcode> lines.\u003C\u002Fp>\n\u003Ch2 id=\"the-steps\">The steps\u003Ca class=\"docs-anchor\" href=\"#the-steps\" aria-hidden=\"true\" tabindex=\"-1\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Col>\n\u003Cli>\u003Cstrong>\u003Ccode>composer install\u003C\u002Fcode>.\u003C\u002Fstrong> The \u003Ccode>phaenon\u002Fphn\u003C\u002Fcode> plugin installs the binary \u003Ccode>composer.lock\u003C\u002Fcode> pins as\n\u003Ccode>vendor\u002Fbin\u002Fphn\u003C\u002Fcode>, then builds every root when Composer writes the autoloader. A type error stops\nthe install, after the findings are printed.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>vendor\u002Fbin\u002Fphn check --format=github\u003C\u002Fcode>\u003C\u002Fstrong> (or \u003Ccode>checkstyle\u003C\u002Fcode>): the findings, as annotations on\nthe \u003Ccode>.phn\u003C\u002Fcode> lines. Run it after a failed install too, which is when it has something to say.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>vendor\u002Fbin\u002Fphn fmt --check\u003C\u002Fcode>\u003C\u002Fstrong>: Phaenon&#39;s layout and your php-cs-fixer style, each change\nreported at its \u003Ccode>.phn\u003C\u002Fcode> line (\u003Ca href=\"\u002Fdocs\u002Ftooling\u002Fformatting\">Formatting and fixers\u003C\u002Fa>).\u003C\u002Fli>\n\u003Cli>\u003Cstrong>PHPStan on the outputs\u003C\u002Fstrong>, its \u003Ccode>github\u003C\u002Fcode> or \u003Ccode>checkstyle\u003C\u002Fcode> report through \u003Ccode>phn trace\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>PHPUnit on the outputs\u003C\u002Fstrong>, its output and its JUnit and coverage reports through \u003Ccode>phn trace\u003C\u002Fcode>.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>An application needs no \u003Ccode>phn build\u003C\u002Fcode> step: the install has built the outputs. A project that sets\n\u003Ccode>&quot;extra&quot;: {&quot;phaenon&quot;: {&quot;build&quot;: false}}\u003C\u002Fcode> runs \u003Ccode>vendor\u002Fbin\u002Fphn build\u003C\u002Fcode> after the install instead. A\nlibrary that commits its outputs adds the check that they are current\n(\u003Ca href=\"\u002Fdocs\u002Ftooling\u002Flibraries#the-gate\">Publishing a library\u003C\u002Fa>).\u003C\u002Fp>\n\u003Cp>\u003Ccode>phn trace\u003C\u002Fcode> exits with 0 whatever it reads, so each step that pipes into it sets \u003Ccode>pipefail\u003C\u002Fcode>, and\nthe step keeps the status of PHPStan or PHPUnit.\u003C\u002Fp>\n\u003Ch2 id=\"github-actions\">GitHub Actions\u003Ca class=\"docs-anchor\" href=\"#github-actions\" aria-hidden=\"true\" tabindex=\"-1\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>\u003Ccode>.github\u002Fworkflows\u002Fci.yml\u003C\u002Fcode>:\u003C\u002Fp>\n\u003Cfigure class=\"docs-code phn-code-surface\">\u003Cdiv class=\"docs-code-body\">\u003Cpre class=\"shiki shiki-themes phaenon-light phaenon-dark\" style=\"--phn-light:#1f2127;--phn-dark:#e2e3e7;--phn-light-bg:#f9fafb;--phn-dark-bg:#0f1115\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">name\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> CI\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#B4431A;--phn-dark:#F29D6B\">on\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">  push\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">    branches\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\"> [\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\">main\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">  pull_request\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">jobs\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">  test\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">    runs-on\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> ubuntu-latest\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">    steps\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> uses\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> actions\u002Fcheckout@v4\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> uses\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> shivammathur\u002Fsetup-php@v2\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        with\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">          php-version\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> '8.5'\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">          coverage\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> pcov\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">          tools\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> composer:v2\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7C;--phn-light-font-style:italic;--phn-dark:#7D8393;--phn-dark-font-style:italic\">      # Composer's cache holds the package archives and, under phaenon-phn\u002F,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7C;--phn-light-font-style:italic;--phn-dark:#7D8393;--phn-dark-font-style:italic\">      # the phn binary the plugin downloads.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> name\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> Find Composer's cache\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        id\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> composer-cache\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        run\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> echo \"dir=$(composer config cache-dir)\" >> \"$GITHUB_OUTPUT\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> uses\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> actions\u002Fcache@v4\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        with\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">          path\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> ${{ steps.composer-cache.outputs.dir }}\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">          key\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> composer-${{ runner.os }}-${{ hashFiles('composer.lock') }}\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">          restore-keys\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> composer-${{ runner.os }}-\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7C;--phn-light-font-style:italic;--phn-dark:#7D8393;--phn-dark-font-style:italic\">      # The plugin brings the pinned vendor\u002Fbin\u002Fphn and builds src\u002F and tests\u002F.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> name\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> Install\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        run\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> composer install --no-interaction --no-progress\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7C;--phn-light-font-style:italic;--phn-dark:#7D8393;--phn-dark-font-style:italic\">      # Also after a failed install: the plugin's build stops the install on\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7C;--phn-light-font-style:italic;--phn-dark:#7D8393;--phn-dark-font-style:italic\">      # a type error, and this step puts the findings on the pull request.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> name\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> Type check\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        if\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> ${{ !cancelled() }}\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        run\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> vendor\u002Fbin\u002Fphn check --format=github\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> name\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> Layout\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        run\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> vendor\u002Fbin\u002Fphn fmt --check\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> name\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> PHPStan\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        run\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> |\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\">          set -o pipefail\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\">          vendor\u002Fbin\u002Fphpstan analyse --no-progress --error-format=github | vendor\u002Fbin\u002Fphn trace\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> name\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> PHPUnit\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        run\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> |\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\">          set -o pipefail\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\">          php -d pcov.directory=. vendor\u002Fbin\u002Fphpunit --log-junit junit.xml --coverage-cobertura cobertura.xml | vendor\u002Fbin\u002Fphn trace\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> name\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> Reports on the .phn lines\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        if\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> ${{ !cancelled() &#x26;&#x26; hashFiles('junit.xml') != '' }}\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        run\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> |\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\">          vendor\u002Fbin\u002Fphn trace &#x3C; junit.xml > junit.phn.xml\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\">          vendor\u002Fbin\u002Fphn trace &#x3C; cobertura.xml > cobertura.phn.xml\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> uses\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> actions\u002Fupload-artifact@v4\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        if\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> ${{ !cancelled() }}\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        with\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">          name\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> reports\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">          if-no-files-found\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> ignore\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">          path\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\"> |\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\">            junit.phn.xml\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\">            cobertura.phn.xml\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Ffigure>\n\u003Cp>The workflow assumes the project&#39;s PHPUnit, PHPStan and php-cs-fixer configurations point at the\noutputs (\u003Ca href=\"\u002Fdocs\u002Ftooling\u002Fconfiguration#pointing-the-tools-at-the-outputs\">\u003Ccode>phaenon.json\u003C\u002Fcode>\u003C\u002Fa>).\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>Annotations.\u003C\u002Fstrong> GitHub shows an annotation only on a file the repository holds. The checker&#39;s\nfindings name the \u003Ccode>.phn\u003C\u002Fcode>; PHPStan&#39;s name the compiled file, which is not in the repository, so\nthey go through \u003Ccode>phn trace\u003C\u002Fcode> or GitHub drops them. A traced annotation names its file from the\nroot of the git repository, which also holds for a project in a subdirectory.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Coverage.\u003C\u002Fstrong> \u003Ccode>-d pcov.directory=.\u003C\u002Fcode> makes PCOV measure the outputs: left to itself it picks\n\u003Ccode>src\u002F\u003C\u002Fcode>, where the \u003Ccode>.phn\u003C\u002Fcode> are, and every count comes out 0.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2 id=\"gitlab-ci\">GitLab CI\u003Ca class=\"docs-anchor\" href=\"#gitlab-ci\" aria-hidden=\"true\" tabindex=\"-1\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>GitLab reads JUnit reports and Cobertura coverage, both after \u003Ccode>phn trace\u003C\u002Fcode>. It has no report type\nfor Checkstyle, so the checker&#39;s and PHPStan&#39;s Checkstyle files are kept as artifacts for another\ntool to read. \u003Ccode>.gitlab-ci.yml\u003C\u002Fcode>:\u003C\u002Fp>\n\u003Cfigure class=\"docs-code phn-code-surface\">\u003Cdiv class=\"docs-code-body\">\u003Cpre class=\"shiki shiki-themes phaenon-light phaenon-dark\" style=\"--phn-light:#1f2127;--phn-dark:#e2e3e7;--phn-light-bg:#f9fafb;--phn-dark-bg:#0f1115\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">test\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">  image\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> php:8.5-cli\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">  variables\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7C;--phn-light-font-style:italic;--phn-dark:#7D8393;--phn-dark-font-style:italic\">    # Kept between jobs: the package archives, and the phn binary under phaenon-phn\u002F.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">    COMPOSER_CACHE_DIR\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> \"$CI_PROJECT_DIR\u002F.composer-cache\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">  cache\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">    key\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">      files\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">        -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> composer.lock\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">    paths\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> .composer-cache\u002F\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">  before_script\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> apt-get update &#x26;&#x26; apt-get install -y --no-install-recommends git unzip\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> curl -sSLf -o \u002Fusr\u002Flocal\u002Fbin\u002Finstall-php-extensions https:\u002F\u002Fgithub.com\u002Fmlocati\u002Fdocker-php-extension-installer\u002Freleases\u002Flatest\u002Fdownload\u002Finstall-php-extensions\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> chmod +x \u002Fusr\u002Flocal\u002Fbin\u002Finstall-php-extensions\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> install-php-extensions pcov @composer\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">  script\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7C;--phn-light-font-style:italic;--phn-dark:#7D8393;--phn-dark-font-style:italic\">    # The plugin brings vendor\u002Fbin\u002Fphn and builds src\u002F and tests\u002F.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> composer install --no-interaction --no-progress\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> vendor\u002Fbin\u002Fphn check --format=checkstyle > phn-checkstyle.xml\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> vendor\u002Fbin\u002Fphn fmt --check\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> set -o pipefail; vendor\u002Fbin\u002Fphpstan analyse --no-progress --error-format=checkstyle | vendor\u002Fbin\u002Fphn trace > phpstan-checkstyle.xml\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> set -o pipefail; php -d pcov.directory=. vendor\u002Fbin\u002Fphpunit --log-junit junit.xml --coverage-cobertura cobertura.xml | vendor\u002Fbin\u002Fphn trace\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">  after_script\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> vendor\u002Fbin\u002Fphn trace &#x3C; junit.xml > junit.phn.xml\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">    -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> vendor\u002Fbin\u002Fphn trace &#x3C; cobertura.xml > cobertura.phn.xml\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">  artifacts\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">    when\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> always\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">    paths\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> phn-checkstyle.xml\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">      -\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> phpstan-checkstyle.xml\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">    reports\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">      junit\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> junit.phn.xml\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">      coverage_report\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        coverage_format\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> cobertura\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">        path\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#6A6F7D;--phn-dark:#8B91A2\">:\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#2A7A4B;--phn-dark:#8FD3A3\"> cobertura.phn.xml\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Ffigure>\n\u003Cp>\u003Ccode>phn trace\u003C\u002Fcode> writes a Cobertura report&#39;s \u003Ccode>&lt;source&gt;\u003C\u002Fcode> as the project&#39;s root and every filename from\nthere, \u003Ccode>src\u002FInventory.phn\u003C\u002Fcode>, which is how GitLab matches the coverage to the files of a merge\nrequest.\u003C\u002Fp>\n\u003Ch2 id=\"what-to-cache\">What to cache\u003Ca class=\"docs-anchor\" href=\"#what-to-cache\" aria-hidden=\"true\" tabindex=\"-1\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>Cache Composer&#39;s cache directory, \u003Ccode>composer config cache-dir\u003C\u002Fcode>, keyed on \u003Ccode>composer.lock\u003C\u002Fcode>. Besides\nthe package archives it holds the \u003Ccode>phn\u003C\u002Fcode> binary the plugin downloaded, under\n\u003Ccode>phaenon-phn\u002F&lt;version&gt;\u002F\u003C\u002Fcode>, about 9 MB; with the cache warm, the install fetches nothing. A cache of\n\u003Ccode>cache-files-dir\u003C\u002Fcode> alone keeps the archives but not the binary.\u003C\u002Fp>\n\u003Cp>Do not cache \u003Ccode>.src\u002F\u003C\u002Fcode> and \u003Ccode>.tests\u002F\u003C\u002Fcode>. Checking and compiling a code base of 800 files takes about a\nsecond and a half on a laptop, and an output restored from another commit is the staleness a build\nexists to rule out.\u003C\u002Fp>\n\u003Ch2 id=\"why-there-is-no-setup-action\">Why there is no setup action\u003Ca class=\"docs-anchor\" href=\"#why-there-is-no-setup-action\" aria-hidden=\"true\" tabindex=\"-1\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>Many languages ship a \u003Ccode>setup-…\u003C\u002Fcode> action that puts the compiler on the runner. Phaenon does not need\none: the Composer plugin already puts \u003Ccode>vendor\u002Fbin\u002Fphn\u003C\u002Fcode> into every checkout that runs \u003Ccode>composer install\u003C\u002Fcode>, at the version \u003Ccode>composer.lock\u003C\u002Fcode> pins, checked against the SHA-256 the plugin carries. A\nsecond installation step could put another release on the \u003Ccode>PATH\u003C\u002Fcode> than the one the lock pins, and\nthe job would check with one compiler and build with another. Call \u003Ccode>vendor\u002Fbin\u002Fphn\u003C\u002Fcode> in the\npipeline, and the compiler is the one your developers use.\u003C\u002Fp>\n\u003Ch2 id=\"building-an-image\">Building an image\u003Ca class=\"docs-anchor\" href=\"#building-an-image\" aria-hidden=\"true\" tabindex=\"-1\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>Build where Composer runs, and ship the outputs. The plugin compiles the roots when Composer\nwrites the autoloader, so the build stage copies \u003Ccode>phaenon.json\u003C\u002Fcode> and \u003Ccode>src\u002F\u003C\u002Fcode> before the dump:\u003C\u002Fp>\n\u003Cfigure class=\"docs-code phn-code-surface\">\u003Cdiv class=\"docs-code-body\">\u003Cpre class=\"shiki shiki-themes phaenon-light phaenon-dark\" style=\"--phn-light:#1f2127;--phn-dark:#e2e3e7;--phn-light-bg:#f9fafb;--phn-dark-bg:#0f1115\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7C;--phn-light-font-style:italic;--phn-dark:#7D8393;--phn-dark-font-style:italic\"># Build where Composer runs: the phaenon\u002Fphn plugin compiles src\u002F into .src\u002F\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7C;--phn-light-font-style:italic;--phn-dark:#7D8393;--phn-dark-font-style:italic\"># when the autoloader is written.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">FROM\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> composer:2 \u003C\u002Fspan>\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">AS\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> build\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">WORKDIR\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> \u002Fapp\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">COPY\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> composer.json composer.lock .\u002F\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">RUN\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> composer install --no-dev --no-autoloader --no-scripts --no-interaction --no-progress\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">COPY\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> phaenon.json .\u002F\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">COPY\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> src .\u002Fsrc\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">RUN\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> composer dump-autoload --no-dev --classmap-authoritative \\\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\">    &#x26;&#x26; rm vendor\u002Fphaenon\u002Fphn\u002Fbin\u002Fphn\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#6A6F7C;--phn-light-font-style:italic;--phn-dark:#7D8393;--phn-dark-font-style:italic\"># Ship the outputs: plain PHP, with the .phn beside them for the line maps.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">FROM\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> php:8.5-cli\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">WORKDIR\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> \u002Fapp\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--phn-light:#8F5E00;--phn-dark:#F2B43F\">COPY\u003C\u002Fspan>\u003Cspan style=\"--phn-light:#1F2127;--phn-dark:#E2E3E7\"> --from=build \u002Fapp \u002Fapp\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Ffigure>\n\u003Cp>With a \u003Ccode>.dockerignore\u003C\u002Fcode>:\u003C\u002Fp>\n\u003Cfigure class=\"docs-code phn-code-surface\">\u003Cdiv class=\"docs-code-body\">\u003Cpre class=\"shiki shiki-themes phaenon-light phaenon-dark\" style=\"--phn-light:#1f2127;--phn-dark:#e2e3e7;--phn-light-bg:#f9fafb;--phn-dark-bg:#0f1115\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan>.git\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>vendor\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>.src\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>.tests\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>tests\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Ffigure>\n\u003Cul>\n\u003Cli>\u003Cstrong>\u003Ccode>composer install --no-autoloader\u003C\u002Fcode> builds nothing\u003C\u002Fstrong>; the \u003Ccode>dump-autoload\u003C\u002Fcode> that follows builds,\nbefore Composer writes its class map, so \u003Ccode>--classmap-authoritative\u003C\u002Fcode> finds the outputs.\n\u003Ccode>--no-scripts\u003C\u002Fcode> does not skip the plugin.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Leave \u003Ccode>tests\u002F\u003C\u002Fcode> out of the build context.\u003C\u002Fstrong> The plugin builds every root the tree has, and a\nproduction install has no PHPUnit, so the build of \u003Ccode>tests\u002F\u003C\u002Fcode> would fail on\n\u003Ccode>unknown class PHPUnit\\Framework\\TestCase\u003C\u002Fcode>. A root missing from the tree is skipped, so the same\n\u003Ccode>phaenon.json\u003C\u002Fcode> serves both.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Leave local outputs out\u003C\u002Fstrong> (\u003Ccode>.src\u003C\u002Fcode>, \u003Ccode>.tests\u003C\u002Fcode>), so the image holds what the build stage wrote.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>The binary is for the platform Composer runs on\u003C\u002Fstrong>: the plugin downloads the Linux build for the\nbuild stage&#39;s architecture. Nothing in the running image calls the compiler, so the build stage\nremoves it, and the final stage, which copies the stage&#39;s tree, never gets it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>The \u003Ccode>.phn\u003C\u002Fcode> ship beside the outputs\u003C\u002Fstrong>, so that \u003Ccode>phaenon\u002Fdebug\u003C\u002Fcode>&#39;s Sentry integration can show\ntheir lines (\u003Ca href=\"\u002Fdocs\u002Ftooling\u002Fdebugging#in-production-phaenondebug\">Line maps and debugging\u003C\u002Fa>).\u003C\u002Fli>\n\u003Cli>\u003Ccode>phaenon\u002Fphn\u003C\u002Fcode> stays under \u003Ccode>require\u003C\u002Fcode>, not \u003Ccode>require-dev\u003C\u002Fcode>, since this \u003Ccode>--no-dev\u003C\u002Fcode> install is where the\noutputs are built.\u003C\u002Fli>\n\u003C\u002Ful>\n",1794925619702]