Skip to content

Commit

Permalink
FFWEB-3156: Add support for PHP v8.2 and v8.3
Browse files Browse the repository at this point in the history
Add support for PHP v8.2 and v8.3
  • Loading branch information
Rayn93 authored Aug 28, 2024
1 parent 56436f6 commit d4856cb
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:
- name: Run Static analysis
run: |
vendor/bin/phpcs --config-set installed_paths vendor/magento/magento-coding-standard,vendor/magento/php-compatibility-fork
vendor/bin/phpcs --standard=phpcs.xml.dist --extensions=php,phtml src
vendor/bin/phpmd src text phpmd.xml.dist
vendor/bin/phpcs --config-set installed_paths vendor/magento/magento-coding-standard,vendor/magento/php-compatibility-fork
vendor/bin/phpcs --standard=phpcs.xml.dist --extensions=php,phtml src
vendor/bin/phpmd src text phpmd.xml.dist
- name: Run tests
run: |
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
## Unreleased
- Add support for PHP v8.2 and v8.3
- Add support for Magento 2.4.7

## [v4.3.3] - 2024.04.17
### Fix
- Support MSI - checking all inventory sources during export feed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": "~8.1.0",
"php": "~8.1.0||~8.2.0||~8.3.0",
"omikron/factfinder-communication-sdk": "^0.9.5",
"magento/framework": "~103.0.4",
"magento/module-catalog": "~104.0.4",
Expand Down
2 changes: 2 additions & 0 deletions src/Model/Export/Catalog/ExportPreviewProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

class ExportPreviewProducts implements \IteratorAggregate
{
private int $entityId = 0;

public function __construct(
private readonly ProductRepositoryInterface $productRepository,
private readonly RequestInterface $request,
Expand Down
8 changes: 6 additions & 2 deletions src/Model/Filter/TextFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@

class TextFilter implements FilterInterface
{

/**
* phpcs:disable Magento2.Functions.DiscouragedFunction.Discouraged
*/
public function filterValue(string $value): string
{
// phpcs:ignore
$tags = '#<(address|article|aside|blockquote|br|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h[1-6]|header|hr|li|main|nav|noscript|ol|p|pre|section|table|tfoot|ul|video)#';
$value = preg_replace($tags, ' <$1', $value); // Add one space in front of block elements before stripping tags
$value = strip_tags($value);
$value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8');
$value = mb_convert_encoding($value, 'UTF-8', 'HTML-ENTITIES');
$value = htmlentities($value);
$value = html_entity_decode($value);
$value = preg_replace('#\s+#u', ' ', $value);
$value = preg_replace('#[[:^print:]]#u', '', $value);
return trim($value);
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Stream/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getContent(): string
return $this->getStream()->readAll();
}

private function getStream(): WriteInterface
private function getStream(): ?WriteInterface
{
if (!$this->stream) {
$directory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
Expand Down
2 changes: 0 additions & 2 deletions src/Test/Unit/Model/Filter/TextFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public function textProvider()
return [
'strip whitespace' => [' FACT-Finder ', 'FACT-Finder'],
'remove/compact whitespace' => [" FACT \n\r\t\n Finder", 'FACT Finder'],
'convert html entities' => ['Gie&szlig;en M&Uuml;NCHEN Forl&igrave;', 'Gießen MÜNCHEN Forlì'],
'drop 2-byte chars' => ['Elisa EverCool&trade; Tee', 'Elisa EverCool™ Tee'],
'allowed symbols' => ['!"#$%&\'()*+,-./:;=?@[\]_{|}~|', '!"#$%&\'()*+,-./:;=?@[\]_{|}~|'],
'keep utf8 #1' => ['Österreich', 'Österreich'],
'keep utf8 #2' => ['Wrocław', 'Wrocław'],
Expand Down

0 comments on commit d4856cb

Please sign in to comment.