Skip to content
Open

Php85 #525

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
72 changes: 36 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,55 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3']
php: ["8.4", "8.5"]
steps:
- uses: actions/checkout@v2
- name: Setup PHP with pecl and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl,composer:v2
coverage: xdebug
extensions: yaml,tokenizer,ldap,pdo,pdo_sqlite,zip,json,mbstring,iconv,zmq
ini-values: memory_limit=1G,opcache.enable_cli=0
- run: php --version
# install
- run: composer install --no-interaction --prefer-dist
# script
- run: php ./vendor/nette/tester/src/tester.php -j 4 -C tests --coverage ./coverage.xml --coverage-src ./app
- uses: codecov/codecov-action@v1
- uses: actions/checkout@v2
- name: Setup PHP with pecl and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl,composer:v2
coverage: xdebug
extensions: yaml,tokenizer,ldap,pdo,pdo_sqlite,zip,json,mbstring,iconv,zmq
ini-values: memory_limit=1G,opcache.enable_cli=0
- run: php --version

# install
- run: composer install --no-interaction --prefer-dist

# script
- run: php ./vendor/nette/tester/src/tester.php -j 4 -C tests --coverage ./coverage.xml --coverage-src ./app
- uses: codecov/codecov-action@v1

phpstan:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3']
php: ["8.4", "8.5"]
steps:
- uses: actions/checkout@v2
- name: Setup PHP with pecl and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl,composer:v2
extensions: yaml,tokenizer,ldap,pdo,pdo_sqlite,zip,json,mbstring,iconv,zmq
ini-values: memory_limit=1G,opcache.enable_cli=0
- run: php --version
# install
- run: composer install --no-interaction --prefer-dist
# script
- run: vendor/bin/phpstan analyse -c phpstan/phpstan.neon app
- uses: actions/checkout@v2
- name: Setup PHP with pecl and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl,composer:v2
extensions: yaml,tokenizer,ldap,pdo,pdo_sqlite,zip,json,mbstring,iconv,zmq
ini-values: memory_limit=1G,opcache.enable_cli=0
- run: php --version

# install
- run: composer install --no-interaction --prefer-dist

# script
- run: vendor/bin/phpstan analyse -c phpstan/phpstan.neon app

phpstan-tests:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3']
php: ["8.4", "8.5"]
steps:
- uses: actions/checkout@v2
- name: Setup PHP with pecl and extensions
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Business logic core of the application and a REST API that provides access to ot

### Prerequisites

You need a web server with PHP (8.2+, 8.3 currently used in development) and MySQL or MariaDB database.
You need a web server with PHP (8.4+, 8.5 currently used) and MySQL or MariaDB database.

We recommend installing PHP from remi repository:

Expand All @@ -28,7 +28,7 @@ You may list the PHP modules thusly:
...and select the right module:

```
# dnf module enable php:remi-8.3
# dnf module enable php:remi-8.5
```

If you install core-api as a package, the PHP will be installed as dependencies.
Expand Down
4 changes: 2 additions & 2 deletions app/V1Module/presenters/PipelinesPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function actionGetDefaultBoxes()
$this->sendSuccessResponse($boxes);
}

