Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
1) src/Exceptions/Handler.php (new_with_parentheses, fully_qualified_strict_types, unary_operator_spaces, not_operator_with_successor_space)
2) src/Container.php (new_with_parentheses)
3) src/Bootstrap/HandleExceptions.php (new_with_parentheses, fully_qualified_strict_types, unary_operator_spaces, not_operator_with_successor_space)
4) src/Support/helpers.php (fully_qualified_strict_types, nullable_type_declaration_for_default_null_value, unary_operator_spaces, not_operator_with_successor_space)
5) src/View/DynamicComponent.php (trailing_comma_in_multiline, unary_operator_spaces, not_operator_with_successor_space)
6) src/Providers/FilesystemServiceProvider.php (new_with_parentheses)
7) src/Providers/CollectionServiceProvider.php (new_with_parentheses)
8) src/Providers/CompatibilityServiceProvider.php (new_with_parentheses)
9) src/Providers/MarkdownServiceProvider.php (new_with_parentheses)
10) src/Providers/EventServiceProvider.php (new_with_parentheses)
11) src/Providers/ViewServiceProvider.php (new_with_parentheses)
12) src/Parsers/MarkdownParser.php (new_with_parentheses, nullable_type_declaration_for_default_null_value)
13) src/Parsers/CommonMarkParser.php (new_with_parentheses, trailing_comma_in_multiline)
14) src/Console/Command.php (type_declaration_spaces)
15) tests/EventsTest.php (new_with_parentheses)
16) tests/CollectionItemTest.php (array_indentation)
17) tests/Haiku.php (no_unused_imports)
18) tests/TestCase.php (new_with_parentheses, fully_qualified_strict_types, nullable_type_declaration_for_default_null_value, no_trailing_whitespace, braces_position, single_line_empty_body)
19) tests/JigsawMacroTest.php (new_with_parentheses)
20) tests/BladeComponentTest.php (array_indentation)
21) tests/FilePathTest.php (no_unused_imports)
22) tests/CommonMarkTest.php (new_with_parentheses)
23) tests/SnapshotsTest.php (new_with_parentheses, unary_operator_spaces, not_operator_with_successor_space)
24) stubs/site/bootstrap.php (fully_qualified_strict_types)
  • Loading branch information
github-actions[bot] committed Jun 25, 2024
1 parent e09c28e commit 0601261
Show file tree
Hide file tree
Showing 24 changed files with 56 additions and 58 deletions.
6 changes: 3 additions & 3 deletions src/Bootstrap/HandleExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private function handleError($level, $message, $file = '', $line = 0, $context =
/**
* Handle a deprecation.
*
* @throws \TightenCo\Jigsaw\Exceptions\DeprecationException
* @throws DeprecationException
*/
private function handleDeprecation(Throwable $e): void
{
Expand All @@ -123,7 +123,7 @@ private function handleDeprecation(Throwable $e): void
//
}

static::$app->make(ExceptionHandler::class)->renderForConsole(new ConsoleOutput, $e);
static::$app->make(ExceptionHandler::class)->renderForConsole(new ConsoleOutput(), $e);
}

/**
Expand All @@ -143,7 +143,7 @@ private function handleException(Throwable $e): void
//
}

static::$app->make(ExceptionHandler::class)->renderForConsole(new ConsoleOutput, $e);
static::$app->make(ExceptionHandler::class)->renderForConsole(new ConsoleOutput(), $e);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

abstract class Command extends SymfonyCommand
{
protected InputInterface $input;
protected InputInterface $input;
protected OutputInterface $output;
protected $console;

Expand Down
2 changes: 1 addition & 1 deletion src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private function loadEnvironmentVariables(): void
try {
Dotenv::create(Env::getRepository(), $this->path)->safeLoad();
} catch (InvalidFileException $e) {
$output = (new ConsoleOutput)->getErrorOutput();
$output = (new ConsoleOutput())->getErrorOutput();

$output->writeln('The environment file is invalid!');
$output->writeln($e->getMessage());
Expand Down
4 changes: 2 additions & 2 deletions src/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function renderForConsole($output, Throwable $e): void
}

if ($e instanceof SymfonyConsoleExceptionInterface) {
(new ConsoleApplication)->renderThrowable($e, $output);
(new ConsoleApplication())->renderThrowable($e, $output);

return;
}
Expand All @@ -79,7 +79,7 @@ public function renderForConsole($output, Throwable $e): void

$e = $this->mapException($e);

/** @var \NunoMaduro\Collision\Provider $provider */
/** @var Provider $provider */
$provider = app(Provider::class);

