Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/jobs/fix_pipelinecomponents_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@ mydir=$(pwd)

echo "Before /app/composer.json:"
cat /app/composer.json
sed -i 's/"phpcompatibility\/php-compatibility": "9.3.5"/"phpcompatibility\/php-compatibility": "dev-develop"/g' /app/composer.json
sed -i 's/"squizlabs\/php_codesniffer": "3.13.2"/"squizlabs\/php_codesniffer": "^3.13.3"/g' /app/composer.json

echo "Install the only needed tool"
rm /app/composer.json
cd /app
set +eu
composer require phpcompatibility/php-compatibility:dev-develop
set -eu

composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true

echo "After /app/composer.json:"
cat /app/composer.json

cd /app; composer update
echo "Install the needed tools"
composer update
cd $mydir
29 changes: 29 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,35 @@ jobs:
webapp/public
webapp/config

phpcs_compatibility_new_style:
runs-on: ubuntu-latest
container:
image: domjudge/gitlabci:24.04
strategy:
matrix:
PHPVERSION: ["8.1", "8.2", "8.3", "8.4", "8.5"]
steps:
- uses: actions/checkout@v4
- name: Trigger the plugin
run: |
olddir=`pwd`
cd /
composer install
cd "$olddir"
- name: Detect compatibility with supported PHP version
run: >
/vendor/bin/phpcs -s -p --colors
--standard=PHPCompatibility
--extensions=php
--runtime-set testVersion ${{ matrix.PHPVERSION }}
lib/lib.*.php
etc
judge
webapp/src
webapp/tests
webapp/public
webapp/config

phpcs_compatibility:
runs-on: ubuntu-latest
container:
Expand Down
25 changes: 25 additions & 0 deletions judge/judgedaemon.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -1779,5 +1779,30 @@
}
}

$result = "Hello World"
|> strtoupper(...)
|> str_shuffle(...)
|> trim(...);

Check failure on line 1786 in judge/judgedaemon.main.php

View workflow job for this annotation

GitHub Actions / phpcs

Opening brace of a interface must be on the line after the definition

Check failure on line 1786 in judge/judgedaemon.main.php

View workflow job for this annotation

GitHub Actions / phpcs

Each class must be in a file by itself
interface I {
// We may naively assume that the PHP constant is always a string.
const PHP = 'PHP 8.2';
}

Check failure on line 1791 in judge/judgedaemon.main.php

View workflow job for this annotation

GitHub Actions / phpcs

Opening brace of a class must be on the line after the definition

Check failure on line 1791 in judge/judgedaemon.main.php

View workflow job for this annotation

GitHub Actions / phpcs

Each interface must be in a file by itself
class Foo implements I {
// But implementing classes may define it as an array.
const PHP = [];
}

Check failure on line 1796 in judge/judgedaemon.main.php

View workflow job for this annotation

GitHub Actions / phpcs

Opening brace of a class must be on the line after the definition

Check failure on line 1796 in judge/judgedaemon.main.php

View workflow job for this annotation

GitHub Actions / phpcs

Each class must be in a file by itself
class Foo2 {
const PHP = 'PHP 8.3';
}

$searchableConstant = 'PHP';

var_dump(json_validate('{ "test": { "foo": "bar" } }')); // true

var_dump(Foo2::{$searchableConstant});

$daemon = new JudgeDaemon();
$daemon->run();
Loading