diff --git a/src/Database/Model.php b/src/Database/Model.php index 45031b2cb..d03442c5e 100644 --- a/src/Database/Model.php +++ b/src/Database/Model.php @@ -31,9 +31,9 @@ class Model extends EloquentModel implements ModelInterface use \Winter\Storm\Database\Traits\DeferredBinding; /** - * @var array Behaviors implemented by this model. + * @var string|array|null Extensions implemented by this class. */ - public $implement; + public $implement = null; /** * @var array Make the model's attributes public so behaviors can modify them. diff --git a/src/Database/Traits/Validation.php b/src/Database/Traits/Validation.php index 94dca33d1..a4f68504b 100644 --- a/src/Database/Traits/Validation.php +++ b/src/Database/Traits/Validation.php @@ -132,10 +132,13 @@ protected function getRelationValidationValue($relationName) * Instantiates the validator used by the validation process, depending if the class * is being used inside or outside of Laravel. Optional connection string to make * the validator use a different database connection than the default connection. - * @return \Illuminate\Validation\Validator + * + * @return \Illuminate\Contracts\Validation\Validator + * @phpstan-return \Illuminate\Validation\Validator */ protected static function makeValidator($data, $rules, $customMessages, $attributeNames, $connection = null) { + /** @var \Illuminate\Validation\Validator $validator */ $validator = Validator::make($data, $rules, $customMessages, $attributeNames); if ($connection !== null) { diff --git a/src/Extension/Extendable.php b/src/Extension/Extendable.php index 7d890e327..0ff0ffa89 100644 --- a/src/Extension/Extendable.php +++ b/src/Extension/Extendable.php @@ -18,9 +18,9 @@ class Extendable use ExtendableTrait; /** - * @var array Extensions implemented by this class. + * @var string|array|null Extensions implemented by this class. */ - public $implement; + public $implement = null; /** * Constructor diff --git a/src/Extension/ExtendableTrait.php b/src/Extension/ExtendableTrait.php index 4c1252df4..84f19847f 100644 --- a/src/Extension/ExtendableTrait.php +++ b/src/Extension/ExtendableTrait.php @@ -16,7 +16,6 @@ * * @author Alexey Bobkov, Samuel Georges */ - trait ExtendableTrait { /** @@ -72,18 +71,12 @@ public function extendableConstruct() /* * Apply extensions */ - if (!$this->implement) { - return; - } - if (is_string($this->implement)) { $uses = explode(',', $this->implement); - } - elseif (is_array($this->implement)) { + } elseif (is_array($this->implement)) { $uses = $this->implement; - } - else { - throw new Exception(sprintf('Class %s contains an invalid $implement value', get_class($this))); + } else { + return; } foreach ($uses as $use) { diff --git a/src/Foundation/Http/Kernel.php b/src/Foundation/Http/Kernel.php index 3d3e5bd24..1c4218cfc 100644 --- a/src/Foundation/Http/Kernel.php +++ b/src/Foundation/Http/Kernel.php @@ -5,9 +5,7 @@ class Kernel extends HttpKernel { /** - * The bootstrap classes for the application. - * - * @var string[] + * {@inheritDoc} */ protected $bootstrappers = [ \Winter\Storm\Foundation\Bootstrap\RegisterClassLoader::class, @@ -22,9 +20,7 @@ class Kernel extends HttpKernel ]; /** - * The application's global HTTP middleware stack. - * - * @var array + * {@inheritDoc} */ protected $middleware = [ \Winter\Storm\Foundation\Http\Middleware\CheckForTrustedHost::class, @@ -33,9 +29,7 @@ class Kernel extends HttpKernel ]; /** - * The application's route middleware. - * - * @var array + * {@inheritDoc} */ protected $routeMiddleware = [ // 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, @@ -47,9 +41,7 @@ class Kernel extends HttpKernel ]; /** - * The application's route middleware groups. - * - * @var array + * {@inheritDoc} */ protected $middlewareGroups = [ 'web' => [ @@ -67,11 +59,7 @@ class Kernel extends HttpKernel ]; /** - * The priority-sorted list of middleware. - * - * Forces the listed middleware to always be in the given order. - * - * @var string[] + * {@inheritDoc} */ protected $middlewarePriority = [ \Illuminate\Session\Middleware\StartSession::class, diff --git a/src/Network/Http.php b/src/Network/Http.php index 011967fa3..fc9c4943e 100644 --- a/src/Network/Http.php +++ b/src/Network/Http.php @@ -111,7 +111,7 @@ class Http /** * @var array cURL Options. */ - public $requestOptions; + public $requestOptions = []; /** * @var array Request data. @@ -280,7 +280,7 @@ public function send() curl_setopt($curl, CURLOPT_MAXREDIRS, $this->maxRedirects); } - if ($this->requestOptions && is_array($this->requestOptions)) { + if (count($this->requestOptions)) { curl_setopt_array($curl, $this->requestOptions); } diff --git a/src/Support/Facades/DB.php b/src/Support/Facades/DB.php index f5738678c..d2c0bb8bf 100644 --- a/src/Support/Facades/DB.php +++ b/src/Support/Facades/DB.php @@ -4,7 +4,7 @@ /** * @method static \Doctrine\DBAL\Driver\PDOConnection getPdo() - * @method static \Illuminate\Database\ConnectionInterface connection(string $name = null) + * @method static \Illuminate\Database\Connection connection(string $name = null) * @method static \Winter\Storm\Database\QueryBuilder table(string $table, string $as = null) * @method static \Illuminate\Database\Query\Expression raw($value) * @method static array getQueryLog() diff --git a/src/Support/Facades/File.php b/src/Support/Facades/File.php index eeb25eb73..4442c87f1 100644 --- a/src/Support/Facades/File.php +++ b/src/Support/Facades/File.php @@ -4,7 +4,7 @@ /** * @method static bool exists(string $path) - * @method static string get(string $path, bool $lock) + * @method static string get(string $path, bool $lock = false) * @method static string sharedGet(string $path) * @method static mixed getRequire(string $path) * @method static mixed requireOnce(string $file) diff --git a/src/Support/helpers.php b/src/Support/helpers.php index 6863d796f..aa95f4af2 100644 --- a/src/Support/helpers.php +++ b/src/Support/helpers.php @@ -35,7 +35,9 @@ function e($value, $doubleEncode = false) */ function trans($id = null, $parameters = [], $locale = null) { - return app('translator')->trans($id, $parameters, $locale); + /** @var \Winter\Storm\Translation\Translator $translator */ + $translator = app('translator'); + return $translator->trans($id, $parameters, $locale); } }