コード例 #1
0
ファイル: empty-call.php プロジェクト: expobrain/phpcf
<?php

/**
 * Test for formatting function call without arguments
 */
$a = array();
function definition()
{
}
class ClassDef
{
    private function emptyFunction()
    {
    }
}
functionCall();
$a = function () {
};
コード例 #2
0
<?php

func(func(func(1, 2, ['required' => true])), 1.2, 'STRING');
$instance = new ClassName(['foo' => 'bar', 'member' => ClassName::class]);
functionCall('this', 'is', 'a', 'very', 'very', 'very', 'very', 'very', 'very', 'very', 'very', 'loooong', 'invocation');
functionCall('this', 'is', 'a', 'very', 'very', 'very', 'very', 'very', 'very', 'very', 'very', 'looong', 'invocation');
new static('canBeInOneLine');
new self('canBeInOneLine');
parent::__construct('canBeOneLine');
new Namespaced\ClassName('canBeOneLine');
namespaced\functionName('canBeOneLine');
コード例 #3
0
<?php

$object->methodCall("\nfoo\nbar");
$object->methodCall('
foo
bar');
StaticClass::methodCall(<<<EOS
foo
bar
EOS
);
StaticClass::methodCall(<<<'EOS'
foo
bar
EOS
);
functionCall('Comment');
functionCall('Comment');
functionCall('Comment');
functionCall('Comment');
コード例 #4
0
ファイル: deref.php プロジェクト: expobrain/phpcf
<?php

/**
 * test for formatting dereferencing
 */
"Dereferenced string double"[1];
'Dereferenced string single'[1];
array(1, 2, 3)[7];
[1, 2, 3][6];
functionCall()[45];
コード例 #5
0
<?php

functionCall(['foo' => true, 'bar' => false]);
$object->methodCall('argument', 'argument', [['foo', 'bar']]);
$object->methodCall('argument', 'argument', [['foo', 'bar' => 'test', $key => 'value', 'key' => $value, $value]]);
functionCall('argument', 'argument', [array('foo', 'bar', 'baz')]);
$object->methodCall(['argument']);
$object->methodCall(['argument']);
$object->methodCall('argument', 'argument', [array('foo', 'bar')]);
コード例 #6
0
ファイル: short-array.php プロジェクト: expobrain/phpcf
<?php

// simple
$a = [];
// next line
$b = [];
// no spaces
$c = [1, 2, 3];
// extra spaces
$d = [1, 2, 3];
// dereferenced call
$e = [1, 2, 3][2];
// passed as param in function
$f = functionCall([1, 2, 3], [4]);
// simply somewhere
[1, 2, 3345];
// nested
[[1, 2, 3], [4, 5, 6]];
if (true) {
    [123, 456];
}
[345];
array('a', [234, 345345, 8837673, 789], 'b');
array('a', [func() ? ['b'] : ['c']]);