Skip to content

Commit

Permalink
Merge pull request #48 from phalcon/feature/#47-psr-12
Browse files Browse the repository at this point in the history
#47 - Adapt code to PSR-12
  • Loading branch information
Jeckerson authored Feb 2, 2020
2 parents 7d9ec98 + 1b883f4 commit e7b7d2e
Show file tree
Hide file tree
Showing 53 changed files with 369 additions and 138 deletions.
65 changes: 33 additions & 32 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0"?>
<ruleset name="Phalcon Developer Tools">
<description>Phalcon Coding Standards</description>
<arg value="-colors"/>
<arg value="s"/>
<rule ref="PSR2"/>
<arg value="p"/>
<rule ref="PSR12"/>

<file>src/</file>
<file>tests/Integration/</file>
Expand Down
3 changes: 2 additions & 1 deletion src/Console/BuilderException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Phalcon Developer Tools.
Expand All @@ -10,6 +9,8 @@
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Phalcon\Migrations\Console;

use Phalcon\Exception;
Expand Down
73 changes: 37 additions & 36 deletions src/Console/Color.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Phalcon Migrations.
Expand All @@ -10,48 +9,50 @@
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Phalcon\Migrations\Console;

/**
* Allows to generate messages using colors on xterm, ddterm, linux, etc.
*/
final class Color
{
const FG_BLACK = 1;
const FG_DARK_GRAY = 2;
const FG_BLUE = 3;
const FG_LIGHT_BLUE = 4;
const FG_GREEN = 5;
const FG_LIGHT_GREEN = 6;
const FG_CYAN = 7;
const FG_LIGHT_CYAN = 8;
const FG_RED = 9;
const FG_LIGHT_RED = 10;
const FG_PURPLE = 11;
const FG_LIGHT_PURPLE = 12;
const FG_BROWN = 13;
const FG_YELLOW = 14;
const FG_LIGHT_GRAY = 15;
const FG_WHITE = 16;

const BG_BLACK = 1;
const BG_RED = 2;
const BG_GREEN = 3;
const BG_YELLOW = 4;
const BG_BLUE = 5;
const BG_MAGENTA = 6;
const BG_CYAN = 7;
const BG_LIGHT_GRAY = 8;

const AT_NORMAL = 1;
const AT_BOLD = 2;
const AT_ITALIC = 3;
const AT_UNDERLINE = 4;
const AT_BLINK = 5;
const AT_OUTLINE = 6;
const AT_REVERSE = 7;
const AT_NONDISP = 8;
const AT_STRIKE = 9;
public const FG_BLACK = 1;
public const FG_DARK_GRAY = 2;
public const FG_BLUE = 3;
public const FG_LIGHT_BLUE = 4;
public const FG_GREEN = 5;
public const FG_LIGHT_GREEN = 6;
public const FG_CYAN = 7;
public const FG_LIGHT_CYAN = 8;
public const FG_RED = 9;
public const FG_LIGHT_RED = 10;
public const FG_PURPLE = 11;
public const FG_LIGHT_PURPLE = 12;
public const FG_BROWN = 13;
public const FG_YELLOW = 14;
public const FG_LIGHT_GRAY = 15;
public const FG_WHITE = 16;

public const BG_BLACK = 1;
public const BG_RED = 2;
public const BG_GREEN = 3;
public const BG_YELLOW = 4;
public const BG_BLUE = 5;
public const BG_MAGENTA = 6;
public const BG_CYAN = 7;
public const BG_LIGHT_GRAY = 8;

public const AT_NORMAL = 1;
public const AT_BOLD = 2;
public const AT_ITALIC = 3;
public const AT_UNDERLINE = 4;
public const AT_BLINK = 5;
public const AT_OUTLINE = 6;
public const AT_REVERSE = 7;
public const AT_NONDISP = 8;
public const AT_STRIKE = 9;

/**
* @var array Map of supported foreground colors
Expand Down
3 changes: 2 additions & 1 deletion src/Console/Commands/Builtin/Migration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Phalcon Developer Tools.
Expand All @@ -10,6 +9,8 @@
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Phalcon\Migrations\Console\Commands\Builtin;

use Phalcon\Config;
Expand Down
6 changes: 4 additions & 2 deletions src/Console/Commands/Command.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Phalcon Developer Tools.
Expand All @@ -10,6 +9,8 @@
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Phalcon\Migrations\Console\Commands;

use Phalcon\Config;
Expand Down Expand Up @@ -244,7 +245,8 @@ public function parseParameters(array $parameters = [], $possibleAlias = []): ar

for ($i = 1; $i < $numberArguments; $i++) {
$argv = $_SERVER['argv'][$i];
if (is_string($argv) &&
if (
is_string($argv) &&
preg_match('#^([\-]{1,2})([a-zA-Z0-9][a-zA-Z0-9\-]*)(=(.*)){0,1}$#', $argv, $matches)
) {
if (strlen($matches[1]) == 1) {
Expand Down
3 changes: 2 additions & 1 deletion src/Console/Commands/CommandsException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Phalcon Developer Tools.
Expand All @@ -10,6 +9,8 @@
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Phalcon\Migrations\Console\Commands;

use Phalcon\Exception;
Expand Down
3 changes: 2 additions & 1 deletion src/Console/Commands/CommandsInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Phalcon Developer Tools.
Expand All @@ -10,6 +9,8 @@
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Phalcon\Migrations\Console\Commands;

/**
Expand Down
Loading

0 comments on commit e7b7d2e

Please sign in to comment.