Skip to content

Commit

Permalink
PHP-Mindestversion 8.1 (#5465)
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan committed Jan 4, 2023
1 parent 4652c39 commit eb02de5
Show file tree
Hide file tree
Showing 41 changed files with 65 additions and 97 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rexlint.yml
Expand Up @@ -11,7 +11,7 @@ permissions:

jobs:
rexlint:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.event.pull_request.draft == false

Expand All @@ -22,7 +22,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
php-version: 8.1
coverage: none # disable xdebug, pcov

- name: Composer install
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/unit-tests.yml
Expand Up @@ -19,26 +19,20 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-18.04
php-version: '7.3'
- os: ubuntu-latest
php-version: '8.1'
db-image: 'mysql:5.6'
- os: ubuntu-latest
php-version: '7.4'
php-version: '8.2'
db-image: 'mysql:5.7'
- os: ubuntu-latest
php-version: '8.0'
php-version: '8.3'
db-image: 'mysql:8.0'
- os: ubuntu-latest
php-version: '8.1'
db-image: 'mysql:8.0'
- os: ubuntu-latest
php-version: '8.2'
db-image: 'mysql:8.0'
- os: ubuntu-18.04
php-version: '7.3'
db-image: 'mariadb:10.1'
- os: ubuntu-latest
php-version: '8.1'
php-version: '8.2'
db-image: 'mariadb:latest'

# https://docs.github.com/en/free-pro-team@latest/actions/guides/about-service-containers
Expand Down
2 changes: 1 addition & 1 deletion .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions .tools/phpstan/baseline.neon
Expand Up @@ -225,11 +225,6 @@ parameters:
count: 1
path: ../../redaxo/src/addons/install/lib/api/api_core_update.php

-
message: "#^Parameter \\#3 \\$alias of class PharData constructor expects string, null given\\.$#"
count: 1
path: ../../redaxo/src/addons/install/lib/archive.php

-
message: "#^Method rex_install_package_download\\:\\:extractArchiveTo\\(\\) has parameter \\$dir with no type specified\\.$#"
count: 1
Expand Down Expand Up @@ -1256,12 +1251,12 @@ parameters:
path: ../../redaxo/src/addons/metainfo/lib/input/datetime.php

-
message: "#^Parameter \\#1 \\$arr1 of function array_merge expects array, string given\\.$#"
message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, string given\\.$#"
count: 1
path: ../../redaxo/src/addons/metainfo/lib/input/datetime.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, string given\\.$#"
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, string given\\.$#"
count: 1
path: ../../redaxo/src/addons/metainfo/lib/input/datetime.php

Expand Down Expand Up @@ -2461,7 +2456,7 @@ parameters:
path: ../../redaxo/src/core/lib/autoload.php

-
message: "#^Parameter \\#1 \\$autoload_function of function spl_autoload_register expects callable\\(string\\)\\: void, array\\{'rex_autoload', 'autoload'\\} given\\.$#"
message: "#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{'rex_autoload', 'autoload'\\} given\\.$#"
count: 1
path: ../../redaxo/src/core/lib/autoload.php

Expand Down Expand Up @@ -4126,7 +4121,7 @@ parameters:
path: ../../redaxo/src/core/lib/util/socket/socket.php

-
message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int, array\\)\\: bool\\)\\|null, Closure\\(mixed, mixed\\)\\: void given\\.$#"
message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int\\)\\: bool\\)\\|null, Closure\\(mixed, mixed\\)\\: void given\\.$#"
count: 1
path: ../../redaxo/src/core/lib/util/socket/socket.php

