Temporarily fix tests.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2018-09-23 17:51:47 +02:00
parent dd774be005
commit 08296110fb
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
6 changed files with 17 additions and 14 deletions

View File

@ -1,14 +1,15 @@
class Program { class Program {
private function num2Roman(int $num) { private function num2Roman(int $num) {
$n = intval($num); int $n = intval($num);
$result = ''; int $result = '';
$lookup = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, mixed $lookup = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400,
'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40, 'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40,
'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1); 'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1);
int $matches;
foreach($lookup as $roman => $value) { foreach($lookup as $roman => $value) {
$matches = intval($n / $value); $matches = intval($n / $value);
$result += str_repeat($roman, $matches); $result += str_repeat($roman, $matches);
$n = $n % $value; $n = $n % $value;
} }

View File

@ -5,7 +5,7 @@ class Program {
} }
function a(string $p) { function a(string $p) {
$backtrace = debug_backtrace(); mixed $backtrace = debug_backtrace();
if(isset($backtrace[0]['args'])) { if(isset($backtrace[0]['args'])) {
var_export($backtrace[0]['args']); var_export($backtrace[0]['args']);
} else { } else {

View File

@ -24,9 +24,9 @@ final class Test {
final class Program { final class Program {
public function main() { public function main() {
$testA = Test::getInstance(); object $testA = Test::getInstance();
$testA->set(5); $testA->set(5);
$testB = Test::getInstance(); object $testB = Test::getInstance();
var_dump($testB->get()); var_dump($testB->get());
} }
} /* class */ } /* class */

View File

@ -1,6 +1,7 @@
class Program { class Program {
function main() { function main() {
mixed $foo;
$foo = '0'; $foo = '0';
var_dump($foo); var_dump($foo);
$foo += 2; $foo += 2;

View File

@ -1,7 +1,8 @@
class Unicode { class Unicode {
public function unicon(string $str, bool $to_uni = true) { public function unicon(string $str, bool $to_uni = true) {
$cp = array('А' => 'А', 'а' => 'а', mixed $cpp;
mixed $cp = array('А' => 'А', 'а' => 'а',
"Б" => "Б", "б" => "б", "Б" => "Б", "б" => "б",
"В" => "В", "в" => "в", "В" => "В", "в" => "в",
"Г" => "Г", "г" => "г", "Г" => "Г", "г" => "г",
@ -50,7 +51,7 @@ class Unicode {
final class Program { final class Program {
public function main() { public function main() {
$unicode = new Unicode(); object $unicode = new Unicode();
var_dump($unicode->unicon("ИфйжБЦ")); var_dump($unicode->unicon("ИфйжБЦ"));
} }

View File

@ -13,11 +13,11 @@ class Program {
} }
private function isUTF8(string $str) { private function isUTF8(string $str) {
$b = 0; int $b = 0;
$c = 0; int $c = 0;
$bits = 0; int $bits = 0;
$len = strlen($str); int $len = strlen($str);
for($i = 0; $i < $len; $i++) { for(int $i = 0; $i < $len; $i++) {
$c = ord($str[$i]); $c = ord($str[$i]);
if($c >= 128) { if($c >= 128) {
if(($c >= 254)) return false; if(($c >= 254)) return false;