Closed dwo0 closed 4 months ago
A quick command-line search found the following lines with issues:
find . -type f -name "*.php" -exec egrep "[ (]([A-Za-z0-9_]+) \\\$([A-Za-z0-9_]+) = null\b" {} \; -print
./src/Node/Node.php
protected function setParent(Node $node = null)
./src/Extension/Mention/Mention.php
public function __construct(string $symbol, string $identifier, string $label = null)
./src/Extension/Table/TableCell.php
public function __construct(string $string = '', string $type = self::TYPE_BODY, string $align = null)
./src/Block/Element/AbstractBlock.php
protected function setParent(Node $node = null)
./src/CommonMarkConverter.php
public function __construct(array $config = [], EnvironmentInterface $environment = null)
./src/GithubFlavoredMarkdownConverter.php
public function __construct(array $config = [], EnvironmentInterface $environment = null)
./src/Delimiter/DelimiterStack.php
private function findEarliest(DelimiterInterface $stackBottom = null): ?DelimiterInterface
public function removeAll(DelimiterInterface $stackBottom = null)
Thanks for the detailed issue report!
All nullable parameters have been marked as explicitly nullable since 2.0.0 (see https://github.com/thephpleague/commonmark/pull/468). Given that 1.x is no longer supported, I'd recommend either silencing those notices or upgrading to 2.x whenever you can.
My apologies. Something strange happened with Composer however. Installing the package using PHP 8.3.9 installs 2.5.0 where installing it with the new alpha versions of PHP 8.4 installs 1.6.7. Maybe that’s something that you want to be aware of, but, hopefully, that gets fixed with later releases of PHP 8.4. Regardless, sorry about that. I should have actually looked at the code in the GitHub repository.
No problem!
Installing the package using PHP 8.3.9 installs 2.5.0 where installing it with the new alpha versions of PHP 8.4 installs 1.6.7.
I'm guessing this is because version 2.x requires nette/schema
which doesn't yet have a release allowing installation on PHP 8.4, so you'd need to use --ignore-platform-req=php
with your Composer commands to successfully install on PHP 8.4.
Version(s) affected
1.6.7
Description
When running under the alpha versions of PHP 8.4 (8.4.0alpha2 in this case), multiple deprecation notices are raised with words to the effect of “Implicitly marking parameter X as nullable is deprecated, the explicit nullable type must be used instead”
How to reproduce
Install PHP 8.4alpha2 with deprecation notices enabled.
Possible solution
Types that can be nullable need to be marked as nullable by prefixing a question mark to the type declaration: https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.nullable
Additional context
No response
Did this project help you today? Did it make you happy in any way?
No response