Expand Down
6 changes: 1 addition & 5 deletions .tools/psalm/baseline.xml
Expand Up @@ -4873,12 +4873,8 @@
<PossiblyInvalidArrayOffset occurrences="1">
<code>$_SESSION[static::getSessionNamespace()]</code>
</PossiblyInvalidArrayOffset>
<PossiblyNullArgument occurrences="9">
<code>$cookieParams['domain']</code>
<code>$cookieParams['httponly']</code>
<PossiblyNullArgument occurrences="5">
<code>$cookieParams['lifetime']</code>
<code>$cookieParams['path']</code>
<code>$cookieParams['secure']</code>
<code>$this-&gt;impersonator-&gt;getValue($this-&gt;idColumn)</code>
<code>$this-&gt;user-&gt;getValue($this-&gt;idColumn)</code>
<code>$this-&gt;user-&gt;getValue($this-&gt;idColumn)</code>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -4,7 +4,7 @@
"description": "REDAXO CMS source repository (for static analysis)",
"license": "MIT",
"require": {
"php": ">=7.3",
"php": ">=8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-intl": "*",
Expand Down
3 changes: 1 addition & 2 deletions phpstan.neon.dist
Expand Up @@ -3,7 +3,7 @@ includes:

parameters:
level: 6
phpVersion: 70300 # PHP 7.3
phpVersion: 80100 # PHP 8.1
treatPhpDocTypesAsCertain: false
editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%'
paths:
Expand Down Expand Up @@ -41,7 +41,6 @@ parameters:
- '#Unsafe usage of new static\(\)\.#'
- '#Constructor of class rex_form_.*_element has an unused parameter \$tag.#'
- '#^Offset .* on .* always exists#'
- '#Parameter \#2 \$algo of function password_.+ expects int, string given\.#'
-
message: '#.*deprecated.*#'
path: '*/update.php'
Expand Down
8 changes: 0 additions & 8 deletions psalm.xml
Expand Up @@ -96,13 +96,5 @@
<RedundantFunctionCallGivenDocblockType errorLevel="info" />
<UnresolvableInclude errorLevel="suppress" />
<UnsafeInstantiation errorLevel="info" />
<!-- level 4 issues -->
<InvalidScalarArgument>
<errorLevel type="suppress">
<!-- https://github.com/vimeo/psalm/issues/3454 -->
<referencedFunction name="password_hash"/>
<referencedFunction name="password_needs_rehash"/>
</errorLevel>
</InvalidScalarArgument>
</issueHandlers>
</psalm>
2 changes: 1 addition & 1 deletion rector.php
Expand Up @@ -58,7 +58,7 @@

$rectorConfig->parallel();

$rectorConfig->phpVersion(PhpVersion::PHP_80);
$rectorConfig->phpVersion(PhpVersion::PHP_81);

// get services (needed for register a single rule)
$services = $rectorConfig->services();
Expand Down
2 changes: 1 addition & 1 deletion redaxo/src/addons/backup/composer.json
Expand Up @@ -5,7 +5,7 @@

"config": {
"platform": {
"php": "7.3.0"
"php": "8.1.13"
},
"platform-check": false
}
Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/addons/backup/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion redaxo/src/addons/backup/package.yml
Expand Up @@ -19,6 +19,6 @@ page:

requires:
php:
version: '>=7.3'
version: '>=8.1'
extensions: [ctype]
redaxo: ^5.9.0
2 changes: 1 addition & 1 deletion redaxo/src/addons/be_style/composer.json
Expand Up @@ -5,7 +5,7 @@

"config": {
"platform": {
"php": "7.3.0"
"php": "8.1.13"
},
"platform-check": false
}
Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/addons/be_style/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion redaxo/src/addons/be_style/package.yml
Expand Up @@ -12,5 +12,5 @@ console_commands:
styles:compile: rex_be_style_command_compile

requires:
php: '>=7.3'
php: '>=8.1'
redaxo: ^5.13.0
2 changes: 1 addition & 1 deletion redaxo/src/addons/cronjob/package.yml
Expand Up @@ -18,7 +18,7 @@ pages:
perm: admin[]

requires:
php: '>=7.3'
php: '>=8.1'
redaxo: ^5.13.0

console_commands:
Expand Down
2 changes: 1 addition & 1 deletion redaxo/src/addons/debug/composer.json
Expand Up @@ -5,7 +5,7 @@

"config": {
"platform": {
"php": "7.3.0"
"php": "8.1.13"
},
"platform-check": false
}
Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/addons/debug/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion redaxo/src/addons/debug/package.yml
Expand Up @@ -15,6 +15,6 @@ page:

requires:
php:
version: '>=7.3'
version: '>=8.1'
extensions: [zip]
redaxo: ^5.13.0
2 changes: 1 addition & 1 deletion redaxo/src/addons/install/package.yml
Expand Up @@ -21,7 +21,7 @@ page:

requires:
php:
version: '>=7.3'
version: '>=8.1'
extensions: [zlib]
redaxo: ^5.13.0

Expand Down
2 changes: 1 addition & 1 deletion redaxo/src/addons/media_manager/lib/effect_abstract.php
Expand Up @@ -73,7 +73,7 @@ public function getParams()
}

