Skip to content

Commit

Permalink
Support php 8.2 (pimcore#14080)
Browse files Browse the repository at this point in the history
* [Actions] PhpStan workflow: added PHP 8.2

* [Actions] Codeception workflow: added PHP 8.2

* Fixed phpstan issues

* Updated definition of Dataobject

* Fixed phpstan errors

* Fixed phpstan issues

* Fixed phpstan issues

* Fixed phpstan issue

* Updated carbon version to latest

* Revert phpstan issue

* Task: add changelog entry

* Chore: set maximum php 8.2

* Removed unnecessary properties

* Removed $renderer property, directly return string instead
Set php 8.2 tests from experimental true to false and added tests for symfony 6 dev-branch and php 8.2

* Removed symfony dev branch tests for 8.1, dev branch tests with 8.2 are enough

* Removed upgrade notes entry, it was already added by another pr

---------

Co-authored-by: Bernhard Rusch <[email protected]>
Co-authored-by: JiaJiaJi <[email protected]>
Co-authored-by: Marco Perberschlager <[email protected]>
  • Loading branch information
4 people authored Feb 21, 2023
1 parent 95cc7a0 commit 528335a
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/codeception.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ jobs:
strategy:
matrix:
include:
- { php-version: 8.1, database: "mariadb:10.6", dependencies: highest, experimental: true, storage: local, symfony: "6.3.x-dev", composer-options: "" }
- { php-version: 8.2, database: "mariadb:10.5", dependencies: highest, experimental: false, storage: local, symfony: "", composer-options: "" }
- { php-version: 8.2, database: "mariadb:10.4", dependencies: lowest, experimental: false, storage: local, symfony: "", composer-options: "" }
- { php-version: 8.2, database: "mariadb:10.6", dependencies: highest, experimental: true, storage: local, symfony: "6.3.x-dev", composer-options: "" }
- { php-version: 8.1, database: "mariadb:10.7", dependencies: highest, experimental: false, storage: local, symfony: "", composer-options: "" }
- { php-version: 8.1, database: "mariadb:10.3", dependencies: lowest, experimental: false, storage: local, symfony: "", composer-options: "" }
- { php-version: 8.1, database: "mysql:8.0", dependencies: lowest, experimental: false, storage: local, symfony: "", composer-options: "" }
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ jobs:
strategy:
matrix:
include:
- { php-version: "8.2", dependencies: "lowest", experimental: false, symfony: "", composer-options: "" }
- { php-version: "8.2", dependencies: "highest", experimental: false, symfony: "", composer-options: "" }
- { php-version: "8.2", dependencies: "highest", experimental: true, symfony: "6.3.x-dev", composer-options: "" }
- { php-version: "8.1", dependencies: "lowest", experimental: false, symfony: "", composer-options: "" }
- { php-version: "8.1", dependencies: "highest", experimental: false, symfony: "", composer-options: "" }
- { php-version: "8.1", dependencies: "highest", experimental: true, symfony: "6.3.x-dev", composer-options: "" }

steps:
- name: "Checkout code"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ protected function buildOptions(): array
Logger::error((string) $e);
}
}

return $options;
}

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"docs": "https://pimcore.com/docs/latest/"
},
"require": {
"php": "^8.1",
"php": "~8.1.0 || ~8.2.0",
"ext-SimpleXML": "*",
"ext-dom": "*",
"ext-exif": "*",
Expand Down Expand Up @@ -71,7 +71,7 @@
"mpratt/embera": "^2.0.14",
"myclabs/deep-copy": "^1.11",
"neitanod/forceutf8": "^2.0.4",
"nesbot/carbon": "^2.27",
"nesbot/carbon": "^2.65",
"pear/net_url2": "^2.2",
"matomo/device-detector": "^6.0",
"presta/sitemap-bundle": "^3.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For production, we highly recommend a *nix based system.
- Nginx


### PHP >= 8.1
### PHP >=8.1 <8.3
Both **mod_php** and **FCGI (FPM)** are supported.

#### Required Settings and Modules & Extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [Logging] Removed constant `PIMCORE_PHP_ERROR_LOG`
- [General] **Attention:** Added native php types for argument types, property types, return types and strict type declaration where possible.
This results in **various bc breaks**. Please make sure to add the corresponding types to your implementation.
- [PHP] The minimum supported PHP version is now 8.1 and added support for 8.2
- [UrlSlug] Removed `index` column and `index` index from `object_url_slugs` table as it was not being used anywhere.
- Bumped Symfony packages to "^6.2". Pimcore 11 will only support Symfony 6.
- `FrontendController::renderTemplate()`: Changed the visibility to `protected`.
Expand Down
2 changes: 2 additions & 0 deletions lib/DataObject/GridColumnConfig/ConfigElementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ public function getLabel(): string;
* @return \stdClass|ResultContainer|null
*/
public function getLabeledValue(array|ElementInterface $element): ResultContainer|\stdClass|null;

public function getRenderer(): ?string;
}
5 changes: 5 additions & 0 deletions lib/DataObject/GridColumnConfig/Operator/AbstractOperator.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,9 @@ public function getValidLanguages(): array
{
return Tool::getValidLanguages();
}

