From b4871306469f15d821211041d7fff6e6448815f4 Mon Sep 17 00:00:00 2001 From: picas Date: Sun, 28 Jan 2024 01:46:33 +0100 Subject: [PATCH] fix(code): try to be PHP8 compliant --- composer.json | 2 +- src/MarkdownExtended/API/Kernel.php | 2 +- src/MarkdownExtended/Console/Stream.php | 5 ++++- src/MarkdownExtended/Util/ContentCollection.php | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 515ba74..f0ea461 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "@stable", + "phpunit/phpunit": "9.*", "phpmd/phpmd": "@stable", "friendsofphp/php-cs-fixer": "@stable", "phpmetrics/phpmetrics": "@stable", diff --git a/src/MarkdownExtended/API/Kernel.php b/src/MarkdownExtended/API/Kernel.php index faec6de..a02249a 100644 --- a/src/MarkdownExtended/API/Kernel.php +++ b/src/MarkdownExtended/API/Kernel.php @@ -344,7 +344,7 @@ public static function applyConfig($name, array $params, $default = null) */ protected static function _configRecursiveIterator( $type = 'get', - $index, + $index = 0, $value = null, $default = null ) { diff --git a/src/MarkdownExtended/Console/Stream.php b/src/MarkdownExtended/Console/Stream.php index 678306b..b679af4 100644 --- a/src/MarkdownExtended/Console/Stream.php +++ b/src/MarkdownExtended/Console/Stream.php @@ -403,7 +403,10 @@ public function getPipedInput() $data .= fgets($this->stdin); } } - @file_put_contents($this->stdin, ''); + /* if (is_file($this->stdin)) { + file_put_contents($this->stdin, ''); + } + */ } catch (\Exception $e) { $data = null; } diff --git a/src/MarkdownExtended/Util/ContentCollection.php b/src/MarkdownExtended/Util/ContentCollection.php index 33fd0a0..4b9589f 100644 --- a/src/MarkdownExtended/Util/ContentCollection.php +++ b/src/MarkdownExtended/Util/ContentCollection.php @@ -38,7 +38,7 @@ public function __construct(array $data = []) * * @throws \MarkdownExtended\Exception\UnexpectedValueException it the argument does not implement `\MarkdownExtended\API\ContentInterface` */ - public function append($content) + public function append(mixed $content): void { if (!is_object($content) || !Kernel::valid($content, Kernel::TYPE_CONTENT)) { throw new UnexpectedValueException( @@ -61,7 +61,7 @@ public function append($content) * * @throws \MarkdownExtended\Exception\UnexpectedValueException it the argument does not implement `\MarkdownExtended\API\ContentInterface` */ - public function offsetSet($index, $content) + public function offsetSet(mixed $index, mixed $content): void { if (!is_object($content) || !Kernel::valid($content, Kernel::TYPE_CONTENT)) { throw new UnexpectedValueException(