Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more ns #19

Merged
merged 1 commit into from
Sep 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"laravel/laravel": "To use Laravel (The awesome) implementations"
},
"autoload": {
"classmap": [
"src"
],
"psr-4": {
"fab2s\\YaEtl\\": "src"
},
"files": [
"src/support/deprecated.php"
]
Expand Down
17 changes: 9 additions & 8 deletions src/Events/ProgressBarSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
* find in the LICENSE file or at https://opensource.org/licenses/MIT
*/

namespace fab2s\YaEtl\Laravel\Callbacks;
namespace fab2s\YaEtl\Events;

use fab2s\NodalFlow\Events\FlowEvent;
use fab2s\NodalFlow\Events\FlowEventInterface;
use fab2s\NodalFlow\Flows\FlowInterface;
use fab2s\YaEtl\YaEtl;
use ReflectionException;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -54,7 +55,7 @@ class ProgressBarSubscriber implements EventSubscriberInterface
*
* @param YaEtl|null $flow
*
* @throws \ReflectionException
* @throws ReflectionException
*/
public function __construct(YaEtl $flow = null)
{
Expand All @@ -67,7 +68,7 @@ public function __construct(YaEtl $flow = null)
/**
* @param YaEtl $flow
*
* @throws \ReflectionException
* @throws ReflectionException
*
* @return static
*/
Expand Down Expand Up @@ -111,7 +112,7 @@ public function setOutput(OutputInterface $output): self
*/
public function setProgressMod(int $progressMod): self
{
$this->progressMod = max(1, (int) $progressMod);
$this->progressMod = max(1, $progressMod);

return $this;
}
Expand Down Expand Up @@ -148,7 +149,7 @@ public function start(FlowEventInterface $event)

/**
* Triggered when a Flow progresses,
* eg exec once or generates once
* e.g. exec once or generates once
*/
public function progress()
{
Expand All @@ -163,11 +164,11 @@ public function progress()
public function success(FlowEventInterface $event)
{
$this->progressBar->finish();
$this->output->writeln(PHP_EOL);
$this->output->writeln('');
$flow = $event->getFlow();
$flowStatus = $flow->getFlowStatus();
if ($flowStatus->isDirty()) {
$this->output->writeln('<warn>[YaEtl] Dirty Success</warn>');
$this->output->writeln('<comment>[YaEtl] Dirty Success</comment>');
} else {
$this->output->writeln('<info>[YaEtl] Clean Success</info>');
}
Expand All @@ -183,7 +184,7 @@ public function success(FlowEventInterface $event)
public function fail(FlowEventInterface $event)
{
$this->progressBar->finish();
$this->output->writeln(PHP_EOL);
$this->output->writeln('');
$this->output->writeln('<error>[YaEtl] Failed</error>');
$this->displayReport($event->getFlow());
}
Expand Down
12 changes: 11 additions & 1 deletion src/support/deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@

namespace {
class_alias(\fab2s\YaEtl\YaEtlException::class, \fab2s\NodalFlow\YaEtlException::class);
class_alias(\fab2s\YaEtl\Events\ProgressBarSubscriber::class, \fab2s\YaEtl\Laravel\Callbacks\ProgressBarSubscriber::class);
}

namespace fab2s\NodalFlow {
if (!class_exists(YaEtlException::class)) {
/** @deprecated YaEtlException this is intended to help IDEs */
/** @deprecated YaEtlException use fab2s\NodalFlow\YaEtlException instead (NS update) */
class YaEtlException
{
}
}
}

namespace fab2s\YaEtl\Laravel\Callbacks {
if (!class_exists(ProgressBarSubscriber::class)) {
/** @deprecated ProgressBarSubscriber use fab2s\YaEtl\Events\ProgressBarSubscriber instead (NS update) */
class ProgressBarSubscriber
{
}
}
}
2 changes: 1 addition & 1 deletion tests/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Class FileTest
*/
class FileTest extends \TestBase
class FileTest extends TestBase
{
/**
* @var array
Expand Down
2 changes: 1 addition & 1 deletion tests/FromTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Class FromTest
*/
class FromTest extends \TestBase
class FromTest extends TestBase
{
public function setUp(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/JoinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Class JoinTest
*/
class JoinTest extends \TestBase
class JoinTest extends TestBase
{
public function setUp(): void
{
Expand Down
8 changes: 4 additions & 4 deletions tests/ProgressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
*/

use fab2s\NodalFlow\NodalFlowException;
use fab2s\YaEtl\Events\ProgressBarSubscriber;
use fab2s\YaEtl\Extractors\CallableExtractor;
use fab2s\YaEtl\Laravel\Callbacks\ProgressBarSubscriber;
use fab2s\YaEtl\Transformers\NoOpTransformer;
use fab2s\YaEtl\YaEtl;
use Symfony\Component\Console\Output\StreamOutput;

/**
* Class ProgressTest
*/
class ProgressTest extends \TestBase
class ProgressTest extends TestBase
{
/**
* @dataProvider progressProvider
Expand Down Expand Up @@ -137,7 +137,7 @@ protected function getStreamContent($stream, bool $normalize = false): string
/**
* @return Closure
*/
protected function getNoOpClosure(): \Closure
protected function getNoOpClosure(): Closure
{
return function ($record) {
return $record;
Expand All @@ -149,7 +149,7 @@ protected function getNoOpClosure(): \Closure
*
* @return Closure
*/
protected function getTraversableClosure($limit = 10): \Closure
protected function getTraversableClosure(int $limit = 10): Closure
{
return function () use ($limit) {
for ($i = 1; $i <= $limit; ++$i) {
Expand Down
2 changes: 1 addition & 1 deletion tests/QualifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* Class QualifierTest
*/
class QualifierTest extends \TestBase
class QualifierTest extends TestBase
{
/**
* @dataProvider interruptProvider
Expand Down