fix: update php-cs-fixer rules

This commit is contained in:
Khoubza Younes
2022-12-07 23:10:03 +01:00
parent 2aa9f7ca73
commit 89d656a5dc
13 changed files with 25 additions and 70 deletions
-38
View File
@@ -5,54 +5,16 @@
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
*/
if (!file_exists(__DIR__.'/src')) {
exit(0);
}
$header = <<<'EOF'
This file is part of the PHPFlasher package.
(c) Younes KHOUBZA <younes.khoubza@gmail.com>
EOF;
$rules = array(
'@PSR12' => true,
'@PSR12:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'header_comment' => array('header' => $header),
'array_syntax' => array('syntax' => 'long'),
'ordered_imports' => array(
'sort_algorithm' => 'alpha',
'imports_order' => array('const', 'class', 'function'),
),
'no_extra_blank_lines' => array(
'tokens' => array('case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw'),
),
'function_to_constant' => false,
'visibility_required' => array('elements' => array('property', 'method')),
'self_accessor' => false,
'single_trait_insert_per_statement' => true,
'linebreak_after_opening_tag' => true,
'no_php4_constructor' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'phpdoc_order' => true,
'strict_comparison' => true,
'strict_param' => true,
'phpdoc_line_span' => true,
'php_unit_internal_class' => false,
'php_unit_test_class_requires_covers' => false,
'multiline_whitespace_before_semicolons' => false,
'method_chaining_indentation' => false,
'phpdoc_no_empty_return' => false,
'phpdoc_types_order' => array('null_adjustment' => 'always_last'),
'php_unit_test_case_static_method_calls' => array('call_type' => 'this'),
'php_unit_strict' => false,
'native_constant_invocation' => array('scope' => 'namespaced'),
'phpdoc_return_self_reference' => true,
);
$finder = new PhpCsFixer\Finder();
+1 -1
View File
@@ -36,7 +36,7 @@ use Illuminate\Support\Facades\Facade;
* @method static NotificationBuilder with(StampInterface[] $stamps = array())
* @method static NotificationBuilder withStamp(StampInterface $stamp)
* @method static NotificationBuilder handler(string $handler)
* @method static Envelope getEnvelope()
* @method static Envelope getEnvelope()
*/
class Flasher extends Facade
{
+1 -2
View File
@@ -7,7 +7,6 @@
namespace Flasher\Laravel\Middleware;
use Closure;
use Flasher\Laravel\Http\Request;
use Flasher\Laravel\Http\Response;
use Flasher\Prime\Http\ResponseExtension;
@@ -29,7 +28,7 @@ final class FlasherMiddleware
/**
* @return LaravelResponse
*/
public function handle(LaravelRequest $request, Closure $next)
public function handle(LaravelRequest $request, \Closure $next)
{
/** @var LaravelResponse $response */
$response = $next($request);
+1 -2
View File
@@ -7,7 +7,6 @@
namespace Flasher\Laravel\Middleware;
use Closure;
use Flasher\Laravel\Http\Request;
use Flasher\Laravel\Http\Response;
use Flasher\Prime\Http\RequestExtension;
@@ -29,7 +28,7 @@ final class SessionMiddleware
/**
* @return LaravelResponse
*/
public function handle(LaravelRequest $request, Closure $next)
public function handle(LaravelRequest $request, \Closure $next)
{
/** @var LaravelResponse $response */
$response = $next($request);
+1 -1
View File
@@ -36,7 +36,7 @@ use Illuminate\Support\Facades\Facade;
* @method static NotyBuilder with(StampInterface[] $stamps = array())
* @method static NotyBuilder withStamp(StampInterface $stamp)
* @method static NotyBuilder handler(string $handler)
* @method static Envelope getEnvelope()
* @method static Envelope getEnvelope()
* @method static NotyBuilder text(string $text)
* @method static NotyBuilder alert(string $message = null, array $options = array())
* @method static NotyBuilder layout(string $layout)
+1 -1
View File
@@ -36,7 +36,7 @@ use Illuminate\Support\Facades\Facade;
* @method static NotyfBuilder with(StampInterface[] $stamps = array())
* @method static NotyfBuilder withStamp(StampInterface $stamp)
* @method static NotyfBuilder handler(string $handler)
* @method static Envelope getEnvelope()
* @method static Envelope getEnvelope()
* @method static NotyfBuilder duration(int $duration)
* @method static NotyfBuilder ripple(bool $ripple)
* @method static NotyfBuilder position(string $position, string $value)
+1 -1
View File
@@ -36,7 +36,7 @@ use Illuminate\Support\Facades\Facade;
* @method static PnotifyBuilder with(StampInterface[] $stamps = array())
* @method static PnotifyBuilder withStamp(StampInterface $stamp)
* @method static PnotifyBuilder handler(string $handler)
* @method static Envelope getEnvelope()
* @method static Envelope getEnvelope()
* @method static PnotifyBuilder title(bool|string $title)
* @method static PnotifyBuilder titleEscape(bool $titleEscape = true)
* @method static PnotifyBuilder text(string $text)
@@ -38,9 +38,9 @@ final class PresetListener implements EventSubscriberInterface
}
/**
* @throws PresetNotFoundException
*
* @return void
*
* @throws PresetNotFoundException
*/
public function __invoke(PersistEvent $event)
{
@@ -58,9 +58,9 @@ final class PresetListener implements EventSubscriberInterface
}
/**
* @throws PresetNotFoundException
*
* @return void
*
* @throws PresetNotFoundException
*/
private function attachPresets(Envelope $envelope)
{
+5 -4
View File
@@ -20,9 +20,9 @@ interface FlasherInterface
*
* @param string|null $alias
*
* @throws \InvalidArgumentException
*
* @return NotificationFactoryInterface
*
* @throws \InvalidArgumentException
*/
public function create($alias = null);
@@ -31,9 +31,9 @@ interface FlasherInterface
*
* @param string|null $alias
*
* @throws \InvalidArgumentException
*
* @return NotificationFactoryInterface
*
* @throws \InvalidArgumentException
*/
public function using($alias);
@@ -53,6 +53,7 @@ interface FlasherInterface
* @param array<string, mixed> $context
*
* @return mixed
*
* @phpstan-return ($presenter is 'html' ? string : mixed)
*/
public function render(array $criteria = array(), $presenter = 'html', array $context = array());
+5 -9
View File
@@ -7,14 +7,10 @@
namespace Flasher\Prime\Stamp;
use DateTime;
use DateTimeZone;
use Exception;
final class CreatedAtStamp implements StampInterface, OrderableStampInterface, PresentableStampInterface
{
/**
* @var DateTime
* @var \DateTime
*/
private $createdAt;
@@ -26,16 +22,16 @@ final class CreatedAtStamp implements StampInterface, OrderableStampInterface, P
/**
* @param string|null $format
*
* @throws Exception
* @throws \Exception
*/
public function __construct(DateTime $createdAt = null, $format = null)
public function __construct(\DateTime $createdAt = null, $format = null)
{
$this->createdAt = $createdAt ?: new DateTime('now', new DateTimeZone('Africa/Casablanca'));
$this->createdAt = $createdAt ?: new \DateTime('now', new \DateTimeZone('Africa/Casablanca'));
$this->format = $format ?: 'Y-m-d H:i:s';
}
/**
* @return DateTime
* @return \DateTime
*/
public function getCreatedAt()
{
+1 -1
View File
@@ -36,7 +36,7 @@ use Illuminate\Support\Facades\Facade;
* @method static SweetAlertBuilder with(StampInterface[] $stamps = array())
* @method static SweetAlertBuilder withStamp(StampInterface $stamp)
* @method static SweetAlertBuilder handler(string $handler)
* @method static Envelope getEnvelope()
* @method static Envelope getEnvelope()
* @method static SweetAlertBuilder question(string $message = null, array $options = array())
* @method static SweetAlertBuilder title(string $title)
* @method static SweetAlertBuilder titleText(string $titleText)
+1 -1
View File
@@ -36,7 +36,7 @@ use Illuminate\Support\Facades\Facade;
* @method static ToastrBuilder with(StampInterface[] $stamps = array())
* @method static ToastrBuilder withStamp(StampInterface $stamp)
* @method static ToastrBuilder handler(string $handler)
* @method static Envelope getEnvelope()
* @method static Envelope getEnvelope()
* @method static ToastrBuilder title(string $title)
* @method static ToastrBuilder closeButton(bool $closeButton = true)
* @method static ToastrBuilder closeClass(string $closeClass)
+3 -5
View File
@@ -7,8 +7,6 @@
namespace Flasher\Tests\Prime;
use ReflectionClass;
class TestCase extends \PHPUnit\Framework\TestCase
{
/**
@@ -35,13 +33,13 @@ class TestCase extends \PHPUnit\Framework\TestCase
* @param string $methodName method name to call
* @param array|mixed $parameters array of parameters to pass into method
*
* @throws \ReflectionException
*
* @return mixed method return
*
* @throws \ReflectionException
*/
protected function callMethod(&$object, $methodName, $parameters = array())
{
$reflection = new ReflectionClass(\get_class($object));
$reflection = new \ReflectionClass(\get_class($object));
$method = $reflection->getMethod($methodName);
$method->setAccessible(true);