Skip to content

Commit

Permalink
style: don't use space after ! operator
Browse files Browse the repository at this point in the history
  • Loading branch information
innocenzi committed Feb 2, 2022
1 parent 583dd4a commit 0c76291
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'single_trait_insert_per_statement' => true,
'explicit_string_variable' => true,
'single_line_throw' => false,
'not_operator_with_successor_space' => true,
'not_operator_with_successor_space' => false,
'trailing_comma_in_multiline' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
Expand Down
20 changes: 10 additions & 10 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(
protected ?HeartbeatChecker $heartbeatChecker = null,
protected ?TagGenerator $tagGenerator = null,
) {
if (! config()->has("vite.configs.${name}")) {
if (!config()->has("vite.configs.${name}")) {
throw new NoSuchConfigurationException($name);
}

Expand All @@ -33,7 +33,7 @@ public function __construct(
*/
public function getManifest(): ?Manifest
{
if (! $this->config('build_path')) {
if (!$this->config('build_path')) {
throw new NoBuildPathException($this->name);
}

Expand Down Expand Up @@ -82,7 +82,7 @@ public function getTags(): string
{
$tags = collect();

if (! $this->shouldUseManifest()) {
if (!$this->shouldUseManifest()) {
$tags->push($this->getClientScriptTag());
}

Expand Down Expand Up @@ -167,7 +167,7 @@ public function usesManifest(): bool
*/
public function usesServer(): bool
{
return ! $this->usesManifest();
return !$this->usesManifest();
}

/**
Expand All @@ -191,35 +191,35 @@ protected function shouldUseManifest(): bool
$result = \call_user_func(Vite::$useManifestCallback, $this);

// Only override if the result is a boolean.
if (! \is_null($result)) {
if (!\is_null($result)) {
return $result;
}
}

// If the development server is disabled, use the manifest.
if (! $this->config('dev_server.enabled', true)) {
if (!$this->config('dev_server.enabled', true)) {
return true;
}

// If disabled in tests via the configuration, do not use the manifest.
if (app()->environment('testing') && ! config('vite.testing.use_manifest', false)) {
if (app()->environment('testing') && !config('vite.testing.use_manifest', false)) {
return false;
}

// If running in production, do use the manifest.
if (! app()->environment('local')) {
if (!app()->environment('local')) {
return true;
}

// At this point, environment checks have passed, so we're likely to not
// use the manifest. If the ping is disabled, do not use the manifest.
if (! $this->config('dev_server.ping_before_using_manifest', true)) {
if (!$this->config('dev_server.ping_before_using_manifest', true)) {
return false;
}

// If we wanted to check if the dev server was running but it
// is not, actually use the manifest.
if (! $this->isDevelopmentServerRunning()) {
if (!$this->isDevelopmentServerRunning()) {
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions src/EntrypointsFinder/DefaultEntrypointsFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public function find(string|array $paths, string|array $ignore): Collection
{
return collect($paths)
->flatMap(function (string $fileOrDirectory) {
if (! file_exists($fileOrDirectory)) {
if (!file_exists($fileOrDirectory)) {
$fileOrDirectory = base_path($fileOrDirectory);
}

if (! file_exists($fileOrDirectory)) {
if (!file_exists($fileOrDirectory)) {
return [];
}

Expand All @@ -27,7 +27,7 @@ public function find(string|array $paths, string|array $ignore): Collection
})
->unique(fn (\SplFileInfo $file) => $file->getPathname())
->filter(function (\SplFileInfo $file) use ($ignore) {
return ! collect($ignore)->some(fn ($pattern) => preg_match($pattern, $file->getFilename()));
return !collect($ignore)->some(fn ($pattern) => preg_match($pattern, $file->getFilename()));
});
}
}
4 changes: 2 additions & 2 deletions src/Manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class Manifest implements Stringable
*/
public function __construct(protected string|null $path)
{
if (! $path || ! file_exists($path)) {
if (!$path || !file_exists($path)) {
throw new ManifestNotFoundException($path, static::guessConfigName($path));
}

Expand Down Expand Up @@ -51,7 +51,7 @@ public function getPath(): string
*/
public function getEntry(string $name): Chunk
{
if (! $entry = $this->entries->first(fn (Chunk $entry) => str_contains($entry->src, $name))) {
if (!$entry = $this->entries->first(fn (Chunk $entry) => str_contains($entry->src, $name))) {
throw new NoSuchEntrypointException($name, static::guessConfigName($this->getPath()));
}

Expand Down
2 changes: 1 addition & 1 deletion src/TagGenerators/DefaultTagGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function makeStyleTag(string $url, Chunk $chunk = null): string

protected function processIntegrity(Chunk $chunk = null): string
{
if (! $chunk?->integrity) {
if (!$chunk?->integrity) {
return '';
}

Expand Down
2 changes: 1 addition & 1 deletion src/ViteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected function registerDirectives()
$compiler->directive('tag', function ($expression = null) {
$args = collect(explode(',', $expression))->map(fn ($str) => trim($str));

if (! \in_array(\count($args), [1, 2])) {
if (!\in_array(\count($args), [1, 2])) {
throw new InvalidArgumentException('The @tag directive accepts one or two arguments, ' . \count($args) . ' given.');
}

Expand Down
12 changes: 6 additions & 6 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Innocenzi\Vite\Configuration;
use Innocenzi\Vite\Vite;

if (! function_exists('vite')) {
if (!function_exists('vite')) {
/**
* Gets the given Vite configuration instance or the default one.
*/
Expand All @@ -13,7 +13,7 @@ function vite(string $config = null): Configuration
}
}

if (! function_exists('vite_client')) {
if (!function_exists('vite_client')) {
/**
* Get the HTML script tag that includes the Vite client.
*/
Expand All @@ -23,7 +23,7 @@ function vite_client(string $configurationName = null)
}
}

if (! function_exists('vite_react_refresh_runtime')) {
if (!function_exists('vite_react_refresh_runtime')) {
/**
* Get the HTML script tag that includes the React Refresh runtime.
*/
Expand All @@ -33,7 +33,7 @@ function vite_react_refresh_runtime(string $configurationName = null)
}
}

if (! function_exists('vite_tag')) {
if (!function_exists('vite_tag')) {
/**
* Get the HTML tags which path name include the given entry name.
*/
Expand All @@ -43,7 +43,7 @@ function vite_tag(string $entry, string $configurationName = null)
}
}

if (! function_exists('vite_tags')) {
if (!function_exists('vite_tags')) {
/**
* Get the HTML tags for the Vite client and every configured entrypoint.
*/
Expand All @@ -53,7 +53,7 @@ function vite_tags(string $configurationName = null)
}
}

if (! function_exists('vite_asset')) {
if (!function_exists('vite_asset')) {
/**
* Gets a valid URL for the given asset path.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function set_vite_config(string $name, array $config): void
*/
function with_dev_server(bool $reacheable = true)
{
if (! $reacheable) {
if (!$reacheable) {
return Http::fake(fn () => Http::response(status: 503));
}

Expand Down

0 comments on commit 0c76291

Please # to comment.