$handler = $provider->register()->getHandler()->setOutput($output);
Expand Down
12 changes: 6 additions & 6 deletions src/Parsers/CommonMarkParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ public function __construct()
{
$environment = new Environment(Arr::get(app('config'), 'commonmark.config', []));

$environment->addExtension(new CommonMarkCoreExtension);
$environment->addExtension(new CommonMarkCoreExtension());

collect(Arr::get(app('config'), 'commonmark.extensions', [
new AttributesExtension,
new SmartPunctExtension,
new StrikethroughExtension,
new TableExtension,
new AttributesExtension(),
new SmartPunctExtension(),
new StrikethroughExtension(),
new TableExtension(),
]))->map(fn ($extension) => $environment->addExtension($extension));

collect(
Arr::get(app('config'), 'commonmark.renderers')
Arr::get(app('config'), 'commonmark.renderers'),
)->map(fn ($renderer, $nodeClass) => $environment->addRenderer($nodeClass, $renderer));

$this->converter = new MarkdownConverter($environment);
Expand Down
4 changes: 2 additions & 2 deletions src/Parsers/MarkdownParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class MarkdownParser implements FrontYAMLMarkdownParserInterface
{
public $parser;

public function __construct(MarkdownParserContract $parser = null)
public function __construct(?MarkdownParserContract $parser = null)
{
$this->parser = $parser ?? new JigsawMarkdownParser;
$this->parser = $parser ?? new JigsawMarkdownParser();
}

public function __get($property)
Expand Down
4 changes: 2 additions & 2 deletions src/Providers/CollectionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CollectionServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->bind('outputPathResolver', fn () => new BasicOutputPathResolver);
$this->app->bind('outputPathResolver', fn () => new BasicOutputPathResolver());

$this->registerHandlers();
$this->registerPathResolver();
Expand Down Expand Up @@ -100,7 +100,7 @@ private function registerSiteBuilder(): void
$this->app->bind(SiteBuilder::class, function (Container $app) {
return new SiteBuilder($app['files'], $app->cachePath(), $app['outputPathResolver'], $app['consoleOutput'], [
$app[CollectionItemHandler::class],
new IgnoredHandler,
new IgnoredHandler(),
$app[PaginatedPageHandler::class],
$app[MarkdownHandler::class],
$app[BladeHandler::class],
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/CompatibilityServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public function register(): void
{
$this->app->instance('cwd', $this->app->path());

$this->app->singleton('consoleOutput', fn () => new ConsoleOutput);
$this->app->singleton('consoleOutput', fn () => new ConsoleOutput());
}
}
2 changes: 1 addition & 1 deletion src/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public function register(): void
{
$this->app->singleton('dispatcher', fn (Container $app) => new Dispatcher($app));

$this->app->singleton('events', fn (Container $app) => new EventBus);
$this->app->singleton('events', fn (Container $app) => new EventBus());
}
}
2 changes: 1 addition & 1 deletion src/Providers/FilesystemServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class FilesystemServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->singleton('files', fn () => new Filesystem);
$this->app->singleton('files', fn () => new Filesystem());
}
}
2 changes: 1 addition & 1 deletion src/Providers/MarkdownServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function register(): void
$this->app->bind(YAMLParser::class, SymfonyYAMLParser::class);

$this->app->bind(MarkdownParserContract::class, function (Container $app) {
return $app['config']->get('commonmark') ? new CommonMarkParser : new JigsawMarkdownParser;
return $app['config']->get('commonmark') ? new CommonMarkParser() : new JigsawMarkdownParser();
});

$this->app->singleton('markdownParser', fn (Container $app) => new MarkdownParser($app[MarkdownParserContract::class]));
Expand Down
4 changes: 2 additions & 2 deletions src/Providers/ViewServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function register(): void
$this->registerEngineResolvers();

(new BladeDirectivesFile($this->app->path('blade.php'), $this->app['blade.compiler']))->register();
$this->app->bind(ViewRenderer::class, fn () => new ViewRenderer);
$this->app->bind(ViewRenderer::class, fn () => new ViewRenderer());
$this->app->bind(TemporaryFilesystem::class, fn (Container $app) => new TemporaryFilesystem($app->cachePath()));

// TODO
Expand Down Expand Up @@ -74,7 +74,7 @@ private function registerBladeCompiler(): void
private function registerEngineResolvers(): void
{
$this->app->singleton('view.engine.resolver', function (Container $app) {
$resolver = new EngineResolver;
$resolver = new EngineResolver();
$compilerEngine = new CompilerEngine($app['blade.compiler'], $app['files']);

// Same as Laravel
Expand Down
6 changes: 3 additions & 3 deletions src/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
use Symfony\Component\VarDumper\VarDumper;

if (! function_exists('app')) {
function app(string $abstract = null, array $parameters = []): mixed
function app(?string $abstract = null, array $parameters = []): mixed
{
if (is_null($abstract)) {
return \TightenCo\Jigsaw\Container::getInstance();
return TightenCo\Jigsaw\Container::getInstance();
}

return \TightenCo\Jigsaw\Container::getInstance()->make($abstract, $parameters);
return TightenCo\Jigsaw\Container::getInstance()->make($abstract, $parameters);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/View/DynamicComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protected function compiler()
static::$compiler = new ComponentTagCompiler(
Container::getInstance()->make('blade.compiler')->getClassComponentAliases(),
Container::getInstance()->make('blade.compiler')->getClassComponentNamespaces(),
Container::getInstance()->make('blade.compiler')
Container::getInstance()->make('blade.compiler'),
);
}

Expand Down
4 changes: 2 additions & 2 deletions stubs/site/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use TightenCo\Jigsaw\Jigsaw;

/** @var \Illuminate\Container\Container $container */
/** @var \TightenCo\Jigsaw\Events\EventBus $events */
/** @var Illuminate\Container\Container $container */
/** @var TightenCo\Jigsaw\Events\EventBus $events */

/*
* You can run custom code at different stages of the build process by
Expand Down
10 changes: 5 additions & 5 deletions tests/BladeComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public function can_include_blade_component_with_at_syntax()
]),
'_components' => [
'alert.blade.php' => implode("\n", [
'<div>',
'<h3>This is the component</h3>',
'<h4>Named title slot: {{ $title }}</h4>',
'{{ $slot }}',
'</div>',
'<div>',
'<h3>This is the component</h3>',
'<h4>Named title slot: {{ $title }}</h4>',
'{{ $slot }}',
'</div>',
]),
],
]);
Expand Down
24 changes: 12 additions & 12 deletions tests/CollectionItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public function collection_item_contents_are_returned_when_item_is_referenced_as
public function collection_item_can_be_filtered()
{
$config = collect(['collections' => [
'collection' => [
'path' => 'collection/{filename}',
'filter' => function ($item) {
return $item->published;
},
],
'collection' => [
'path' => 'collection/{filename}',
'filter' => function ($item) {
return $item->published;
},
],
],
]);
$builtHeader = implode("\n", [
'---',
Expand Down Expand Up @@ -81,13 +81,13 @@ public function collection_item_can_be_filtered()
public function collection_item_can_be_mapped()
{
$config = collect(['collections' => [
'collection' => [
'path' => 'collection/{filename}',
'map' => function ($item) {
return MappedItem::fromItem($item);
},
],
'collection' => [
'path' => 'collection/{filename}',
'map' => function ($item) {
return MappedItem::fromItem($item);
},
],
],
]);
$itemHeader = implode("\n", [
'---',
Expand Down
4 changes: 2 additions & 2 deletions tests/CommonMarkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function replace_commonmark_extensions()
$this->buildSite($files, [
'commonmark' => [
'extensions' => [
new DescriptionListExtension,
new DescriptionListExtension(),
],
],
]);
Expand All @@ -75,7 +75,7 @@ public function override_parser_with_custom_class()
$files = $this->withContent('### Heading {.class}');

$this->app->bind(MarkdownParserContract::class, function () {
return new class implements MarkdownParserContract {
return new class() implements MarkdownParserContract {
public function parse(string $text)
{
return <<<EOT
Expand Down
2 changes: 1 addition & 1 deletion tests/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function multiple_event_listeners_are_fired_in_the_order_they_were_define
#[Test]
public function it_can_handle_invokable_listeners()
{
$this->app['events']->beforeBuild(new class {
$this->app['events']->beforeBuild(new class() {
private $object;

public function __construct()
Expand Down
1 change: 0 additions & 1 deletion tests/FilePathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Tests;

use PHPUnit\Framework\Attributes\Test;
use TightenCo\Jigsaw\IterableObject;
use TightenCo\Jigsaw\PageVariable;
use TightenCo\Jigsaw\PathResolvers\CollectionPathResolver;
Expand Down
1 change: 0 additions & 1 deletion tests/Haiku.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use PHPUnit\Framework\Attributes\Test;

trait Haiku
{
Expand Down
2 changes: 1 addition & 1 deletion tests/JigsawMacroTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function jigsaw_macro_function_calls_successfully()
#[Test]
public function jigsaw_mixin_function_calls_successfully()
{
Jigsaw::mixin(new JigsawMixinTestClass);
Jigsaw::mixin(new JigsawMixinTestClass());

$this->assertSame('Reed', Jigsaw::getNameMixin());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/SnapshotsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function setUp(): void
{
parent::setUp();

$this->filesystem = new Filesystem;
$this->filesystem = new Filesystem();
}

public static function snapshots(): array
Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class TestCase extends PHPUnit
protected Filesystem $filesystem;
protected string $tmp;

public function __construct($name = null, array $data = [], $dataName = '')
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);

$this->filesystem = new Filesystem;
$this->filesystem = new Filesystem();
}

protected function setUp(): void
Expand All @@ -39,15 +39,15 @@ protected function setUp(): void

$this->createTmp();

$this->app = new Container;
$this->app = new Container();
/* @internal The '__testing' binding is for Jigsaw development only and may be removed. */
$this->app->instance('__testing', true);
$this->app->singleton(
\Illuminate\Contracts\Debug\ExceptionHandler::class,
\TightenCo\Jigsaw\Exceptions\Handler::class,
);
$this->app->bootstrapWith([
\TightenCo\Jigsaw\Bootstrap\HandleExceptions::class,
HandleExceptions::class,
]);

$this->app->buildPath = [
Expand Down Expand Up @@ -209,7 +209,7 @@ protected function fixDirectorySlashes(string $path): string
return str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);
}

protected function assertOutputFile(string $path, string $contents, string $message = null): void
protected function assertOutputFile(string $path, string $contents, ?string $message = null): void
{
static::assertStringEqualsFile(
$this->tmpPath($path),
Expand Down

0 comments on commit 0601261

Please sign in to comment.