wp-cli / php-cli-tools

A collection of tools to help with PHP command line utilities
MIT License
673 stars 118 forks source link

Lots of deprecation warnings with PHP version 8.1.7 #149

Closed mikejw closed 2 years ago

mikejw commented 2 years ago

I'm getting lots of deprecation warning when running this PHP script. It's only with PHP version 8 that this is happening.

https://github.com/mikejw/empathy/blob/bootstrap4/bin/empathy

`PHP` Deprecated:  Return type of cli\Arguments::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/Arguments.php on line 89

Deprecated: Return type of cli\Arguments::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/Arguments.php on line 89
PHP Deprecated:  Return type of cli\Arguments::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/Arguments.php on line 103

Deprecated: Return type of cli\Arguments::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/Arguments.php on line 103
PHP Deprecated:  Return type of cli\Arguments::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/Arguments.php on line 119

Deprecated: Return type of cli\Arguments::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/Arguments.php on line 119
PHP Deprecated:  Return type of cli\Arguments::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/Arguments.php on line 132

Deprecated: Return type of cli\Arguments::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/Arguments.php on line 132
PHP Deprecated:  Return type of cli\arguments\Lexer::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Lexer.php on line 36

Deprecated: Return type of cli\arguments\Lexer::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Lexer.php on line 36
PHP Deprecated:  Return type of cli\arguments\Lexer::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Lexer.php on line 52

Deprecated: Return type of cli\arguments\Lexer::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Lexer.php on line 52
PHP Deprecated:  Return type of cli\arguments\Lexer::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Lexer.php on line 63

Deprecated: Return type of cli\arguments\Lexer::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Lexer.php on line 63
PHP Deprecated:  Return type of cli\arguments\Lexer::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Lexer.php on line 84

Deprecated: Return type of cli\arguments\Lexer::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Lexer.php on line 84
PHP Deprecated:  Return type of cli\arguments\Lexer::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Lexer.php on line 71

Deprecated: Return type of cli\arguments\Lexer::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Lexer.php on line 71
PHP Deprecated:  strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Argument.php on line 80

Deprecated: strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Argument.php on line 80
PHP Deprecated:  strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Argument.php on line 89

Deprecated: strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated in /Users/mike/code/mikejw/empathy-php8/vendor/wp-cli/php-cli-tools/lib/cli/arguments/Argument.php on line 89
danielbachhuber commented 2 years ago

Looks like this was fixed up with #147

Let us know if you come across any further issues!

aerogus commented 1 year ago

Maybe there are some more warnings with php8.1, I created a pull request some time ago : https://github.com/wp-cli/php-cli-tools/pull/152