Skip to content

Commit

Permalink
Merge pull request DesignPatternsPHP#445 from mariosimao/444-adopt-psr12
Browse files Browse the repository at this point in the history
style: Adopt PSR12
  • Loading branch information
domnikl authored Oct 2, 2021
2 parents 9401af5 + 56970cc commit c03a2f9
Show file tree
Hide file tree
Showing 167 changed files with 511 additions and 226 deletions.
4 changes: 3 additions & 1 deletion Behavioral/ChainOfResponsibilities/Handler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\ChainOfResponsibilities;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/ChainOfResponsibilities/Tests/ChainTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\ChainOfResponsibilities\Tests;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Command/AddMessageDateCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Command;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Command/Command.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Command;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Command/HelloCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Command;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Command/Invoker.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Command;

Expand Down
6 changes: 4 additions & 2 deletions Behavioral/Command/Receiver.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Command;

Expand All @@ -17,7 +19,7 @@ class Receiver
public function write(string $str)
{
if ($this->enableDate) {
$str .= ' ['.date('Y-m-d').']';
$str .= ' [' . date('Y-m-d') . ']';
}

$this->output[] = $str;
Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Command/Tests/CommandTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Command\Tests;

Expand Down
8 changes: 5 additions & 3 deletions Behavioral/Command/Tests/UndoableCommandTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Command\Tests;

Expand All @@ -23,11 +25,11 @@ public function testInvocation()
$messageDateCommand->execute();

$invoker->run();
$this->assertSame("Hello World\nHello World [".date('Y-m-d').']', $receiver->getOutput());
$this->assertSame("Hello World\nHello World [" . date('Y-m-d') . ']', $receiver->getOutput());

$messageDateCommand->undo();

$invoker->run();
$this->assertSame("Hello World\nHello World [".date('Y-m-d')."]\nHello World", $receiver->getOutput());
$this->assertSame("Hello World\nHello World [" . date('Y-m-d') . "]\nHello World", $receiver->getOutput());
}
}
4 changes: 3 additions & 1 deletion Behavioral/Command/UndoableCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Command;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Interpreter/AbstractExp.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Interpreter;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Interpreter/AndExp.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Interpreter;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Interpreter/Context.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Interpreter;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Interpreter/OrExp.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Interpreter;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Interpreter/Tests/InterpreterTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Interpreter\Tests;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Interpreter/VariableExp.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Interpreter;

Expand Down
6 changes: 4 additions & 2 deletions Behavioral/Iterator/Book.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Iterator;

Expand All @@ -20,6 +22,6 @@ public function getTitle(): string

public function getAuthorAndTitle(): string
{
return $this->getTitle().' by '.$this->getAuthor();
return $this->getTitle() . ' by ' . $this->getAuthor();
}
}
4 changes: 3 additions & 1 deletion Behavioral/Iterator/BookList.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Iterator;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Iterator/Tests/IteratorTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Iterator\Tests;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Mediator/Colleague.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Mediator;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Mediator/Mediator.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Mediator;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Mediator/Tests/MediatorTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Tests\Mediator\Tests;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Mediator/Ui.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Mediator;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Mediator/UserRepository.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Mediator;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Mediator/UserRepositoryUiMediator.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Mediator;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Memento/Memento.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Memento;

Expand Down
12 changes: 7 additions & 5 deletions Behavioral/Memento/State.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Memento;

use InvalidArgumentException;

class State implements \Stringable
{
const STATE_CREATED = 'created';
const STATE_OPENED = 'opened';
const STATE_ASSIGNED = 'assigned';
const STATE_CLOSED = 'closed';
public const STATE_CREATED = 'created';
public const STATE_OPENED = 'opened';
public const STATE_ASSIGNED = 'assigned';
public const STATE_CLOSED = 'closed';

private string $state;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Memento/Tests/MementoTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Memento\Tests;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Memento/Ticket.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Memento;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/NullObject/Logger.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\NullObject;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/NullObject/NullLogger.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\NullObject;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/NullObject/PrintLogger.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\NullObject;

Expand Down
6 changes: 4 additions & 2 deletions Behavioral/NullObject/Service.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\NullObject;

Expand All @@ -14,6 +16,6 @@ public function __construct(private Logger $logger)
public function doSomething()
{
// notice here that you don't have to check if the logger is set with eg. is_null(), instead just use it
$this->logger->log('We are in '.__METHOD__);
$this->logger->log('We are in ' . __METHOD__);
}
}
4 changes: 3 additions & 1 deletion Behavioral/NullObject/Tests/LoggerTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\NullObject\Tests;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Observer/Tests/ObserverTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Observer\Tests;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Observer/User.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Observer;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Observer/UserObserver.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Observer;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Specification/AndSpecification.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Specification;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Specification/Item.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Specification;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Specification/NotSpecification.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Specification;

Expand Down
4 changes: 3 additions & 1 deletion Behavioral/Specification/OrSpecification.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace DesignPatterns\Behavioral\Specification;

Expand Down
Loading

0 comments on commit c03a2f9

Please sign in to comment.