Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 8
level: 9
paths:
- src/
- tests/
Expand Down
8 changes: 7 additions & 1 deletion src/Auth/TokenSources/CLITokenSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ public function __construct(string $filename, array $scopes = [])
protected function parseFile(string $filename): void
{
$object = Yaml::parseFile($filename);
assert(is_array($object));

$token = $object['oauth_token'];
assert(is_array($token));

assert(is_string($token['accesstoken']));
$this->accessToken = $token['accesstoken'];
$this->refreshToken = $token['refreshtoken'] ?? null;

Expand Down Expand Up @@ -136,7 +139,10 @@ public static function getFileLocation(): string
return getenv('CBWS_CONFIG_FILE');
}

return $_SERVER['HOME'].DIRECTORY_SEPARATOR.'.cbws.yaml';
$home = $_SERVER['HOME'];
assert(is_string($home));

return $home.DIRECTORY_SEPARATOR.'.cbws.yaml';
}

public function getProject(): ?string
Expand Down
5 changes: 4 additions & 1 deletion src/Auth/TokenSources/ServiceAccountTokenSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ public function token(): AccessTokenInterface
*/
public static function getFileLocation(): string
{
return $_SERVER['HOME'].DIRECTORY_SEPARATOR.'.config'.DIRECTORY_SEPARATOR.'cbws'.DIRECTORY_SEPARATOR.'cbws.json';
$home = $_SERVER['HOME'];
assert(is_string($home));

return $home.DIRECTORY_SEPARATOR.'.config'.DIRECTORY_SEPARATOR.'cbws'.DIRECTORY_SEPARATOR.'cbws.json';
}

public function getProject(): ?string
Expand Down
3 changes: 2 additions & 1 deletion src/Common/ReadMaskTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
trait ReadMaskTrait
{
/**
* @return string[]
* @return array<string>
*/
public function getFields(): array
{
if ($this->object->getReadMask() === null) {
return [];
}

/** @phpstan-var array<string> */
return iterator_to_array($this->object->getReadMask()->getPaths());
}

Expand Down
2 changes: 2 additions & 0 deletions src/Compute/Machines.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public function list(ListMachinesRequest $request = new ListMachinesRequest()):
/**
* @yield Machine
*
* @return Generator<Machine>
*
* @throws StatusException
*/
public function paginate(ListMachinesRequest $request = new ListMachinesRequest()): Generator
Expand Down