Skip to content

Commit

Permalink
Adds type checking (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro authored Feb 24, 2023
1 parent 61f3113 commit e368b4c
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
/.github export-ignore
/.gitignore export-ignore
/.styleci.yml export-ignore
phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
41 changes: 41 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: static analysis

on:
push:
branches:
- master
- '*.x'
pull_request:

permissions:
contents: read

jobs:
tests:
runs-on: ubuntu-22.04

strategy:
fail-fast: true

name: Static Analysis

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
coverage: none

- name: Install dependencies
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Execute type checking
run: vendor/bin/phpstan
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"vlucas/phpdotenv": "^3.0|^4.0|^5.0"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^8.0|^9.0"
},
"autoload": {
Expand Down
8 changes: 8 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
parameters:
paths:
- src

level: 0

ignoreErrors:
- "#\\(void\\) is used.#"
2 changes: 1 addition & 1 deletion src/Commands/DatabaseRestoreCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function handle()
/**
* Determine which timezone the time will be specified in.
*
* @return string
* @return string|never
*/
protected function determineTimezone()
{
Expand Down
8 changes: 4 additions & 4 deletions src/Commands/LoginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public function handle()
*/
protected function attemptLogin()
{
$email = Helpers::ask('Email Address');
$password = Helpers::secret('Password');

try {
$token = $this->vapor->login(
$email = Helpers::ask('Email Address'),
$password = Helpers::secret('Password')
);
$token = $this->vapor->login($email, $password);
} catch (NeedsTwoFactorAuthenticationTokenException $e) {
$token = $this->vapor->login(
$email,
Expand Down
2 changes: 1 addition & 1 deletion src/ConsoleVaporClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ public function pendingCertificates()
* @param string $domain
* @param array $alternativeNames
* @param string $validationMethod
* @return array
* @return void
*/
public function requestCertificate($providerId, $domain, array $alternativeNames, $region, $validationMethod)
{
Expand Down
10 changes: 0 additions & 10 deletions src/DatabaseInstanceClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@

class DatabaseInstanceClasses
{
/**
* Get the available RDS instance classes.
*
* @return array
*/
public static function keys()
{
return array_keys(static::available());
}

/**
* Get the available general purpose RDS instance classes.
*
Expand Down
4 changes: 2 additions & 2 deletions src/Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Git
/**
* Get the Git current commit hash for the project.
*
* @return string
* @return string|null
*/
public static function hash()
{
Expand All @@ -21,7 +21,7 @@ public static function hash()
/**
* Get the Git current commit message for the project.
*
* @return string
* @return string|null
*/
public static function message()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Helpers
* Display a danger message and exit.
*
* @param string $text
* @return void
* @return never
*/
public static function abort($text)
{
Expand Down

0 comments on commit e368b4c

Please sign in to comment.