Skip to content

Commit

Permalink
Bump to PHP 8.1 and add missing return types
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Oct 1, 2024
1 parent 5c569ce commit ad3f07a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": ">=7.1",
"php": ">=8.1",
"composer-plugin-api": "^1.0|^2.0"
},
"autoload": {
Expand All @@ -20,7 +20,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "1.3-dev"
"dev-main": "1.4-dev"
},
"class": "Symfony\\Thanks\\Thanks"
}
Expand Down
4 changes: 2 additions & 2 deletions src/Command/FundCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FundCommand extends BaseCommand
private $love = '💖 ';
private $cash = '💵 ';

protected function configure()
protected function configure(): void
{
if ('Hyper' === getenv('TERM_PROGRAM')) {
$this->star = '';
Expand All @@ -41,7 +41,7 @@ protected function configure()
;
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$composer = $this->getComposer();
$gitHub = new GitHubClient($composer, $this->getIO());
Expand Down
4 changes: 2 additions & 2 deletions src/Command/ThanksCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ThanksCommand extends BaseCommand
private $love = '💖 ';
private $cash = '💵 ';

protected function configure()
protected function configure(): void
{
if ('Hyper' === getenv('TERM_PROGRAM')) {
$this->star = '';
Expand All @@ -44,7 +44,7 @@ protected function configure()
;
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$composer = $this->getComposer();
$gitHub = new GitHubClient($composer, $this->getIO());
Expand Down
6 changes: 3 additions & 3 deletions src/GitHubClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function __construct(Composer $composer, IOInterface $io)
}
}

public function getRepositories(?array &$failures = null, $withFundingLinks = false)
public function getRepositories(?array &$failures = null, $withFundingLinks = false): array
{
$repo = $this->composer->getRepositoryManager()->getLocalRepository();

Expand Down Expand Up @@ -179,7 +179,7 @@ public function getRepositories(?array &$failures = null, $withFundingLinks = fa
return $repos;
}

public function call($graphql, array &$failures = [])
public function call($graphql, array &$failures = []): mixed
{
$options = [
'http' => [
Expand Down Expand Up @@ -218,7 +218,7 @@ public function call($graphql, array &$failures = [])
return isset($result['data']) ? $result['data'] : [];
}

private function getDirectlyRequiredPackageNames()
private function getDirectlyRequiredPackageNames(): array
{
$file = new JsonFile(Factory::getComposerFile(), null, $this->io);

Expand Down
12 changes: 6 additions & 6 deletions src/Thanks.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Thanks implements EventSubscriberInterface, PluginInterface
private $io;
private $displayReminder = 0;

public function activate(Composer $composer, IOInterface $io)
public function activate(Composer $composer, IOInterface $io): void
{
$this->io = $io;

Expand Down Expand Up @@ -65,14 +65,14 @@ public function activate(Composer $composer, IOInterface $io)
}
}

public function enableReminder()
public function enableReminder(): void
{
if (1 === $this->displayReminder) {
$this->displayReminder = version_compare('1.1.0', PluginInterface::PLUGIN_API_VERSION, '<=') ? 2 : 0;
}
}

public function displayReminder(ScriptEvent $event)
public function displayReminder(ScriptEvent $event): void
{
if (2 !== $this->displayReminder) {
return;
Expand Down Expand Up @@ -108,7 +108,7 @@ public function displayReminder(ScriptEvent $event)
$this->io->writeError('');
}

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
PackageEvents::POST_PACKAGE_UPDATE => 'enableReminder',
Expand All @@ -119,14 +119,14 @@ public static function getSubscribedEvents()
/**
* {@inheritdoc}
*/
public function deactivate(Composer $composer, IOInterface $io)
public function deactivate(Composer $composer, IOInterface $io): void
{
}

/**
* {@inheritdoc}
*/
public function uninstall(Composer $composer, IOInterface $io)
public function uninstall(Composer $composer, IOInterface $io): void
{
}
}

0 comments on commit ad3f07a

Please sign in to comment.