Skip to content

Commit

Permalink
move around some classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmajor committed Nov 24, 2023
1 parent f0c56b7 commit 31e74e7
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

namespace Major\PluralRules\Dev\Commands;
namespace Major\PluralRules\Dev\Rules;

use Major\PluralRules\Dev\Compilers\RuleCompiler as Compiler;
use Major\PluralRules\Dev\Helpers\CldrData;
use Major\PluralRules\Dev\Helpers\LocaleFiles;
use Symfony\Component\Console\Command\Command;
Expand All @@ -22,7 +21,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
LocaleFiles::prepareDirectory('rules');

foreach (CldrData::rules() as $locale => $rules) {
(new Compiler($locale, $rules))->compile();
(new RuleCompiler($locale, $rules))->compile();
}

$output->writeln('<info>Compiled in ' . round(microtime(true) - $start, 2) . 's</info>');
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions dev/Compilers/RuleCompiler.php → dev/Rules/RuleCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Major\PluralRules\Dev\Compilers;
namespace Major\PluralRules\Dev\Rules;

use Exception;
use Hoa\Compiler\Llk\Llk;
Expand All @@ -28,7 +28,7 @@ public function __construct(
private array $rules,
) {
$this->llk = Llk::load(
new \Hoa\File\Read(__DIR__ . '/../grammars/PluralRule.pp'),
new \Hoa\File\Read(__DIR__ . '/PluralRule.pp'),
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

namespace Major\PluralRules\Dev\Commands;
namespace Major\PluralRules\Dev\Tests;

use Major\PluralRules\Dev\Compilers\TestCompiler as Compiler;
use Major\PluralRules\Dev\Helpers\CldrData;
use Major\PluralRules\Dev\Helpers\LocaleFiles;
use Symfony\Component\Console\Command\Command;
Expand All @@ -22,7 +21,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
LocaleFiles::prepareDirectory('tests');

foreach (CldrData::rules() as $locale => $rules) {
(new Compiler($locale, $rules))->compile();
(new TestCompiler($locale, $rules))->compile();
}

$output->writeln('<info>Compiled in ' . round(microtime(true) - $start, 2) . 's</info>');
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions dev/Compilers/TestCompiler.php → dev/Tests/TestCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

declare(strict_types=1);

namespace Major\PluralRules\Dev\Compilers;
namespace Major\PluralRules\Dev\Tests;

use Exception;
use Hoa\Compiler\Llk\Llk;
Expand All @@ -29,7 +29,7 @@ public function __construct(
private array $rules,
) {
$this->llk = Llk::load(
new \Hoa\File\Read(__DIR__ . '/../grammars/SampleList.pp'),
new \Hoa\File\Read(__DIR__ . '/SampleList.pp'),
);
}

Expand Down
6 changes: 3 additions & 3 deletions gen
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php

use Major\PluralRules\Dev\Commands;
use Major\PluralRules\Dev;
use NunoMaduro\Collision\Provider;
use Symfony\Component\Console\Application;

Expand All @@ -12,8 +12,8 @@ require __DIR__ . '/vendor/autoload.php';
$application = new Application('pluralrules locale data compiler');

$application->addCommands([
new Commands\CompileRulesCommand(),
new Commands\CompileTestsCommand(),
new Dev\Rules\CompileRulesCommand(),
new Dev\Tests\CompileTestsCommand(),
]);

$application->run();
6 changes: 3 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ parameters:
-
message: '#^Cannot call method (getChild|getChildren|getValueValue)\(\) on Hoa\\Compiler\\Llk\\TreeNode\|null\.$#'
count: 9
path: dev/Compilers/RuleCompiler.php
path: dev/Rules/RuleCompiler.php
-
message: '#expects Hoa\\Compiler\\Llk\\TreeNode, Hoa\\Compiler\\Llk\\TreeNode\|null given\.$#'
count: 1
path: dev/Compilers/RuleCompiler.php
path: dev/Rules/RuleCompiler.php
-
message: '#^Parameter \#1 \$\w+ of function Psl\\Str\\(contains|ends_with) expects string, string\|null given\.$#'
count: 5
path: dev/Compilers/TestCompiler.php
path: dev/Tests/TestCompiler.php

tmpDir: .cache/phpstan

Expand Down

0 comments on commit 31e74e7

Please sign in to comment.