Skip to content

Commit

Permalink
Update phpstan level
Browse files Browse the repository at this point in the history
  • Loading branch information
L3RAZ committed Jan 31, 2025
1 parent b9d1068 commit 43a4d4d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 8 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
header-stamp:
name: Check license headers
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'ready to review')
if: contains(github.event.pull_request.labels.*.name, 'ready to reviews')
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -37,9 +37,9 @@ jobs:
run: php vendor/bin/header-stamp --license=vendor/prestashop/header-stamp/assets/afl.txt --exclude=.github,vendor,tests --dry-run

php-linter:
name: PHP Syntax check 8.1|8.2|8.2
name: PHP Syntax check 8.1|8.2|8.3
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'ready to review')
if: contains(github.event.pull_request.labels.*.name, 'ready to reviews')
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -53,7 +53,7 @@ jobs:
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'ready to review')
if: contains(github.event.pull_request.labels.*.name, 'ready to reviews')
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -80,7 +80,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
presta-versions: ["9.0.x", "latest"]
presta-versions: ["9.0.x-apache", "latest"]
if: contains(github.event.pull_request.labels.*.name, 'ready to review')
steps:
- name: Checkout
Expand All @@ -104,12 +104,12 @@ jobs:
run: docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:${{ matrix.presta-versions }}

- name: Run PHPStan
run: docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html --workdir=/web/module ghcr.io/phpstan/phpstan:latest-php8.1 analyse --configuration=/web/module/tests/phpstan/phpstan-PS-8.neon --error-format=github
run: docker run --rm --volumes-from temp-ps -v $PWD:/var/www/html/modules/ps_checkout -e _PS_ROOT_DIR_=/var/www/html --workdir=/var/www/html/modules/ps_checkout ghcr.io/phpstan/phpstan:latest-php8.1 analyse --configuration=/web/module/tests/phpstan/phpstan-PS-9.neon --error-format=github

phpunit:
name: PHPUnit
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'ready to review')
if: contains(github.event.pull_request.labels.*.name, 'ready to reviews')
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

$rootDirectory = getenv('_PS_ROOT_DIR_') ?: __DIR__ . '/../../../../';
$projectDir = __DIR__ . '/../../';
//require_once $rootDirectory . 'config/config.inc.php';
require_once $rootDirectory . 'config/config.inc.php';
require_once $projectDir . 'vendor/autoload.php';
6 changes: 6 additions & 0 deletions tests/phpstan/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

$rootDirectory = getenv('_PS_ROOT_DIR_') ?: __DIR__ . '/../../../../';
$projectDir = __DIR__ . '/../../';
require_once $rootDirectory . 'config/config.inc.php';
require_once $projectDir . 'vendor/autoload.php';
36 changes: 36 additions & 0 deletions tests/phpstan/phpstan-PS-9.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
includes:
- %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon
parameters:
paths:
# From PHPStan 0.12, paths to check are relative to the neon file
- ../../classes
- ../../controllers
- ../../src
- ../../ps_checkout.php
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- '#Cannot assign offset "merchant…" to string\|true.#'
- '#Property ModuleCore::\$version \(float\) does not accept string.#'
- '#Strict comparison using === between false and string will always evaluate to false.#'
- '#Call to function is_array\(\) with Currency will always evaluate to false.#'
- '#Parameter \#1 \$id of class Customer constructor expects null, bool\|int<1, max>\|int<min, -1> given.#'
- '#Parameter \#1 \$id of class Customer constructor expects null, int<min, -1>\|int<1, max> given.#'
- '#Parameter \#1 \$id of class Customer constructor expects null, int given.#'
- '#Parameter \#1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array<int, string> given.#'
- '#Parameter \#6 \$idShop of method LinkCore::getModuleLink\(\) expects null, int given.#'
- '#Call to an undefined method\(\) AdminController|FrontController::getCheckoutProcess\(\).#'
- '#Parameter \#1 \$id_hook of method ModuleCore::updatePosition\(\) expects bool, int given.#'
- '#Property TabCore::\$name \(string\) does not accept array.#'
- '#Access to an undefined property PaymentModule::\$currentOrderReference.#'
- '#Property CustomerCore::\$passwd \(int\) does not accept bool\|string.#'
- '#Property CustomerCore::\$passwd \(int\) does not accept string.#'
- '#Parameter \#4 \$ssl of method LinkCore::getModuleLink\(\) expects null, true given.#'
- '#Parameter \#1 \$id of class Customer constructor expects null, int<1, max>\|int<min, -1> given.#'
- '#Property CustomerMessageCore::\$ip_address \(string\) does not accept int.#'
- '#Left side of \&\& is always true.#'
- '#Parameter \#7 \$currency_special of method PaymentModuleCore::validateOrder\(\) expects null, int given.#'
- '#Parameter \#9 \$secure_key of method PaymentModuleCore::validateOrder\(\) expects bool, string given.#'
- '#Property CustomerMessageCore::\$private \(int\) does not accept true.#'
- '#Parameter \#1 \$amount_paid of method OrderCore::addOrderPayment\(\) expects string, float\|int given.#'

level: 5

0 comments on commit 43a4d4d

Please sign in to comment.