Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Nov 11, 2023
1 parent 8629ed8 commit 578ec02
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/FileSystem/HardDisk.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function normalizePath(string $path): string
/**
* Checks if the content of the file on the disk is the same as the content.
*/
public static function persistByHash(string $data, string $path): int|bool
public static function persistByHash(string $data, string $path): int | bool
{
if (!file_exists($path)) {
return file_put_contents($path, $data);
Expand Down
11 changes: 4 additions & 7 deletions src/Name.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

namespace Zephir;

use function in_array;
use function strlen;

final class Name
{
public static function camelize(string $string): string
Expand All @@ -29,8 +26,8 @@ public static function camelize(string $string): string
*/
public static function fetchFQN(
string $class,
?string $namespace = null,
?AliasManager $aliasManager = null
string $namespace = null,
AliasManager $aliasManager = null
): string {
/**
* Absolute class/interface name
Expand Down Expand Up @@ -85,14 +82,14 @@ public static function addSlashes(string $string): string
];

$new = '';
$last = strlen($string) - 1;
$last = \strlen($string) - 1;

for ($i = 0, $next = 1; $i <= $last; ++$i, ++$next) {
$ch = $string[$i];
$after = $i !== $last ? $string[$next] : null;

if ($ch === $escape) {
if (in_array($after, $controlChar, true) || is_numeric($after)) {
if (\in_array($after, $controlChar, true) || is_numeric($after)) {
// should not escape native C control chars
$new .= $ch.$after;
++$i;
Expand Down
4 changes: 1 addition & 3 deletions src/Os.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@

namespace Zephir;

use const PHP_OS;

class Os
{
/**
* Checks if currently running under MS Windows.
*/
public static function isWindows(): bool
{
return 0 === stripos(PHP_OS, 'WIN');
return 0 === stripos(\PHP_OS, 'WIN');
}
}
19 changes: 8 additions & 11 deletions src/Statements/ForStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Zephir\Statements;

use ReflectionException;
use Zephir\CompilationContext;
use Zephir\CompiledExpression;
use Zephir\Detectors\ForValueUseDetector;
Expand All @@ -25,8 +24,6 @@
use Zephir\StatementsBlock;
use Zephir\Variable\Variable;

use function count;

class ForStatement extends StatementAbstract
{
/**
Expand All @@ -37,23 +34,23 @@ class ForStatement extends StatementAbstract
*
* @return bool
*
* @throws ReflectionException
* @throws \ReflectionException
* @throws Exception
*/
public function compileRange(array $exprRaw, CompilationContext $compilationContext): bool
{
if (!count($exprRaw['parameters'])) {
if (!\count($exprRaw['parameters'])) {
return false;
}

if (count($exprRaw['parameters']) > 3) {
if (\count($exprRaw['parameters']) > 3) {
return false;
}

$functionCall = new FunctionCall();
$parameters = $functionCall->getResolvedParamsAsExpr($exprRaw['parameters'], $compilationContext, $exprRaw);

if (2 != count($parameters) && 3 != count($parameters)) {
if (2 != \count($parameters) && 3 != \count($parameters)) {
throw new CompilerException('Wrong number of parameters', $this->statement['expr']);
}

Expand Down Expand Up @@ -404,7 +401,7 @@ public function compileRange(array $exprRaw, CompilationContext $compilationCont
* @return void
*
* @throws Exception
* @throws ReflectionException
* @throws \ReflectionException
*/
public function compileIterator(array $exprRaw, CompilationContext $compilationContext): void
{
Expand Down Expand Up @@ -526,12 +523,12 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC
* - Every value must be a char/integer or compatible.
*
* @throws Exception
* @throws ReflectionException
* @throws \ReflectionException
*/
public function compileStringTraverse(
CompiledExpression $expression,
CompilationContext $compilationContext,
?Variable $exprVariable = null,
Variable $exprVariable = null,
): void {
$codePrinter = $compilationContext->codePrinter;

Expand Down Expand Up @@ -749,7 +746,7 @@ public function compileHashTraverse(CompilationContext $compilationContext, Vari
* @param CompilationContext $compilationContext
*
* @throws Exception
* @throws ReflectionException
* @throws \ReflectionException
*/
public function compile(CompilationContext $compilationContext): void
{
Expand Down

0 comments on commit 578ec02

Please sign in to comment.