[wp-trac] [WordPress Trac] #39822: PHPUnit 6 compatibility

WordPress Trac noreply at wordpress.org
Thu Feb 9 14:02:24 UTC 2017


#39822: PHPUnit 6 compatibility
-------------------------------------+------------------------------
 Reporter:  miyauchi                 |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Build/Test Tools         |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  needs-refresh has-patch  |     Focuses:
-------------------------------------+------------------------------
Changes (by jdgrimes):

 * keywords:   => needs-refresh has-patch


Comment:

 Won't the use of the namespace separator in that code cause a parse an
 error on PHP 5.2? I know that it won't actually be executed, because an
 older version of PHPUnit will be running on that old of a version of PHP.
 But WordPress still runs its tests against PHP 5.2, so this solution needs
 to be PHP 5.2 compatible. And because the code is a part of the file, even
 if it isn't executed, it will still have to get parsed.

 I would say the best way to fix this would be to move the migration code
 to a separate file, that would only be included (and thus parsed), `if (
 class_exists( 'PHPUnit\Runner\Version' ) {}`. That way the main file
 should still parse on PHP 5.2, and the migration file that requires a
 newer PHP version to parse won't be loaded then.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39822#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list