public function checkDefault(string $search = null)
public function checkDefault()
{
if (!$this->pipelineAcl->canViewAll()) {
throw new ForbiddenRequestException("You cannot list all pipelines.");
Expand Down Expand Up @@ -383,7 +383,7 @@ public function actionUpdatePipeline(string $id)
$pipeline->setPipelineConfig($newConfig);
}

$parameters = $this->request->getPost("parameters");
$parameters = $req->getPost("parameters");
if ($parameters !== null) {
$pipeline->setParameters($parameters);
}
Expand Down
3 changes: 1 addition & 2 deletions app/V1Module/presenters/SubmitPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,7 @@ public function checkPreSubmit(string $id, ?string $userId = null)
*/
#[Post("files", new VArray(new VUuid()), "Submitted files", nullable: true)]
#[Path("id", new VUuid(), "identifier of assignment", required: true)]
#[Query("userId", new VUuid(), "Identifier of the submission author", required: false, nullable: true)]
public function actionPreSubmit(string $id, string $userId = null)
public function actionPreSubmit(string $id)
{
$assignment = $this->assignments->findOrThrow($id);

Expand Down
1 change: 0 additions & 1 deletion app/async/Notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public static function isAvailable(): bool
{
$requirements = ['inotify_init', 'inotify_add_watch', 'inotify_read', 'inotify_queue_len', 'stream_select'];
foreach ($requirements as $reqFnc) {
// @phpstan-ignore-next-line
if (!function_exists($reqFnc)) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/Emails/EmailHelper/EmailHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ public function sendFromDefault(array $to, string $locale, string $subject, stri
* @param Exception $lastMailerException Exception thrown from the sender (if any). Its message is logged as well.
* @throws Exception
*/
private function archiveMailCopy(Message $message, Exception $lastMailerException = null)
private function archiveMailCopy(Message $message, ?Exception $lastMailerException = null)
{
if (!file_exists($this->archivingDir)) {
mkdir($this->archivingDir, 0775, true); // make sure logging directory exists
}

// Logging is not that important, all following opertions fail silently.
// Logging is not that important, all following operations fail silently.
if (file_exists($this->archivingDir) && is_writeable($this->archivingDir)) {
$data = [
'----- BEGIN MAIL -----',
Expand Down
3 changes: 1 addition & 2 deletions app/helpers/ExerciseConfig/Compilation/CompilationParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/
class CompilationParams
{

/**
* Files submitted by user.
* @var string[]
Expand Down Expand Up @@ -69,7 +68,7 @@ public function isDebug(): bool
public static function create(
array $files = [],
bool $debug = false,
SolutionParams $solutionParams = null
?SolutionParams $solutionParams = null
): CompilationParams {
$params = new CompilationParams();
$params->files = $files;
Expand Down
6 changes: 2 additions & 4 deletions app/helpers/ExerciseConfig/Compilation/Tree/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Helpers\ExerciseConfig\Compilation\Tree;

use App\Helpers\ExerciseConfig\Pipeline\Box\Box;
use App\Helpers\ExerciseConfig\VariablesTable;

/**
* Node representing Box in the compilation of exercise. It can hold additional
Expand All @@ -13,7 +12,6 @@
*/
class Node
{

/**
* PortNode from which was this node created.
* @var ?PortNode
Expand Down Expand Up @@ -65,9 +63,9 @@ class Node

/**
* Node constructor.
* @param ?PortNode $node
* @param PortNode|null $node
*/
public function __construct(PortNode $node = null)
public function __construct(?PortNode $node = null)
{
if ($node) {
$this->portNode = $node;
Expand Down
6 changes: 2 additions & 4 deletions app/helpers/ExerciseConfig/Compilation/Tree/PortNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Helpers\ExerciseConfig\Compilation\Tree;

use App\Helpers\ExerciseConfig\Pipeline\Box\Box;
use App\Helpers\ExerciseConfig\VariablesTable;
use Nette\Utils\Arrays;

/**
Expand All @@ -15,7 +14,6 @@
*/
class PortNode
{

/**
* Node structure created based on this node.
* @var Node
Expand Down Expand Up @@ -84,10 +82,10 @@ class PortNode
/**
* Node constructor.
* @param Box $box
* @param ?string $pipelineId
* @param string|null $pipelineId
* @param string|null $testId
*/
public function __construct(Box $box, string $pipelineId = null, string $testId = null)
public function __construct(Box $box, ?string $pipelineId = null, ?string $testId = null)
{
$this->box = $box;
$this->pipelineId = $pipelineId;
Expand Down
19 changes: 9 additions & 10 deletions app/helpers/ExerciseConfig/Config/ExerciseConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
*/
class ExerciseConfig implements JsonSerializable
{

/** Key for the environments list item */
const ENVIRONMENTS_KEY = "environments";
public const ENVIRONMENTS_KEY = "environments";
/** Key for the tests item */
const TESTS_KEY = "tests";
public const TESTS_KEY = "tests";

/** @var array tests indexed by test name */
protected $tests = array();
protected $tests = [];
/** @var array list of which can be present in tests environments */
protected $environments = array();
protected $environments = [];


/**
Expand All @@ -35,7 +34,7 @@ public function getEnvironments(): array
/**
* Add environment into this holder.
* @param string $id
* @return $this
* @return ExerciseConfig $this
*/
public function addEnvironment(string $id): ExerciseConfig
{
Expand All @@ -46,7 +45,7 @@ public function addEnvironment(string $id): ExerciseConfig
/**
* Remove environment according to given name identification.
* @param string $id
* @return $this
* @return ExerciseConfig $this
*/
public function removeEnvironment(string $id): ExerciseConfig
{
Expand Down Expand Up @@ -83,7 +82,7 @@ public function getTest(string $id): ?Test
* Add test into this holder.
* @param string $id
* @param Test $test
* @return $this
* @return ExerciseConfig $this
*/
public function addTest(string $id, Test $test): ExerciseConfig
{
Expand All @@ -94,7 +93,7 @@ public function addTest(string $id, Test $test): ExerciseConfig
/**
* Remove test according to given test identification.
* @param string $id
* @return $this
* @return ExerciseConfig $this
*/
public function removeTest(string $id): ExerciseConfig
{
Expand All @@ -106,7 +105,7 @@ public function removeTest(string $id): ExerciseConfig
* Remove test according to given test identification.
* @param string $oldId
* @param string $newId
* @return $this
* @return ExerciseConfig $this
*/
public function changeTestId(string $oldId, string $newId): ExerciseConfig
{
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/ExerciseConfig/Variables/Variable.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Variable implements JsonSerializable
* @param string|array $value
* @throws ExerciseConfigException
*/
public function __construct(string $type, string $name = null, $value = null)
public function __construct(string $type, ?string $name = null, $value = null)
{
$this->type = $type;
$this->name = $name;
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/FileStorage/LocalStorage/ZipFileStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ private function setCompressionLevel(string $storagePath, ?int $level = null): v
/**
* Constructor
* @param string $archivePath path to the actual ZIP file
* @param string $archiveStoragePath path to ZIP file within external storage (null if standalone)
* @param string|null $archiveStoragePath path to ZIP file within external storage (null if standalone)
* @param bool $overwrite whether the OVERWRITE flag should be set when opening the archive
*/
public function __construct(
TmpFilesHelper $tmpFilesHelper,
string $archivePath,
string $archiveStoragePath = null,
?string $archiveStoragePath = null,
bool $overwrite = false
) {
$this->tmpFilesHelper = $tmpFilesHelper;
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/ZenifyFixtures/Alice/CustomNativeLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CustomNativeLoader extends NativeLoader
* @param FakerGenerator|null $fakerGenerator
* @param ChainableParserInterface[] $parsers
*/
public function __construct(FakerGenerator $fakerGenerator = null, array $parsers)
public function __construct(?FakerGenerator $fakerGenerator = null, array $parsers = [])
{
$this->parsers = $parsers; // this needs to be first
parent::__construct($fakerGenerator);
Expand Down
2 changes: 1 addition & 1 deletion app/model/entity/ExerciseConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getAuthor(): ?User
public function __construct(
string $config,
User $author,
ExerciseConfig $createdFrom = null
?ExerciseConfig $createdFrom = null
) {
$this->createdAt = new DateTime();

Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,31 @@
},
"config": {
"platform": {
"php": "8.2.0"
"php": "8.5"
}
},
"require": {
"php": ">=8.2",
"php": ">=8.3",
"bjeavons/zxcvbn-php": "^1.4",
"contributte/console": "^0.11.0",
"firebase/php-jwt": "^7.0",
"forxer/gravatar": "^5.0",
"guzzlehttp/guzzle": "^7.10",
"eluceo/ical": "^2.7",
"eluceo/ical": "^2.16",
"ext-yaml": ">=2.0",
"ext-json": ">=1.7",
"ext-zip": ">=1.15",
"latte/latte": "^3.1",
"league/commonmark": "^2.8",
"nelmio/alice": "^3.17",
"nette/application": "^3.2",
"nette/bootstrap": "^3.2",
"nette/application": "^3.3",
"nette/bootstrap": "^3.3",
"nette/caching": "^3.4",
"nette/database": "^3.2",
"nette/di": "^3.2",
"nette/finder": "^3.0",
"nette/forms": "^3.2",
"nette/http": "^3.3",
"nette/forms": "^3.3",
"nette/http": "^3.4",
"nette/mail": "^4.0",
"nette/neon": "^3.4",
"nette/robot-loader": "^4.1",
Expand Down
Loading
Loading