wp-cli / i18n-command

Provides internationalization tools for WordPress projects.
MIT License
96 stars 52 forks source link

PHP deprecated notices in Unit test #401

Closed ernilambar closed 2 months ago

ernilambar commented 2 months ago

Bug Report

Describe the current, buggy behavior

Run: composer run phpunit

Describe what you would expect as the correct outcome

No notices.

Let us know what environment you are running this on

OS:     Darwin 22.6.0 Darwin Kernel Version 22.6.0: Tue Nov  7 21:48:06 PST 2023; root:xnu-8796.141.3.702.9~2/RELEASE_X86_64 x86_64
Shell:  /bin/zsh
PHP binary:     /usr/local/Cellar/php@8.2/8.2.18/bin/php
PHP version:    8.2.18
php.ini used:   /usr/local/etc/php/8.2/php.ini
MySQL binary:   /usr/local/mysql-8.0.36-macos14-x86_64/bin/mysql
MySQL version:  mysql  Ver 8.0.36 for macos14 on x86_64 (MySQL Community Server - GPL)
SQL modes:
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /Users/nilambarsharma/Code/kli/i18n-command
WP-CLI packages dir:    /Users/nilambarsharma/.wp-cli/packages/
WP-CLI cache dir:       /Users/nilambarsharma/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:  /Users/nilambarsharma/Code/kli/i18n-command/wp-cli.yml
WP-CLI version: 2.10.0

Provide additional context/Screenshots

Deprecated: Accessing static trait property WP_CLI\I18n\IterableCodeExtractor::$dir is deprecated, it should only be accessed on a class using the trait in /Users/nilambarsharma/Code/kli/i18n-command/tests/IterableCodeExtractorTest.php on line 24

Deprecated: Calling static trait method WP_CLI\I18n\IterableCodeExtractor::getFilesFromDirectory is deprecated, it should only be called on a class using the trait in /Users/nilambarsharma/Code/kli/i18n-command/tests/IterableCodeExtractorTest.php on line 38

Deprecated: Accessing static trait property WP_CLI\I18n\IterableCodeExtractor::$dir is deprecated, it should only be accessed on a class using the trait in /Users/nilambarsharma/Code/kli/i18n-command/src/IterableCodeExtractor.php on line 146

Deprecated: Calling static trait method WP_CLI\I18n\IterableCodeExtractor::calculateMatchScore is deprecated, it should only be called on a class using the trait in /Users/nilambarsharma/Code/kli/i18n-command/src/IterableCodeExtractor.php on line 250

...

34) WP_CLI\I18n\Tests\IterableCodeExtractorTest::test_matches_file_extensions_correctly with data set #10 ('foo-theme/foo-theme-file.blade.php', array('js', 'php'), true)
This test printed output: 
Deprecated: Accessing static trait property WP_CLI\I18n\IterableCodeExtractor::$dir is deprecated, it should only be accessed on a class using the trait in /Users/nilambarsharma/Code/kli/i18n-command/tests/IterableCodeExtractorTest.php on line 24

35) WP_CLI\I18n\Tests\IterableCodeExtractorTest::test_matches_file_extensions_correctly with data set #11 ('foo-theme/foo-theme-file.blade.php', array('js'), false)
This test printed output: 
Deprecated: Accessing static trait property WP_CLI\I18n\IterableCodeExtractor::$dir is deprecated, it should only be accessed on a class using the trait in /Users/nilambarsharma/Code/kli/i18n-command/tests/IterableCodeExtractorTest.php on line 24

Deprecated: Calling static trait method WP_CLI\I18n\IterableCodeExtractor::file_get_extension_multi is deprecated, it should only be called on a class using the trait in /Users/nilambarsharma/Code/kli/i18n-command/src/IterableCodeExtractor.php on line 301

36) WP_CLI\I18n\Tests\IterableCodeExtractorTest::test_matches_file_extensions_correctly with data set #12 ('foo/bar/foofoo/minified.min.js', array('js', 'json', 'php'), true)
This test printed output: 
Deprecated: Accessing static trait property WP_CLI\I18n\IterableCodeExtractor::$dir is deprecated, it should only be accessed on a class using the trait in /Users/nilambarsharma/Code/kli/i18n-command/tests/IterableCodeExtractorTest.php on line 24

37) WP_CLI\I18n\Tests\IterableCodeExtractorTest::test_matches_file_extensions_correctly with data set #13 ('foo/bar/foofoo/minified.min.js', array('json', 'php'), false)
This test printed output: 
Deprecated: Accessing static trait property WP_CLI\I18n\IterableCodeExtractor::$dir is deprecated, it should only be accessed on a class using the trait in /Users/nilambarsharma/Code/kli/i18n-command/tests/IterableCodeExtractorTest.php on line 24

Deprecated: Calling static trait method WP_CLI\I18n\IterableCodeExtractor::file_get_extension_multi is deprecated, it should only be called on a class using the trait in /Users/nilambarsharma/Code/kli/i18n-command/src/IterableCodeExtractor.php on line 301