--- /dev/null
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
const DELETED_COMMENT = 2;
const DELETED_USER = 4;
const DELETED_RESTRICTED = 8;
- const SUPPRESSED_USER = 12; // convenience
- const SUPPRESSED_ALL = 15; // convenience
+ const SUPPRESSED_USER = self::DELETED_USER | self::DELETED_RESTRICTED; // convenience
+ const SUPPRESSED_ALL = self::DELETED_TEXT | self::DELETED_COMMENT | self::DELETED_USER |
+ self::DELETED_RESTRICTED; // convenience
// Audience options for accessors
const FOR_PUBLIC = 1;
* probably wrong.
* @since 1.25
*/
- const NO_VALIDATE = 12;
+ const NO_VALIDATE = self::NO_SIZE_CHECK | 8;
/**
* Key for the 'indexed tag name' metadata item. Value is string.
/** @var int Read from the master/quorum */
const READ_LATEST = 1;
/* @var int Read from the master/quorum and lock out other writers */
- const READ_LOCKING = 3; // READ_LATEST (1) and "LOCK IN SHARE MODE" (2)
+ const READ_LOCKING = self::READ_LATEST | 2; // READ_LATEST (1) and "LOCK IN SHARE MODE" (2)
/** @var int Read from the master/quorum and lock out other writers and locking readers */
- const READ_EXCLUSIVE = 7; // READ_LOCKING (3) and "FOR UPDATE" (4)
+ const READ_EXCLUSIVE = self::READ_LOCKING | 4; // READ_LOCKING (3) and "FOR UPDATE" (4)
/** @var int Read from a replica DB or without a quorum, using the master/quorum on miss */
const READ_LATEST_IMMUTABLE = 8;
$this->maxDifferences = ceil( ( $this->m + $this->n ) / 2.0 );
if ( $this->m * $this->n > $this->tooLong ) {
// limit complexity to D^POW_LIMIT for long sequences
- $this->maxDifferences = floor( pow( $this->maxDifferences, $this->powLimit - 1.0 ) );
+ $this->maxDifferences = floor( $this->maxDifferences ** ( $this->powLimit - 1.0 ) );
wfDebug( "Limiting max number of differences to $this->maxDifferences\n" );
}
$ip = self::sanitizeIP( $ip );
$n = ip2long( $ip );
if ( $n < 0 ) {
- $n += pow( 2, 32 );
+ $n += 2 ** 32;
# On 32-bit platforms (and on Windows), 2^32 does not fit into an int,
# so $n becomes a float. We convert it to string instead.
if ( is_float( $n ) ) {
}
# Convert to unsigned
if ( $network < 0 ) {
- $network += pow( 2, 32 );
+ $network += 2 ** 32;
}
} else {
$network = false;
$start = $end = false;
} else {
$start = sprintf( '%08X', $network );
- $end = sprintf( '%08X', $network + pow( 2, ( 32 - $bits ) ) - 1 );
+ $end = sprintf( '%08X', $network + 2 ** ( 32 - $bits ) - 1 );
}
// Explicit range
} elseif ( strpos( $range, '-' ) !== false ) {
$shards = [];
list( $digits, $base ) = $this->getContainerHashLevels( $container );
if ( $digits > 0 ) {
- $numShards = pow( $base, $digits );
+ $numShards = $base ** $digits;
for ( $index = 0; $index < $numShards; $index++ ) {
$shards[] = '.' . Wikimedia\base_convert( $index, 10, $base, $digits );
}
const DELETED_RESTRICTED = 8;
// Convenience fields
- const SUPPRESSED_USER = 12;
- const SUPPRESSED_ACTION = 9;
+ const SUPPRESSED_USER = self::DELETED_USER | self::DELETED_RESTRICTED;
+ const SUPPRESSED_ACTION = self::DELETED_ACTION | self::DELETED_RESTRICTED;
/** @var bool */
public $updateRecentChanges;
}
}
if ( is_numeric( $val ) ) {
- $fNumber = pow( 2, $val / 2 );
+ $fNumber = 2 ** ( $val / 2 );
if ( $fNumber !== false ) {
$val = $this->msg( 'exif-maxaperturevalue-value',
$this->formatNum( $val ),
*/
static function readGCT( $fh, $bpp ) {
if ( $bpp > 0 ) {
- $max = pow( 2, $bpp );
+ $max = 2 ** $bpp;
for ( $i = 1; $i <= $max; ++$i ) {
fread( $fh, 3 );
}
const RECOVER_COMMENTS = 16;
const NO_TAGS = 32;
- const RECOVER_ORIG = 59; // = 1|2|8|16|32 no constant expression support in PHP yet
+ const RECOVER_ORIG = self::NO_ARGS | self::NO_TEMPLATES | self::NO_IGNORE |
+ self::RECOVER_COMMENTS | self::NO_TAGS;
/** This constant exists when $indexOffset is supported in newChild() */
const SUPPORTS_INDEX_OFFSET = 1;
// Write back the new counter value
ftruncate( $handle, 0 );
rewind( $handle );
- fwrite( $handle, fmod( $counter, pow( 2, 48 ) ) ); // warp-around as needed
+ fwrite( $handle, fmod( $counter, 2 ** 48 ) ); // warp-around as needed
fflush( $handle );
// Release the UID lock file
flock( $handle, LOCK_UN );
}
$ids = [];
- $divisor = pow( 2, $bits );
+ $divisor = 2 ** $bits;
$currentId = floor( $counter - $count ); // pre-increment counter value
for ( $i = 0; $i < $count; ++$i ) {
$ids[] = fmod( ++$currentId, $divisor );
protected function millisecondsSinceEpochBinary( array $time ) {
list( $sec, $msec ) = $time;
$ts = 1000 * $sec + $msec;
- if ( $ts > pow( 2, 52 ) ) {
+ if ( $ts > 2 ** 52 ) {
throw new RuntimeException( __METHOD__ .
': sorry, this function doesn\'t work after the year 144680' );
}
$offset = '122192928000000000';
if ( PHP_INT_SIZE >= 8 ) { // 64 bit integers
$ts = ( 1000 * $sec + $msec ) * 10000 + (int)$offset + $delta;
- $id_bin = str_pad( decbin( $ts % pow( 2, 60 ) ), 60, '0', STR_PAD_LEFT );
+ $id_bin = str_pad( decbin( $ts % ( 2 ** 60 ) ), 60, '0', STR_PAD_LEFT );
} elseif ( extension_loaded( 'gmp' ) ) {
$ts = gmp_add( gmp_mul( (string)$sec, '1000' ), (string)$msec ); // ms
$ts = gmp_add( gmp_mul( $ts, '10000' ), $offset ); // 100ns intervals
}
// Throw an exception if there was loss of precision
- if ( $value > pow( 2, 52 ) ) {
+ if ( $value > 2 ** 52 ) {
$this->error( 'zip-unsupported', 'number too large to be stored in a double. ' .
'This could happen if we tried to unpack a 64-bit structure ' .
'at an invalid location.' );
public function execute() {
$this->setNamespacePriorities();
$this->url_limit = 50000;
- $this->size_limit = pow( 2, 20 ) * 10;
+ $this->size_limit = ( 2 ** 20 ) * 10;
# Create directory if needed
$fspath = $this->getOption( 'fspath', getcwd() );
exit( 1 );
}
- $binSize = intval( pow( 10, floor( log10( $endId ) ) - 3 ) );
+ $binSize = intval( 10 ** ( floor( log10( $endId ) ) - 3 ) );
if ( $binSize < 100 ) {
$binSize = 100;
}
$spec['height'] = mt_rand( $this->minHeight, $this->maxHeight );
$spec['fill'] = $this->getRandomColor();
- $diagonalLength = sqrt( pow( $spec['width'], 2 ) + pow( $spec['height'], 2 ) );
+ $diagonalLength = sqrt( $spec['width'] ** 2 + $spec['height'] ** 2 );
$draws = [];
for ( $i = 0; $i <= $this->shapesToDraw; $i++ ) {
"1 gigabyte"
],
[
- pow( 1024, 4 ),
+ 1024 ** 4,
"1 TB",
"1 terabyte"
],
[
- pow( 1024, 5 ),
+ 1024 ** 5,
"1 PB",
"1 petabyte"
],
[
- pow( 1024, 6 ),
+ 1024 ** 6,
"1 EB",
"1,024 exabyte"
],
[
- pow( 1024, 7 ),
+ 1024 ** 7,
"1 ZB",
"1 zetabyte"
],
[
- pow( 1024, 8 ),
+ 1024 ** 8,
"1 YB",
"1 yottabyte"
],
"1 megabit per second"
],
[
- pow( 10, 9 ),
+ 10 ** 9,
"1 Gbps",
"1 gigabit per second"
],
[
- pow( 10, 12 ),
+ 10 ** 12,
"1 Tbps",
"1 terabit per second"
],
[
- pow( 10, 15 ),
+ 10 ** 15,
"1 Pbps",
"1 petabit per second"
],
[
- pow( 10, 18 ),
+ 10 ** 18,
"1 Ebps",
"1 exabit per second"
],
[
- pow( 10, 21 ),
+ 10 ** 21,
"1 Zbps",
"1 zetabit per second"
],
[
- pow( 10, 24 ),
+ 10 ** 24,
"1 Ybps",
"1 yottabit per second"
],
[
- pow( 10, 27 ),
+ 10 ** 27,
"1,000 Ybps",
"1,000 yottabits per second"
],
/** Include non core files as set in $wgParserTestFiles */
const NO_CORE = 2;
/** Include anything set via $wgParserTestFiles */
- const WITH_ALL = 3; # CORE_ONLY | NO_CORE
+ const WITH_ALL = self::CORE_ONLY | self::NO_CORE;
/** @} */