/**
* @param resource $gdImage
* @param GdImage $gdImage
* @return void
*/
protected function keepTransparent($gdImage)
Expand Down
Expand Up @@ -129,7 +129,7 @@ public function getParams()
}

/**
* @return resource
* @return GdImage
*/
private function imagereflection(&$image, $reflectionHeight, $reflectionOpacity, $transparent, $bgColor)
{
Expand Down
12 changes: 4 additions & 8 deletions redaxo/src/addons/media_manager/lib/managed_media.php
Expand Up @@ -29,7 +29,7 @@ class rex_managed_media
/** @var bool */
private $asImage = false;

/** @var array{width: ?int, height: ?int, src?: resource}&array<string, mixed> */
/** @var array{width: ?int, height: ?int, src?: GdImage}&array<string, mixed> */
private $image = [
'width' => null,
'height' => null,
Expand Down Expand Up @@ -306,7 +306,7 @@ protected function getImageSource()
$format = 'jpeg' === $format ? 'jpg' : $format;

$interlace = (array) $this->getImageProperty(self::PROP_INTERLACE, $addon->getConfig('interlace'));
imageinterlace($this->image['src'], in_array($format, $interlace) ? 1 : 0);
imageinterlace($this->image['src'], in_array($format, $interlace));

ob_start();
if ('jpg' == $format) {
Expand All @@ -327,7 +327,7 @@ protected function getImageSource()
}

/**
* @return resource
* @return GdImage
*/
public function getImage()
{
Expand All @@ -339,7 +339,7 @@ public function getImage()
}

/**
* @param resource $src
* @param GdImage $src
* @return void
*/
public function setImage($src)
Expand All @@ -357,10 +357,6 @@ public function setSourcePath($path)
$this->sourcePath = $path;

$this->asImage = false;
// PHP 7 compat
if (isset($this->image['src']) && is_resource($this->image['src'])) {
imagedestroy($this->image['src']);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion redaxo/src/addons/media_manager/package.yml
Expand Up @@ -16,7 +16,7 @@ page:

requires:
php:
version: '>=7.3'
version: '>=8.1'
extensions: [gd]
redaxo: ^5.10.0

Expand Down
2 changes: 1 addition & 1 deletion redaxo/src/addons/mediapool/package.yml
Expand Up @@ -30,5 +30,5 @@ allowed_doctypes: [bmp, css, doc, docx, eps, gif, gz, jpg, jpeg, mov, mp3, mp4,
image_extensions: [bmp, gif, jpeg, jpg, png, svg, tif, tiff, webp]

requires:
php: '>=7.3'
php: '>=8.1'
redaxo: ^5.13.0
2 changes: 1 addition & 1 deletion redaxo/src/addons/metainfo/functions/function_metainfo.php
Expand Up @@ -209,7 +209,7 @@ function rex_metainfo_meta_prefix(string $name)
}

$prefix = substr(strtolower($name), 0, $pos + 1);
if (false === $prefix) {
if ('' === $prefix) {
throw new InvalidArgumentException('$name must be like "prefix_name".');
}

Expand Down
2 changes: 1 addition & 1 deletion redaxo/src/addons/metainfo/package.yml
Expand Up @@ -15,7 +15,7 @@ page:
clangs: { title: 'translate:clangs' }

requires:
php: '>=7.3'
php: '>=8.1'
redaxo: '^5.13.0'
packages:
structure: '^2.12.1'
Expand Down
2 changes: 1 addition & 1 deletion redaxo/src/addons/phpmailer/composer.json
Expand Up @@ -3,7 +3,7 @@

"config": {
"platform": {
"php": "7.3.0"
"php": "8.1.13"
},
"platform-check": false
}
Expand Down

0 comments on commit eb02de5

Please sign in to comment.