Wordpress/tests/phpunit/includes/factory/class-wp-unittest-generator-sequence.php
Sergey Biryukov 5bad4e7f8d Code Modernization: Use explicit visibility for class property declarations.
Using `var` or only `static` to declare a class property is PHP 4 code.

This updates the codebase to use explicit visibility modifiers introduced in PHP 5.

Props jrf.
Fixes #51557. See #22234.

git-svn-id: https://develop.svn.wordpress.org/trunk@49184 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-17 16:24:35 +00:00

46 lines
768 B
PHP

<?php
class WP_UnitTest_Generator_Sequence {
public static $incr = -1;
public $next;
public $template_string;
public function __construct( $template_string = '%s', $start = null ) {
if ( $start ) {
$this->next = $start;
} else {
self::$incr++;
$this->next = self::$incr;
}
$this->template_string = $template_string;
}
public function next() {
$generated = sprintf( $this->template_string, $this->next );
$this->next++;
return $generated;
}
/**
* Get the incrementor.
*
* @since 4.6.0
*
* @return int
*/
public function get_incr() {
return self::$incr;
}
/**
* Get the template string.
*
* @since 4.6.0
*
* @return string
*/
public function get_template_string() {
return $this->template_string;
}
}