Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed workflow deprecation #32

Merged
merged 1 commit into from
Jan 17, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '7.2', '7.3', '7.4', '8.0' ]
php-versions: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
steps:
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"require-dev": {
"phpunit/phpunit": "^8.5",
"phpstan/phpstan": "^0.12.3"
"phpstan/phpstan": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Command/SearchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in
private function searchForPackage(): PackageInterface
{
$searchedPackage = $this->io->ask('What package do you want to lookup ? (TIP: you could also enter a part of a package name)');
assert(is_string($searchedPackage));
$suggestedPackages = $this->suggestPackages((string)$searchedPackage);

if ($suggestedPackages->isEmpty()) {
Expand All @@ -59,6 +60,7 @@ private function searchForPackage(): PackageInterface
));

$choice = $this->io->choice('What package would you like to view ?', $options);
assert(is_string($choice));

if (null !== $choice && 'Search again' !== $choice) {
return $this->graph->getPackage($choice);
Expand Down
21 changes: 17 additions & 4 deletions src/Composer/PackageDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function __construct(array $definition, string $source)
public static function createFromFile(SplFileInfo $file): self
{
$definition = json_decode($file->getContents(), true);
assert(is_array($definition));

return new PackageDefinition($definition, $file->getPath());
}
Expand All @@ -56,30 +57,42 @@ public function getPackageDirectory(): string
*/
public function getAuthors(): array
{
return $this->definition['authors'] ?? [];
$authors = $this->definition['authors'] ?? [];
assert(is_array($authors));

return $authors;
}

/**
* @return array<string, string>
*/
public function getDependencies(): array
{
return $this->definition['require'] ?? [];
$dependencies = $this->definition['require'] ?? [];
assert(is_array($dependencies));

return $dependencies;
}

/**
* @return array<string, string>
*/
public function getDevDependencies(): array
{
return $this->definition['require-dev'] ?? [];
$dependencies = $this->definition['require-dev'] ?? [];
assert(is_array($dependencies));

return $dependencies;
}

/**
* @return array<string, string>
*/
public function getReplaces(): array
{
return $this->definition['replace'] ?? [];
$replace = $this->definition['replace'] ?? [];
assert(is_array($replace));

return $replace;
}
}
2 changes: 1 addition & 1 deletion tests/Author/AuthorCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Nusje2000\DependencyGraph\Author\Author;
use Nusje2000\DependencyGraph\Author\AuthorCollection;
use Nusje2000\DependencyGraph\Exception\AuthorException;
use PHPStan\Testing\TestCase;
use PHPUnit\Framework\TestCase;

final class AuthorCollectionTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Composer/PackageDefinitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Nusje2000\DependencyGraph\Composer\PackageDefinition;
use Nusje2000\DependencyGraph\Exception\DefinitionException;
use PHPStan\Testing\TestCase;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Finder\SplFileInfo;

final class PackageDefinitionTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Replace/ReplaceCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Nusje2000\DependencyGraph\Exception\ReplaceException;
use Nusje2000\DependencyGraph\Replace\Replace;
use Nusje2000\DependencyGraph\Replace\ReplaceCollection;
use PHPStan\Testing\TestCase;
use PHPUnit\Framework\TestCase;

final class ReplaceCollectionTest extends TestCase
{
Expand Down