Skip to content

Commit

Permalink
handle empty and null values for php 8.1 (#2182)
Browse files Browse the repository at this point in the history
* handle empty and null values for php 8.1

* Apply php-cs-fixer changes

* changelog

* format json [skip ci]

---------

Co-authored-by: nadar <nadar@users.noreply.github.com>
  • Loading branch information
nadar and nadar authored Mar 16, 2023
1 parent 730a90d commit 9562135
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 136 deletions.
162 changes: 81 additions & 81 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
{
"name": "luyadev/luya",
"description": "LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.",
"type": "project",
"keywords": [
"php",
"yii2",
"cms",
"luya",
"website",
"content",
"angular",
"modules",
"framework"
],
"license": "MIT",
"homepage": "https://luya.io",
"authors": [
{
"name": "Basil Suter",
"email": "git@nadar.io",
"homepage": "https://github.com/nadar"
}
],
"support": {
"issues": "https://github.com/luyadev/luya/issues"
},
"require": {
"luyadev/luya-composer": "^1.0",
"luyadev/yii-helpers": "^1.0",
"yiisoft/yii2": "~2.0.15",
"curl/curl": "^2.0 || ^1.0",
"phpmailer/phpmailer": "^6.0",
"nadar/php-composer-reader": "^1.0",
"cpliakas/git-wrapper": "^1.0 || ^2.0",
"giggsey/libphonenumber-for-php": "^8.11"
},
"require-dev": {
"luyadev/luya-testsuite": "^2.0",
"nadar/github-markdown-fixer": "^1.0",
"unglue/client": "^1.5",
"friendsofphp/php-cs-fixer": "^3.2",
"phpstan/phpstan": "^1.7",
"rector/rector": "^0.14.2"
},
"autoload": {
"psr-4": {
"luya\\": "core/",
"luya\\dev\\": "dev",
"luyatests\\": "tests/"
}
},
"extra": {
"asset-installer-paths": {
"bower-asset-library": "vendor/bower"
}
},
"config": {
"fxp-asset": {
"enabled": false
},
"allow-plugins": {
"yiisoft/yii2-composer": true,
"luyadev/luya-composer": true
}
},
"bin": [
"core/bin/luya",
"dev/luyadev"
],
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
],
"scripts": {
"phpstan": "vendor/bin/phpstan -v",
"phpcsfixer": "vendor/bin/php-cs-fixer fix",
"rector": "vendor/bin/rector"
}
}
"name": "luyadev/luya",
"description": "LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.",
"type": "project",
"keywords": [
"php",
"yii2",
"cms",
"luya",
"website",
"content",
"angular",
"modules",
"framework"
],
"license": "MIT",
"homepage": "https://luya.io",
"authors": [
{
"name": "Basil Suter",
"email": "git@nadar.io",
"homepage": "https://github.com/nadar"
}
],
"support": {
"issues": "https://github.com/luyadev/luya/issues"
},
"require": {
"luyadev/luya-composer": "^1.0",
"luyadev/yii-helpers": "^1.0",
"yiisoft/yii2": "~2.0.15",
"curl/curl": "^2.0 || ^1.0",
"phpmailer/phpmailer": "^6.0",
"nadar/php-composer-reader": "^1.0",
"cpliakas/git-wrapper": "^1.0 || ^2.0",
"giggsey/libphonenumber-for-php": "^8.11"
},
"require-dev": {
"luyadev/luya-testsuite": "^2.0",
"nadar/github-markdown-fixer": "^1.0",
"unglue/client": "^1.5",
"friendsofphp/php-cs-fixer": "^3.2",
"phpstan/phpstan": "^1.7",
"rector/rector": "^0.14.2"
},
"autoload": {
"psr-4": {
"luya\\": "core/",
"luya\\dev\\": "dev",
"luyatests\\": "tests/"
}
},
"extra": {
"asset-installer-paths": {
"bower-asset-library": "vendor/bower"
}
},
"config": {
"fxp-asset": {
"enabled": false
},
"allow-plugins": {
"yiisoft/yii2-composer": true,
"luyadev/luya-composer": true
}
},
"bin": [
"core/bin/luya",
"dev/luyadev"
],
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
],
"scripts": {
"phpstan": "vendor/bin/phpstan -v",
"phpcsfixer": "vendor/bin/php-cs-fixer fix",
"rector": "vendor/bin/rector"
}
}
3 changes: 2 additions & 1 deletion core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ In order to read more about upgrading and BC breaks have a look at the [UPGRADE

> Check the [UPGRADE document](UPGRADE.md) to read more about breaking changes.
+ [#2165](https://github.com/luyadev/luya/pull/2165) Official deprecated unit tests for php 7.0 and 7.1. Code is unchanged.
+ [#2165](https://github.com/luyadev/luya/pull/2165) Officially deprecated unit tests for php 7.0 and 7.1. Code is unchanged.
+ [#2182](https://github.com/luyadev/luya/pull/2182) Ensure PHP 8.1 compatibility when `TagParser::convertWithMarkdown()` recieves an empty value.

## 2.2.1 (5. October 2022)

Expand Down
4 changes: 4 additions & 0 deletions core/TagParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ public static function convert($text)
*/
public static function convertWithMarkdown($text)
{
if (empty($text)) {
return $text;
}

return (new TagMarkdownParser())->parse(static::convert($text));
}

Expand Down
108 changes: 54 additions & 54 deletions core/composer.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
{
"name": "luyadev/luya-core",
"description": "LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.",
"type": "luya-core",
"keywords": [
"luya",
"core",
"yii2",
"yii",
"cms",
"admin"
],
"license": "MIT",
"homepage": "https://luya.io",
"authors": [
{
"name": "Basil Suter",
"email": "git@nadar.io",
"homepage": "https://github.com/nadar"
}
],
"support": {
"issues": "https://github.com/luyadev/luya/issues"
"name": "luyadev/luya-core",
"description": "LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.",
"type": "luya-core",
"keywords": [
"luya",
"core",
"yii2",
"yii",
"cms",
"admin"
],
"license": "MIT",
"homepage": "https://luya.io",
"authors": [
{
"name": "Basil Suter",
"email": "git@nadar.io",
"homepage": "https://github.com/nadar"
}
],
"support": {
"issues": "https://github.com/luyadev/luya/issues"
},
"require": {
"luyadev/luya-composer": "^1.0",
"luyadev/yii-helpers": "^1.0",
"yiisoft/yii2": "~2.0.15",
"curl/curl": "^2.0 || ^1.0",
"phpmailer/phpmailer": "^6.0",
"giggsey/libphonenumber-for-php": "^8.11"
},
"autoload": {
"psr-4": {
"luya\\": ""
}
},
"config": {
"fxp-asset": {
"enabled": false
},
"require": {
"luyadev/luya-composer": "^1.0",
"luyadev/yii-helpers": "^1.0",
"yiisoft/yii2": "~2.0.15",
"curl/curl": "^2.0 || ^1.0",
"phpmailer/phpmailer": "^6.0",
"giggsey/libphonenumber-for-php": "^8.11"
},
"autoload": {
"psr-4": {
"luya\\": ""
}
},
"config": {
"fxp-asset": {
"enabled": false
},
"allow-plugins": {
"yiisoft/yii2-composer": true,
"luyadev/luya-composer": true
}
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
],
"bin": [
"bin/luya"
]
}
"allow-plugins": {
"yiisoft/yii2-composer": true,
"luyadev/luya-composer": true
}
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
],
"bin": [
"bin/luya"
]
}
6 changes: 6 additions & 0 deletions tests/core/tag/TagMarkdownParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace luyatests\core\tag;

use luya\tag\TagMarkdownParser;
use luya\TagParser;
use luyatests\LuyaWebTestCase;

class StubTagMarkdownParser extends TagMarkdownParser
Expand All @@ -15,6 +16,11 @@ public function stubParseUrl($url)

class TagMarkdownParserTest extends LuyaWebTestCase
{
public function testNullValues()
{
$this->assertNull(TagParser::convertWithMarkdown(null));
}

public function testNewline()
{
$parser = new TagMarkdownParser();
Expand Down

0 comments on commit 9562135

Please sign in to comment.