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

Update to latest PHP 8.1 syntax #123

Closed
wants to merge 2 commits into from
Closed
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 src/ConsoleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ConsoleHelper
/** @var resource Exists only for testing. */
private $stderr = STDERR;

private bool $supportsColor;
private readonly bool $supportsColor;

/**
* @param resource $resource
Expand Down
2 changes: 1 addition & 1 deletion test/FastPriorityQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class FastPriorityQueueTest extends TestCase
{
/** @var FastPriorityQueue<string> */
private FastPriorityQueue $queue;
private readonly FastPriorityQueue $queue;

/** @var string[] */
private array $expected;
Expand All @@ -30,7 +30,7 @@
protected function setUp(): void
{
/** @psalm-var FastPriorityQueue<string> $this->queue */
$this->queue = new FastPriorityQueue();

Check failure on line 33 in test/FastPriorityQueueTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (Psalm [8.1, locked], ubuntu-latest, laminas/laminas-continuous-integration-action@v1, ...

InaccessibleProperty

test/FastPriorityQueueTest.php:33:9: InaccessibleProperty: LaminasTest\Stdlib\FastPriorityQueueTest::$queue is marked readonly (see https://psalm.dev/054)
$this->insertDataQueue($this->queue);
$this->expected = [
'test1',
Expand Down
2 changes: 1 addition & 1 deletion test/PriorityQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
class PriorityQueueTest extends TestCase
{
/** @var PriorityQueue<string, int> */
private PriorityQueue $queue;
private readonly PriorityQueue $queue;

protected function setUp(): void
{
/** @psalm-var PriorityQueue<string, int> $this->queue */
$this->queue = new PriorityQueue();

Check failure on line 28 in test/PriorityQueueTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (Psalm [8.1, locked], ubuntu-latest, laminas/laminas-continuous-integration-action@v1, ...

InaccessibleProperty

test/PriorityQueueTest.php:28:9: InaccessibleProperty: LaminasTest\Stdlib\PriorityQueueTest::$queue is marked readonly (see https://psalm.dev/054)
$this->queue->insert('foo', 3);
$this->queue->insert('bar', 4);
$this->queue->insert('baz', 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class PriorityQueueGenericsCanBeUnderstood
/**
* @param PriorityQueue<string, int> $laminas
*/
public function __construct(private PriorityQueue $laminas)
public function __construct(private readonly PriorityQueue $laminas)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class SplPriorityQueueGenericsCanBeUnderstood
/**
* @param SplPriorityQueue<string, int> $laminas
*/
public function __construct(private SplPriorityQueue $laminas)
public function __construct(private readonly SplPriorityQueue $laminas)
{
}

Expand Down