Initial commit: apps.supersam24.ru

This commit is contained in:
root committed 2026-10-22 00:04:27 +03:00
commit e955e1da36
6566 files changed
+1271095

No files matched your search

@@ -0,0 +1,34 @@
<?php
/**
* Tell me what worries you.
*/
namespace App\Person\Patient;
/**
* Hello World.
*
* This is a description.
*/
class Foo extends Bar
{
/**
* What are your thoughts?
*
* @var array $brain
*/
public $brain = [];
/**
* Tell me your thoughts.
*
* @return void
*/
public function dumpThoughts($thoughts)
{
/** @var array $thoughts */
foreach ($thoughts as $thought) {
/** @var string $thought */
echo $thought;
}
}
}
@@ -0,0 +1,34 @@
<?php
/**
* Tell me what worries you.
*/
namespace App\Person\Patient;
/**
* Hello World.
*
* This is a description.
*/
class Foo extends Bar
{
/**
* What are your thoughts?
*
* @var array $brain
*/
public $brain = [];
/**
* Tell me your thoughts.
*
* @return void
*/
public function dumpThoughts($thoughts)
{
/** @var array $thoughts */
foreach ($thoughts as $thought) {
/** @var string $thought */
echo $thought;
}
}
}
@@ -0,0 +1,24 @@
<?php
/**
* Hello World.
*
* This is a description.
*/
$things = 'fun';
/**
* I'm static.
*/
Foo::bar($things);
$anotherThing = 'what';
/**
* What happens with If's?
*
*/
if ($anotherThing !== 'notfun') {
$anotherThing = 'Oh no.';
}
$hello = 'world';
@@ -0,0 +1,29 @@
<?php
namespace Cake;
/**
* Hello World.
*
* This is a description.
*/
class Foo extends Bar
{
/**
* What are your thoughts?
*
* @var array $brain
*/
public $brain = array();
/**
* Tell me your thoughts.
*
* @return void
*/
public function dumpThoughts()
{
foreach ($thoughts as $thought) {
echo $thought;
}
}
}
@@ -0,0 +1,36 @@
<?php
namespace CakePHP\Tests\Commenting;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class DocBlockAlignmentUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList($testFile = '')
{
switch ($testFile) {
case 'DocBlockAlignmentUnitTest.1.inc':
return [
2 => 1,
7 => 1,
14 => 1,
21 => 1,
30 => 1,
];
default:
return [];
}
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,251 @@
<?php
namespace Beakman;
use Other\Crap;
use Other\Error as OtherError;
class Foo
{
/**
* Some sentence.
*
* @param integer $param Some Param.
* @param boolean $otherParam Some Other Param.
* @return string Something.
*/
public function bar($param, $otherParam)
{
}
/**
* Some sentence.
*
* @param int $param
* @param bool $otherParam
* @return void
*/
public function missingParamComment($param, $otherParam)
{
}
/**
* Some sentence.
*
* @param
* @param
* @return void
*/
public function missingParamType($param, $otherParam)
{
}
/**
* Some sentence.
*
* @return void
*/
public function invalidReturnVoid()
{
return 'string';
}
/**
* [doThing description]
*
* @param string $foo Foo foo foo.
* @return void
*/
public function doThing($foo)
{
}
/**
* Test throws
*
* @throws Exception An expection happened.
* @throws CakePHP\Boom A boom went off.
* @throws CakePHP\Error\Boom Oh, shucks, another boom.
* @throws Other\Crap Oh boy.
* @throws Other\Error\Issue A missing tissue for your PSR-2 issues.
* @return void
*/
public function test()
{
switch ($a) {
case 1:
throw new Boom();
case 2:
throw new Error\Boom();
case 3:
throw new OtherError\Issue();
case 4:
throw new Crap();
default:
throw new \Exception();
}
}
/**
* @return void
* @return void
*/
public function doubleReturn()
{
}
/**
* @return
*/
public function missingReturnType()
{
}
/**
* @return integer
*/
public function returnIntegerFail()
{
return 1;
}
/**
* @return boolean
*/
public function returnBooleanFail()
{
return false;
}
/**
* @return int
*/
public function returnIntPass()
{
return 1;
}
/**
* @return bool
*/
public function returnBooleanPass()
{
return false;
}
/**
* @return int
*/
public function invalidReturnNotVoid()
{
return;
}
/**
* @return void
* @throws
*/
public function invalidThrows()
{
throw new \RuntimeException();
return;
}
/**
* @return void
* @throws \RuntimeException()
*/
public function EmptyThrows()
{
throw new \RuntimeException();
return;
}
/**
* @return void
* @throws \RuntimeException No dot
*/
public function throwsNoFullStop()
{
throw new \RuntimeException();
}
/**
* @return void
* @throws \RuntimeException not a capital.
*/
public function throwsNotCapital()
{
throw new \RuntimeException();
}
/**
* @param int $param not a capital.
* @return void
*/
public function paramCommentNotCapital($param)
{
}
/**
* @param int $param No final dot
* @return void
*/
public function paramCommentFullStop($param)
{
}
/**
* @param int $para Comment.
* @return void
*/
public function paramNameNoMatch($param)
{
}
/**
* @param int $Param Comment.
* @return void
*/
public function paramNameNoCaseMatch($param)
{
}
/**
*
*/
public function missingReturn()
{
return 'what';
}
/**
* @param int
* @return void
*/
public function missingParamName($param)
{
}
/**
* @param int $param A description.
* @param int $superflous A description.
* @return void
*/
public function extraParamComment($param)
{
}
/**
* {@inheritDoc}
*/
public function inherited()
{
}
/**
* {@inheritdoc}
*/
public function inheritedCaseInsentive()
{
}
}
@@ -0,0 +1,251 @@
<?php
namespace Beakman;
use Other\Crap;
use Other\Error as OtherError;
class Foo
{
/**
* Some sentence.
*
* @param int $param Some Param.
* @param bool $otherParam Some Other Param.
* @return string Something.
*/
public function bar($param, $otherParam)
{
}
/**
* Some sentence.
*
* @param int $param
* @param bool $otherParam
* @return void
*/
public function missingParamComment($param, $otherParam)
{
}
/**
* Some sentence.
*
* @param
* @param
* @return void
*/
public function missingParamType($param, $otherParam)
{
}
/**
* Some sentence.
*
* @return void
*/
public function invalidReturnVoid()
{
return 'string';
}
/**
* [doThing description]
*
* @param string $foo Foo foo foo.
* @return void
*/
public function doThing($foo)
{
}
/**
* Test throws
*
* @throws Exception An expection happened.
* @throws CakePHP\Boom A boom went off.
* @throws CakePHP\Error\Boom Oh, shucks, another boom.
* @throws Other\Crap Oh boy.
* @throws Other\Error\Issue A missing tissue for your PSR-2 issues.
* @return void
*/
public function test()
{
switch ($a) {
case 1:
throw new Boom();
case 2:
throw new Error\Boom();
case 3:
throw new OtherError\Issue();
case 4:
throw new Crap();
default:
throw new \Exception();
}
}
/**
* @return void
* @return void
*/
public function doubleReturn()
{
}
/**
* @return
*/
public function missingReturnType()
{
}
/**
* @return integer
*/
public function returnIntegerFail()
{
return 1;
}
/**
* @return boolean
*/
public function returnBooleanFail()
{
return false;
}
/**
* @return int
*/
public function returnIntPass()
{
return 1;
}
/**
* @return bool
*/
public function returnBooleanPass()
{
return false;
}
/**
* @return int
*/
public function invalidReturnNotVoid()
{
return;
}
/**
* @return void
* @throws
*/
public function invalidThrows()
{
throw new \RuntimeException();
return;
}
/**
* @return void
* @throws \RuntimeException()
*/
public function EmptyThrows()
{
throw new \RuntimeException();
return;
}
/**
* @return void
* @throws \RuntimeException No dot
*/
public function throwsNoFullStop()
{
throw new \RuntimeException();
}
/**
* @return void
* @throws \RuntimeException not a capital.
*/
public function throwsNotCapital()
{
throw new \RuntimeException();
}
/**
* @param int $param not a capital.
* @return void
*/
public function paramCommentNotCapital($param)
{
}
/**
* @param int $param No final dot
* @return void
*/
public function paramCommentFullStop($param)
{
}
/**
* @param int $param Comment.
* @return void
*/
public function paramNameNoMatch($param)
{
}
/**
* @param int $param Comment.
* @return void
*/
public function paramNameNoCaseMatch($param)
{
}
/**
*
*/
public function missingReturn()
{
return 'what';
}
/**
* @param int
* @return void
*/
public function missingParamName($param)
{
}
/**
* @param int $param A description.
* @param int $superflous A description.
* @return void
*/
public function extraParamComment($param)
{
}
/**
* {@inheritDoc}
*/
public function inherited()
{
}
/**
* {@inheritdoc}
*/
public function inheritedCaseInsentive()
{
}
}
@@ -0,0 +1,54 @@
<?php
namespace CakePHP\Tests\Commenting;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class FunctionCommentUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
12 => 1,
13 => 1,
23 => 1,
24 => 1,
34 => 1,
35 => 1,
90 => 1,
97 => 1,
104 => 1,
112 => 1,
222 => 1,
231 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [
14 => 1,
31 => 2,
45 => 1,
140 => 1,
145 => 1,
155 => 1,
165 => 1,
174 => 1,
182 => 1,
190 => 1,
197 => 1,
198 => 1,
205 => 1,
206 => 1,
215 => 1,
221 => 1,
];
}
}
@@ -0,0 +1,14 @@
<?php
for ($i = 0; $i < 10; $i++) {
echo 'hello';
}
if ($i < 10) {
echo 'hello2';
} elseif ($i > 100) {
echo 'i > 100';
}
if($abc == true)
echo 'hello';
@@ -0,0 +1,26 @@
<?php
namespace CakePHP\Tests\ControlStructures;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class ControlStructuresUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
13 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,6 @@
<?php
if (isset($a)) {
echo 'a isset';
} else if (isset($b)) {
echo 'b isset';
}
@@ -0,0 +1,26 @@
<?php
namespace CakePHP\Tests\ControlStructures;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class ElseIfDeclarationUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
4 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,16 @@
<?php
while (false)
echo 'faiL';
do
echo 'dowhile test';
while (false);
echo 'dowhile test';
} while (false);
while (false) {
echo 'pass';
}
do {
@@ -0,0 +1,27 @@
<?php
namespace CakePHP\Tests\ControlStructures;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class WhileStructuresUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
2 => 1,
5 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,104 @@
<?php
return [
'foo' => 'bar'
];
function invalidFunctionReturnOne()
{
echo "";
return null;
}
function invalidFunctionReturnOne()
{
if(true) {
echo "";
}
return null;
}
/**
* [validFunctionReturnOne description]
*
* @return null
*/
function validFunctionReturnOne()
{
return null;
}
/**
* [validFunctionReturnTwo description]
*
* @return null|bool
*/
function validFunctionReturnTwo()
{
if ($a) {
return true;
}
return null;
}
/**
* [validFunctionReturnThree description]
*
* @return null
*/
function validFunctionReturnThree()
{
echo "";
return null;
}
/**
* [validFunctionReturnFour description]
*
* @return null
*/
function validFunctionReturnFour()
{
// comment
return null;
}
/**
* [validFunctionReturnFive description]
*
* @return null
*/
function validFunctionReturnFive()
{
/**
* multi-line
*/
return null;
}
/**
* [validFunctionReturnSix description]
*
* @return null|bool
*/
function validFunctionReturnSix()
{
switch ($condition) {
case 'foo':
return true;
default:
return false;
}
}
/**
* [validFunctionReturnSeven description]
*
* @return null
*/
function validFunctionReturnSeven()
{
/** @var Foo $foo */
return null;
}
@@ -0,0 +1,106 @@
<?php
return [
'foo' => 'bar'
];
function invalidFunctionReturnOne()
{
echo "";
return null;
}
function invalidFunctionReturnOne()
{
if(true) {
echo "";
}
return null;
}
/**
* [validFunctionReturnOne description]
*
* @return null
*/
function validFunctionReturnOne()
{
return null;
}
/**
* [validFunctionReturnTwo description]
*
* @return null|bool
*/
function validFunctionReturnTwo()
{
if ($a) {
return true;
}
return null;
}
/**
* [validFunctionReturnThree description]
*
* @return null
*/
function validFunctionReturnThree()
{
echo "";
return null;
}
/**
* [validFunctionReturnFour description]
*
* @return null
*/
function validFunctionReturnFour()
{
// comment
return null;
}
/**
* [validFunctionReturnFive description]
*
* @return null
*/
function validFunctionReturnFive()
{
/**
* multi-line
*/
return null;
}
/**
* [validFunctionReturnSix description]
*
* @return null|bool
*/
function validFunctionReturnSix()
{
switch ($condition) {
case 'foo':
return true;
default:
return false;
}
}
/**
* [validFunctionReturnSeven description]
*
* @return null
*/
function validFunctionReturnSeven()
{
/** @var Foo $foo */
return null;
}
@@ -0,0 +1,27 @@
<?php
namespace CakePHP\Tests\Formatting;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class BlankLineBeforeReturnUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
9 => 1,
17 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,10 @@
<?php
use Cake\Routing\Router;
use Cake\Error;
use Cake\Utility\Hash;
class Foo {
use LogTrait;
use FirstTrait;
}
@@ -0,0 +1,12 @@
<?php
namespace BryanCrowe;
use Cake\Routing\RouteCollection;
use Cake\Routing\Router;
use Cake\Routing\Route\Route;
class Foo
{
use FirstTrait;
use LogTrait;
}
@@ -0,0 +1,13 @@
<?php
namespace BryanCrowe;
use Exception;
use RuntimeException;
use function compact;
class Foo
{
use FirstTrait;
use LogTrait;
}
@@ -0,0 +1,35 @@
<?php
namespace CakePHP\Tests\Formatting;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class UseInAlphabeticalOrderUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList($testFile = '')
{
switch ($testFile) {
case 'UseInAlphabeticalOrderUnitTest.1.inc':
return [
3 => 1,
4 => 1,
8 => 1,
9 => 1,
];
default:
return [];
}
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,36 @@
<?php
namespace Beakman;
class TraitUser
{
use FunctionsTrait;
/**
* [doThing description]
*
* @param callable $callback The description.
* @return void
*/
public function doThing(callable $callback)
{
$visitor = function($expression) use (&$visitor, $callback) {
echo 'It fails';
};
$visitor = function ($expression)use(&$visitor, $callback) {
echo 'It works';
};
$visitor($this);
}
}
$foo = 'bar';
$bar = 'foo';
$zum = function()use ($foo, $bar) {
return $foo;
};
$zum = function ()use ($foo, $bar) {
return $foo;
};
@@ -0,0 +1,27 @@
<?php
namespace CakePHP\Tests\Functions;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class ClosureDeclarationUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
17 => 1,
30 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,21 @@
<?php
function myFunc( ) {}
function myFunc( $blah ) {}
function myFunc($blah , $blah2, $blah3 ) {}
function myFunc($blah,$blah2,$blah3) {}
function myFunc($blah, $blah2, $blah3) {}
function myFunc($blah='hello') {}
function myFunc( $blah='hello' , $blah2= 'hi', $blah3 = 'yo' ) {}
function myFunc(PHP_CodeSniffer $object, array $array=array(), $blah3='yo') {}
function myFunc( PHP_CodeSniffer $object, array $array=array(), $blah3='yo') {}
function myFunc(PHP_CodeSniffer $object, array $array=array(), $blah3='yo') {}
function myFunc( array &$one, array &$two) {}
function myFunc( &$blah ) {}
function myFunc() {}
function myFunc($blah) {}
function myFunc($blah, $blah2, $blah3) {}
function myFunc($blah = 'hello') {}
function myFunc(&$blah) {}
function myFunc(PHP_CodeSniffer $object, array $array = array(), $blah3 = 'yo') {}
@@ -0,0 +1,37 @@
<?php
namespace CakePHP\Tests\Functions;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class FunctionDeclarationArgumentSpacingUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
3 => 1,
4 => 2,
5 => 2,
6 => 2,
7 => 2,
8 => 2,
9 => 9,
10 => 6,
11 => 6,
12 => 4,
13 => 4,
14 => 2,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,177 @@
<?php
namespace Beakman;
class FunctionNames
{
public function _forbidden()
{
echo "I emit an error";
}
private function notDiscouraged()
{
echo "I don't emit a warning anymore";
}
public function setVariables()
{
$this->passingPublic = 'changed';
$this->underscored = 'has value now';
$this->doubleUnderscore = 'not recommended';
}
public static function setStatics()
{
self::$publicStatic = true;
self::$protectedStatic = true;
self::$privateStatic = true;
}
protected function _someFunc()
{
// code here
}
protected function noUnderscorePrefix()
{
// code here
$closure = function () {
// code here
};
}
public function __call($name, $arguments)
{
}
public function __construct()
{
}
public function __clone()
{
}
public function __debugInfo()
{
}
public function __destruct()
{
}
public function __get($name)
{
}
public function __invoke()
{
}
public function __isset($name)
{
}
public function __set($name, $value)
{
}
public function __sleep()
{
}
public function __toString()
{
return '';
}
public function __unset($name)
{
}
public function __wakeup()
{
}
}
interface FunctionNamesInterface
{
public function _forbidden();
public function setVariables();
public static function setStatics();
}
trait FunctionNamesTrait
{
public function _forbidden()
{
echo "I emit an error";
}
private function notDiscouraged()
{
echo "I don't emit a warning anymore";
}
public function setVariables()
{
$this->passingPublic = 'changed';
$this->underscored = 'has value now';
$this->doubleUnderscore = 'not recommended';
}
public static function setStatics()
{
self::$publicStatic = true;
self::$protectedStatic = true;
self::$privateStatic = true;
}
protected function _someFunc()
{
// code here
}
protected function noUnderscorePrefix()
{
// code here
}
function _noScopeSpecified()
{
echo 'handled by an other Sniff';
}
public function __call($name, $arguments)
{
}
public function __construct()
{
}
public function __clone()
{
}
public function __debugInfo()
{
}
public function __destruct()
{
}
public function __get($name)
{
}
public function __invoke()
{
}
public function __isset($name)
{
}
public function __set($name, $value)
{
}
public function __sleep()
{
}
public function __toString()
{
return '';
}
public function __unset($name)
{
}
public function __wakeup()
{
}
}
public function __passingOutside() {}
@@ -0,0 +1,28 @@
<?php
namespace CakePHP\Tests\NamingConventions;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class ValidFunctionNameUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
6 => 1,
87 => 1,
96 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,6 @@
<?php
trait Foo {
}
trait WTFTrait {
}
@@ -0,0 +1,26 @@
<?php
namespace CakePHP\Tests\NamingConventions;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class ValidTraitNameUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
2 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,9 @@
<?php
/**
* If shortopen tags are not enabled phpcs will report that the file has no php code
* Ensure that there is some php code to skip that logic
*/
$ensure = 'some php code'; ?>
<?
echo "this should fail";
@@ -0,0 +1,26 @@
<?php
namespace CakePHP\Tests\PHP;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class DisallowShortOpenTagUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
8 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,11 @@
<?php
//Fail
$isActive = !!$value;
$isActive = (boolean)$value;
$count = (integer)$someNumber;
$isActive = (Bool)$value;
$count = (Int)$someNumber;
//Pass
$isActive = (bool)$value;
$count = (int)$someNumber;
@@ -0,0 +1,30 @@
<?php
namespace CakePHP\Tests\PHP;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class TypeCastingUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
3 => 1,
4 => 1,
5 => 1,
6 => 1,
7 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,10 @@
<?php
$text = 'some' . 'text';
$text = 'some'. 'text';
$text = 'some' .'text';
$text = 'some'.'text';
$text = 'some' . 'text';
$text = 'some' . 'text';
$text = 'some' . 'text';
@@ -0,0 +1,30 @@
<?php
namespace CakePHP\Tests\Strings;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class ConcatenationSpacingUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
4 => 1,
5 => 1,
6 => 2,
7 => 1,
8 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,5 @@
<?php
echo implode('', array_map('chr', array_map('hexdec',array_filter(explode($delimiter, $string)))));
echo implode('', array_map('chr', array_map('hexdec' , array_filter(explode($delimiter, $string)))));
echo implode('', array_map('chr', array_map('hexdec', array_filter(explode($delimiter, $string)))));
list(,, $extension, $filename) = array_values(pathinfo($filename));
@@ -0,0 +1,5 @@
<?php
echo implode('', array_map('chr', array_map('hexdec', array_filter(explode($delimiter, $string)))));
echo implode('', array_map('chr', array_map('hexdec' , array_filter(explode($delimiter, $string)))));
echo implode('', array_map('chr', array_map('hexdec', array_filter(explode($delimiter, $string)))));
list(,, $extension, $filename) = array_values(pathinfo($filename));
@@ -0,0 +1,27 @@
<?php
namespace CakePHP\Tests\WhiteSpace;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class CommaSpacingUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
2 => 1,
3 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,49 @@
<?php
namespace Cake;
class MultipleBlankLine
{
public $test;
public $test2;
/**
* [_someFunc description]
*
* @return void
*/
public function myFunction()
{
// code here
}
/**
* [noUnderscorePrefix description]
*
* @return void
*/
public function myFunction2()
{
// code here
}
}
/**
* Description
*
* @return void
*/
function methoWithMultipleBlankLine()
{
echo "1";
echo "2";
}
@@ -0,0 +1,42 @@
<?php
namespace Cake;
class MultipleBlankLine
{
public $test;
public $test2;
/**
* [_someFunc description]
*
* @return void
*/
public function myFunction()
{
// code here
}
/**
* [noUnderscorePrefix description]
*
* @return void
*/
public function myFunction2()
{
// code here
}
}
/**
* Description
*
* @return void
*/
function methoWithMultipleBlankLine()
{
echo "1";
echo "2";
}
@@ -0,0 +1,32 @@
<?php
namespace CakePHP\Tests\WhiteSpace;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class EmptyLinesUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
8 => 1,
21 => 1,
42 => 1,
43 => 1,
47 => 1,
48 => 1,
49 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,8 @@
<?php
$noGood = empty ($thing);
$fail = include ('./inline_if_pass.php');
$fail = include_once ('./inline_if_pass.php');
$fail = require ('./inline_if_pass.php');
$fail = require_once ('./inline_if_pass.php');
$o = $obj->something ('testing');
fail_whale ();
@@ -0,0 +1,32 @@
<?php
namespace CakePHP\Tests\WhiteSpace;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class FunctionCallSpacingUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
2 => 1,
3 => 1,
4 => 1,
5 => 1,
6 => 1,
7 => 1,
8 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,31 @@
<?php
function someFunction(){}
function someFunction()
{}
function greatFunction() {
}
function wrapper () {
return function() {};
}
function somePassingFunction() {
}
function someOtherPassingFunction()
{
}
class Foo
{
public function fail1 {}
public function fail2 {
}
public function fail3 {
echo "fails";}
}
@@ -0,0 +1,31 @@
<?php
namespace CakePHP\Tests\WhiteSpace;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class FunctionClosingBraceSpaceUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
3 => 1,
6 => 1,
10 => 1,
25 => 1,
28 => 1,
30 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,10 @@
<?php
function failingFunction() {
echo 'you fail';
}
function somePassingFunction() {
echo 'you pass';
}
@@ -0,0 +1,26 @@
<?php
namespace CakePHP\Tests\WhiteSpace;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class FunctionOpeningBraceSpaceUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
3 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,4 @@
<?php
$test-> failling() ;
$test->passing() ;
@@ -0,0 +1,26 @@
<?php
namespace CakePHP\Tests\WhiteSpace;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class ObjectOperatorSpacingUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
3 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
$ten =10 * 2;
$ten= -10 * 2;
$ten = 10/-2;
$bool = true& true;
$bool = true &true;
$bool = true&true;
$foo = -1;
switch ($foo) {
case -1:
break;
case 'negative':
return -1;
}
$bar = isset($foo) ? -2 : 0;
$foo = isset($bar) ? 0 : -2;
$ten = 10 * 2;
$ten = -10 * 2;
$ten = 10 / -2;
$ten = -10 / 2;
$ten = -10 + 2;
$ten = 10 + -2;
$ten = -10 - 2;
$ten = 10 - -2;
$dec = -0.001;
$dec = -1;
$bool = true & true;
$arr = [-1];
$refArr = [&$foo];
$refArr = [$bar, &$foo];
@@ -0,0 +1,31 @@
<?php
namespace CakePHP\Tests\WhiteSpace;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class OperatorSpacingUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
3 => 1,
4 => 1,
5 => 2,
6 => 1,
7 => 1,
8 => 2,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
$ten = 10 * 2;
$ten = -10 * 2;
$ten = 10 / -2;
$bool = true & true;
$bool = true & true;
$bool = true & true;
$foo = -1;
switch ($foo) {
case -1:
break;
case 'negative':
return -1;
}
$bar = isset($foo) ? -2 : 0;
$foo = isset($bar) ? 0 : -2;
$ten = 10 * 2;
$ten = -10 * 2;
$ten = 10 / -2;
$ten = -10 / 2;
$ten = -10 + 2;
$ten = 10 + -2;
$ten = -10 - 2;
$ten = 10 - -2;
$dec = -0.001;
$dec = -1;
$bool = true & true;
$arr = [-1];
$refArr = [&$foo];
$refArr = [$bar, &$foo];
@@ -0,0 +1,3 @@
<?php
$var = 'tab and space';
$var = 'space and tab';
@@ -0,0 +1,27 @@
<?php
namespace CakePHP\Tests\WhiteSpace;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
class TabAndSpaceUnitTest extends AbstractSniffUnitTest
{
/**
* {@inheritDoc}
*/
public function getErrorList()
{
return [
2 => 1,
3 => 1,
];
}
/**
* {@inheritDoc}
*/
public function getWarningList()
{
return [];
}
}