Skip to content

Commit

Permalink
Affordable Mobiles rebrand
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacarpet committed Nov 5, 2024
1 parent 6de99d8 commit b793773
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
14 changes: 9 additions & 5 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@

declare(strict_types=1);

use AffordableMobiles\PhpCsFixer\Fixer\Operator\NotEmptyTernaryToNullCoalescingFixer;
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

require_once __DIR__.'/vendor/autoload.php';

$finder = PhpCsFixer\Finder::create()
$finder = Finder::create()
->ignoreDotFiles(false)
->ignoreVCSIgnored(true)
->in(__DIR__)
;

$config = new PhpCsFixer\Config();
$config = new Config();
$config
->registerCustomFixers([
new \A1comms\PhpCsFixer\Fixer\Operator\NotEmptyTernaryToNullCoalescingFixer(),
new NotEmptyTernaryToNullCoalescingFixer(),
])
->setRiskyAllowed(true)
->setRules([
'@PHP81Migration' => true,
'@PHP83Migration' => true,
'@PHP80Migration:risky' => true,
'heredoc_indentation' => false,
'@PhpCsFixer' => true,
Expand All @@ -26,7 +30,7 @@
'binary_operator_spaces' => [
'default' => 'align',
],
'A1comms/not_empty_ternary_to_null_coalescing' => true,
'AffordableMobiles/not_empty_ternary_to_null_coalescing' => true,
])
->setFinder($finder)
;
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "a1comms/php-cs-fixer-rules",
"name": "affordablemobiles/php-cs-fixer-rules",
"description": "Code formatting rules for php-cs-fixer",
"license": "MIT",
"authors": [
{
"name": "Samuel Melrose",
"email": "sam.melrose@a1comms.com"
"email": "sam.melrose@affordablemobiles.co.uk"
}
],
"require": {
"php": "^8.1",
"php": "^8.3",
"friendsofphp/php-cs-fixer": "~3"
},
"autoload": {
"psr-4": {
"A1comms\\PhpCsFixer\\": "src/"
"AffordableMobiles\\PhpCsFixer\\": "src/"
}
}
}
13 changes: 2 additions & 11 deletions src/Fixer/Operator/NotEmptyTernaryToNullCoalescingFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* with this source code in the file LICENSE.
*/

namespace A1comms\PhpCsFixer\Fixer\Operator;
namespace AffordableMobiles\PhpCsFixer\Fixer\Operator;

use PhpCsFixer\AbstractFixer;
use PhpCsFixer\FixerDefinition\CodeSample;
Expand All @@ -37,12 +37,9 @@ final class NotEmptyTernaryToNullCoalescingFixer extends AbstractFixer
*/
public function getName(): string
{
return sprintf('A1comms/%s', parent::getName());
return \sprintf('AffordableMobiles/%s', parent::getName());
}

/**
* {@inheritdoc}
*/
public function getDefinition(): FixerDefinitionInterface
{
return new FixerDefinition(
Expand All @@ -65,17 +62,11 @@ public function getPriority(): int
return 0;
}

/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens): bool
{
return $tokens->isTokenKindFound(T_EMPTY);
}

/**
* {@inheritdoc}
*/
protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
{
$emptyIndices = array_keys($tokens->findGivenKind(T_EMPTY));
Expand Down

0 comments on commit b793773

Please sign in to comment.