diff --git a/.github/workflows/workflows.yml b/.github/workflows/workflows.yml index e1ab74a..1d424a2 100644 --- a/.github/workflows/workflows.yml +++ b/.github/workflows/workflows.yml @@ -14,16 +14,17 @@ on: workflow_dispatch: jobs: - php-stan: + dev-job: runs-on: ubuntu-latest + environment: development + if: ${{ github.ref_type == 'branch' && github.ref_name == 'develop' }} steps: - - uses: actions/checkout@v4 - - name: build image - run: docker build -t phpstan:latest . - - name: Run PHPstan with github - # continue-on-error: true - run: | - docker run --rm \ - -v ${{ github.workspace }}:/app \ - phpstan:latest \ - vendor/bin/phpstan analyze --error-format=github /app + - name: Run on dev environment + run: echo "Executed to development environment" + staging-job: + runs-on: ubuntu-latest + environment: staging + if: ${{ github.ref_type == 'tag' }} + steps: + - name: Run on staging environment + run: echo "Executed to staging environment" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57872d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/vendor/ diff --git a/Dockerfile b/Dockerfile index f3aa4eb..ba36cec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ FROM php:8.1-cli-alpine - +# add some change COPY --from=composer:latest /usr/bin/composer /usr/bin/composer RUN composer require --dev "phpstan/phpstan" "squizlabs/php_codesniffer=*" "vimeo/psalm" "phpunit/phpunit" diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..ddd82dd --- /dev/null +++ b/composer.json @@ -0,0 +1,15 @@ +{ + "name": "patrikhajnal/migration-test-public", + "autoload": { + "psr-4": { + "Patrikhajnal\\MigrationTestPublic\\": "src/" + } + }, + "authors": [ + { + "name": "Patrik Hajnal", + "email": "patrik.hajnal@odevo.com" + } + ], + "require": {} +} diff --git a/phpstan.dist.neon b/phpstan.dist.neon new file mode 100644 index 0000000..2361998 --- /dev/null +++ b/phpstan.dist.neon @@ -0,0 +1,18 @@ +parameters: + level: 6 + phpVersion: 80100 # PHP 8.1 + treatPhpDocTypesAsCertain: false + editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' + paths: + # restrict to core and core addons, ignore other locally installed addons + - /app + # https://phpstan.org/config-reference#universal-object-crates + universalObjectCratesClasses: + - rex_fragment + ignoreErrors: + - '#Unsafe usage of new static\(\)\.#' + - '#Constructor of class rex_form_.*_element has an unused parameter \$tag.#' + - '#^Offset .* on .* always exists#' + - + message: '#.*deprecated.*#' + path: '*/update.php' \ No newline at end of file diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..60166d6 --- /dev/null +++ b/src/index.php @@ -0,0 +1,14 @@ + to the URL"; +if(isset($_GET['message']) && $_GET['message'] != '') { + $text = htmlspecialchars($_GET['message']); +} + +$cow = Farm::create(\Cowsayphp\Farm\Cow::class); +echo $cow->say($text); \ No newline at end of file diff --git a/index.php b/src/indexcopy.php similarity index 100% rename from index.php rename to src/indexcopy.php