public function getRenderer(): ?string
{
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@
*/
final class GeopointRenderer extends AbstractRenderer
{
public string $renderer = 'geopoint';
public function getRenderer(): ?string
{
return 'geopoint';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@
*/
final class HotspotimageRenderer extends AbstractRenderer
{
public string $renderer = 'hotspotimage';
public function getRenderer(): ?string
{
return 'hotspotimage';
}
}
5 changes: 4 additions & 1 deletion lib/DataObject/GridColumnConfig/Operator/ImageRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@
*/
final class ImageRenderer extends AbstractRenderer
{
public string $renderer = 'image';
public function getRenderer(): ?string
{
return 'image';
}
}
5 changes: 5 additions & 0 deletions lib/DataObject/GridColumnConfig/Value/AbstractValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ public function getLabel(): string
{
return $this->label;
}

public function getRenderer(): ?string
{
return null;
}
}
4 changes: 2 additions & 2 deletions models/DataObject/ClassDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ public static function cleanupForExport(mixed &$data): void
}
}

if (isset($data->blockedVarsForExport)) {
unset($data->blockedVarsForExport);
if (!empty($data->getBlockedVarsForExport())) {
$data->setBlockedVarsForExport([]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ public function getBlockedVarsForExport(): array;
* @return array
*/
public function resolveBlockedVars(): array;

/**
* @param array $vars
* @return $this
*/
public function setBlockedVarsForExport(array $vars): static;
}
12 changes: 12 additions & 0 deletions models/DataObject/ClassDefinition/Helper/VarExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

namespace Pimcore\Model\DataObject\ClassDefinition\Helper;

use Pimcore\Model\DataObject\ClassDefinition\Data\VarExporterInterface;

/**
* @internal
*/
Expand Down Expand Up @@ -46,4 +48,14 @@ public static function __set_state(array $data): static

return $obj;
}

/**
* @param array $vars
* @return $this
*/
public function setBlockedVarsForExport(array $vars): static
{
$this->blockedVarsForExport = $vars;
return $this;
}
}
4 changes: 2 additions & 2 deletions models/DataObject/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,8 @@ public static function calculateCellValue(AbstractObject $object, array $helperD
if (isset($result->value)) {
$result = $result->value;

if (!empty($config->renderer)) {
$classname = 'Pimcore\\Model\\DataObject\\ClassDefinition\\Data\\' . ucfirst($config->renderer);
if (!empty($config->getRenderer())) {
$classname = 'Pimcore\\Model\\DataObject\\ClassDefinition\\Data\\' . ucfirst($config->getRenderer());
/** @var Model\DataObject\ClassDefinition\Data $rendererImpl */
$rendererImpl = new $classname();
if (method_exists($rendererImpl, 'getDataForGrid')) {
Expand Down
10 changes: 5 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ parameters:
count: 2
path: bundles/CoreBundle/src/DependencyInjection/PimcoreCoreExtension.php

-
message: "#^If condition is always true\\.$#"
count: 1
path: bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionCombo.php

-
message: "#^If condition is always true\\.$#"
count: 1
Expand All @@ -20,11 +25,6 @@ parameters:
count: 1
path: bundles/EcommerceFrameworkBundle/src/Controller/VoucherController.php

-
message: "#^If condition is always true\\.$#"
count: 1
path: bundles/EcommerceFrameworkBundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionCombo.php

-
message: "#^Parameter \\#1 \\$fieldname of method Pimcore\\\\Bundle\\\\EcommerceFrameworkBundle\\\\IndexService\\\\ProductList\\\\ProductListInterface\\:\\:getGroupByValues\\(\\) expects string, Pimcore\\\\Bundle\\\\EcommerceFrameworkBundle\\\\CoreExtensions\\\\ObjectData\\\\IndexFieldSelection\\|null given\\.$#"
count: 1
Expand Down

0 comments on commit 528335a

Please sign in to comment.