ramsey / php-library-starter-kit

:building_construction: A tool to quickly set up the base files of a PHP library project.
MIT License
243 stars 25 forks source link

Doesn't work on php 8 🤷‍♂️ #36

Closed upyx closed 2 years ago

upyx commented 2 years ago

A fatal error on php 8

Description

Fatal error: Declaration of Ramsey\Dev\Tools\Process\Process::getIterator($flags = 0) must be compatible with Symfony\Component\Process\Process::getIterator(int $flags = 0): Generator in /home/upyx/Projects/pik/url-signer/uri-signature/vendor/ramsey/devtools-lib/src/Process/Process.php on line 101

 [ERROR] Array to string conversion                                                                                     

         At line 35 in phar:///usr/bin/composer/vendor/symfony/process/Exception/ProcessFailedException.php             

# php --version
PHP 8.0.10 (cli) (built: Aug 27 2021 21:31:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.10, Copyright (c) Zend Technologies

Content of README.md is the same as composer.json.

Steps to reproduce

Just try

Environment details

ramsey commented 2 years ago

Thanks for the report! This is a duplicate of #35

upyx commented 2 years ago

Em... On PHP 7.4 it works without a fatal error. It's a different bug :)

ramsey commented 2 years ago

Interesting. It results in the same outcome, no matter what's going on, though, which is odd.

upyx commented 2 years ago

I've just realized that the devtools' bug.

\Ramsey\Dev\Tools\Process\Process::getIterator has the signature:

public function getIterator($flags = 0)

It extends the Symfony's \Symfony\Component\Process\Process::getIterator with different type of argument:

public function getIterator(int $flags = 0)

That changing has been deprecated in PHP 8.

ramsey commented 2 years ago

Good catch! That definitely helps a lot!

upyx commented 2 years ago

It was fixed in devtools 1.4.0 by removing getIterator method.