| <?xml version="1.0" encoding="UTF-8"?>
<project name="Project name" description="Project description" default="help" phingVersion="3">
  <target name="setup" depends="composer:install"/>
  <target name="qa" depends="php:lint,composer:normalize,composer:validate,psalm:check,phpunit:check"/>
  <target name="php:lint" description="Check PHP syntax">
    <phplint haltonfailure="true">
      <fileset dir="${project.basedir}">
        <include name="src/**/*.php"/>
        <include name="tests/**/*.php"/>
        <include name="migrations/**/*.php"/>
      </fileset>
    </phplint>
  </target>
  <target name="help">
    <uptodate property="uptodate.visualizer" srcfile="build.xml" targetfile="build.svg"/>
    <runtarget target="map"/>
    <open path="build.svg"/>
  </target>
  <target name="map" unless="uptodate.visualizer" description="Create buildfile map">
    <visualizer format="svg"/>
  </target>
  <target name="composer:install" description="Install PHP dependencies for dev">
    <composer command="install">
      <arg value="--no-interaction"/>
      <arg value="--prefer-dist"/>
      <arg value="--no-progress"/>
      <arg value="--ansi"/>
      <arg value="--dev"/>
    </composer>
  </target>
  <target name="composer:validate" description="Validate composer.json">
    <composer command="validate">
      <arg value="--ansi"/>
      <arg value="--no-interaction"/>
    </composer>
  </target>
  <target name="composer:normalize" description="Normalize composer.json">
    <composer command="normalize">
      <arg value="--ansi"/>
      <arg value="--no-interaction"/>
      <arg value="--diff"/>
      <arg value="--indent-size=2"/>
      <arg value="--indent-style=space"/>
    </composer>
  </target>
  <target name="psalm:check" description="Check code with Psalm">
    <exec executable="vendor/bin/psalm" checkreturn="true" passthru="true">
      <arg line="--no-cache --long-progress"/>
    </exec>
  </target>
  <target name="phpunit:check" description="Run unitary tests">
    <exec executable="vendor/bin/phpunit" checkreturn="true" passthru="true">
      <env key="XDEBUG_MODE" value="coverage"/>
      <arg value="--coverage-text"/>
    </exec>
  </target>
  <target name="cs:check" description="Check if coding standards are respected">
    <exec executable="vendor/bin/php-cs-fixer" passthru="true" checkreturn="true">
      <arg line="fix --diff --allow-risky=yes --ansi --dry-run"/>
    </exec>
  </target>
  <target name="cs:fix" description="Fix coding standards in project">
    <exec executable="vendor/bin/php-cs-fixer" passthru="true" checkreturn="true">
      <arg line="fix --diff --allow-risky=yes --ansi"/>
    </exec>
  </target>
</project>
 |