PHPUnit 9 is being tested against nightly builds of PHP 8 for quite a while and it is safe to say that -- as of right now -- PHPUnit 9 works on PHP 8. While some things might still change until PHP 8.0.0 is released, it is time to make the support for PHP 8 official.
However, this is not as simple as applying
diff --git a/composer.json b/composer.json
index 0f8416d1d..2bf0fa21e 100644
--- a/composer.json
+++ b/composer.json
@@ -22,7 +22,7 @@
"prefer-stable": true,
"minimum-stability": "dev",
"require": {
- "php": "^7.3",
+ "php": "^7.3 || ^8.0",
to this repository for phpunit/phpunit.
PHP 8.0 also needs to be allowed in the composer.json files of PHPUnit's dependencies:
$ composer info | sort -d
doctrine/instantiator 1.3.1 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
myclabs/deep-copy 1.9.5 Create deep copies (clones) of your objects
phar-io/manifest 1.0.3 Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version 2.0.1 Library for handling version information and constraints
phpdocumentor/reflection-common 2.1.0 Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock 5.1.0 With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver 1.2.0 A PSR-5 based resolver of Class names, Types and Structural Element Names
phpspec/prophecy-phpunit v2.0.0 PhpUnit test case integrating the Prophecy mocking library
phpspec/prophecy v1.10.3 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 9.0.x-dev 4b3293f Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator 3.0.2 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker 3.0.1 Invoke callables with a timeout
phpunit/php-text-template 2.0.1 Simple template engine.
phpunit/php-timer 5.0.0 Utility class for timing
phpunit/php-token-stream 4.0.2 Wrapper around PHP's tokenizer extension.
sebastian/code-unit 1.0.3 Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 2.0.1 Looks up which function or method a line of code belongs to
sebastian/comparator 4.0.2 Provides the functionality to compare PHP values for equality
sebastian/diff 4.0.1 Diff implementation
sebastian/environment 5.1.1 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 4.0.1 Provides the functionality to export PHP variables for visualization
sebastian/global-state 5.0.x-dev 836ce3a Snapshotting of global state
sebastian/object-enumerator 4.0.1 Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector 2.0.1 Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context 4.0.1 Provides functionality to recursively process PHP variables
sebastian/resource-operations 3.0.1 Provides a list of PHP built-in functions that operate on resources
sebastian/type 2.1.0 Collection of value objects that represent the types of the PHP type system
sebastian/version 3.0.0 Library that helps with managing the version number of Git-hosted PHP projects
symfony/polyfill-ctype v1.17.1 Symfony polyfill for ctype functions
theseer/tokenizer 1.1.3 A small library for converting tokenized PHP source code into XML and potentially other formats
webmozart/assert 1.9.0 Assertions to validate method input/output with nice error messages.
Of course, I will take care of all dependencies that live in the sebastian/ and phpunit/ namespaces myself.
PHPUnit 9 is being tested against nightly builds of PHP 8 for quite a while and it is safe to say that -- as of right now -- PHPUnit 9 works on PHP 8. While some things might still change until PHP 8.0.0 is released, it is time to make the support for PHP 8 official.
However, this is not as simple as applying
to this repository for
phpunit/phpunit.PHP 8.0 also needs to be allowed in the
composer.jsonfiles of PHPUnit's dependencies:phpunit/php-code-coveragephpunit/php-file-iteratorphpunit/php-invokerphpunit/php-text-templatephpunit/php-timerphpunit/php-token-streamsebastian/code-unitsebastian/code-unit-reverse-lookupsebastian/comparatorsebastian/diffsebastian/environmentsebastian/exportersebastian/global-statesebastian/object-enumeratorsebastian/object-reflectorsebastian/recursion-contextsebastian/resource-operationssebastian/typesebastian/versiondoctrine/instantiator(has"php": "^7.1 || ^8.0"in 1.3.1)symfony/polyfill-ctype(has"php": ">=5.3.3"in 1.17.1)myclabs/deep-copyCC @mnapoli and @theofidryphar-io/manifestCC @theseerphar-io/versionCC @theseerphpdocumentor/reflection-commonCC @jaapio and @mvrielphpdocumentor/reflection-docblockCC @jaapio and @mvrielphpdocumentor/type-resolverCC @jaapio and @mvrielphpspec/prophecy-phpunitCC @ciaranmcnulty and @stofphpspec/prophecyCC @ciaranmcnulty and @stoftheseer/tokenizerCC @theseerwebmozart/assertCC @webmozartOf course, I will take care of all dependencies that live in the
sebastian/andphpunit/namespaces myself.