diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index da9901bdc..c7f3179d0 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -34,7 +34,7 @@ jobs: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ matrix.php }} - - name: Install composer dependencies & Test + - name: Install composer dependencies run: composer install --prefer-dist --no-interaction --ansi - name: Run PHPStan diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 7cb1307a1..6c3333502 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -45,7 +45,7 @@ jobs: mysql -uroot -proot -e "GRANT ALL ON \`bookstack-test\`.* TO 'bookstack-test'@'localhost';" mysql -uroot -proot -e 'FLUSH PRIVILEGES;' - - name: Install composer dependencies & Test + - name: Install composer dependencies run: composer install --prefer-dist --no-interaction --ansi - name: Migrate and seed the database diff --git a/app/Api/ApiDocsGenerator.php b/app/Api/ApiDocsGenerator.php index 0447cd731..d130304de 100644 --- a/app/Api/ApiDocsGenerator.php +++ b/app/Api/ApiDocsGenerator.php @@ -28,7 +28,7 @@ class ApiDocsGenerator if (Cache::has($cacheKey) && config('app.env') === 'production') { $docs = Cache::get($cacheKey); } else { - $docs = (new ApiDocsGenerator)->generate(); + $docs = (new ApiDocsGenerator())->generate(); Cache::put($cacheKey, $docs, 60 * 24); } diff --git a/app/Config/broadcasting.php b/app/Config/broadcasting.php index 09189bb09..5e929d373 100644 --- a/app/Config/broadcasting.php +++ b/app/Config/broadcasting.php @@ -48,4 +48,4 @@ return [ ], -]; \ No newline at end of file +]; diff --git a/app/Config/cache.php b/app/Config/cache.php index ded1dcae6..86297b236 100644 --- a/app/Config/cache.php +++ b/app/Config/cache.php @@ -58,10 +58,10 @@ return [ 'memcached' => [ 'driver' => 'memcached', - 'options' => [ + 'options' => [ // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], - 'servers' => $memcachedServers ?? [], + 'servers' => $memcachedServers ?? [], ], 'redis' => [ diff --git a/app/Console/Commands/CreateAdmin.php b/app/Console/Commands/CreateAdmin.php index b421c3add..149444420 100644 --- a/app/Console/Commands/CreateAdmin.php +++ b/app/Console/Commands/CreateAdmin.php @@ -51,11 +51,13 @@ class CreateAdmin extends Command } if (mb_strlen($email) < 5 || !filter_var($email, FILTER_VALIDATE_EMAIL)) { $this->error('Invalid email address provided'); + return SymfonyCommand::FAILURE; } if ($this->userRepo->getByEmail($email) !== null) { $this->error('A user with the provided email already exists!'); + return SymfonyCommand::FAILURE; } @@ -65,6 +67,7 @@ class CreateAdmin extends Command } if (mb_strlen($name) < 2) { $this->error('Invalid name provided'); + return SymfonyCommand::FAILURE; } @@ -74,6 +77,7 @@ class CreateAdmin extends Command } if (mb_strlen($password) < 5) { $this->error('Invalid password provided, Must be at least 5 characters'); + return SymfonyCommand::FAILURE; } @@ -84,6 +88,7 @@ class CreateAdmin extends Command $user->save(); $this->info("Admin account with email \"{$user->email}\" successfully created!"); + return SymfonyCommand::SUCCESS; } } diff --git a/app/Entities/Tools/SearchOptions.php b/app/Entities/Tools/SearchOptions.php index 216f79b9c..39074fb38 100644 --- a/app/Entities/Tools/SearchOptions.php +++ b/app/Entities/Tools/SearchOptions.php @@ -32,7 +32,7 @@ class SearchOptions public static function fromString(string $search): self { $decoded = static::decode($search); - $instance = new SearchOptions; + $instance = new SearchOptions(); foreach ($decoded as $type => $value) { $instance->$type = $value; } @@ -55,7 +55,7 @@ class SearchOptions return static::fromString($request->get('term')); } - $instance = new SearchOptions; + $instance = new SearchOptions(); $inputs = $request->only(['search', 'types', 'filters', 'exact', 'tags']); $instance->searches = explode(' ', $inputs['search'] ?? []); $instance->exacts = array_filter($inputs['exact'] ?? []); diff --git a/readme.md b/readme.md index 92bbe2c5c..2f88be96a 100644 --- a/readme.md +++ b/readme.md @@ -217,4 +217,5 @@ These are the great open-source projects used to help build BookStack: * [pragmarx/google2fa](https://github.com/antonioribeiro/google2fa) * [Bacon/BaconQrCode](https://github.com/Bacon/BaconQrCode) * [phpseclib](https://github.com/phpseclib/phpseclib) -* [Clockwork](https://github.com/itsgoingd/clockwork) \ No newline at end of file +* [Clockwork](https://github.com/itsgoingd/clockwork) +* [PHPStan](https://phpstan.org/) & [Larastan](https://github.com/nunomaduro/larastan) \ No newline at end of file