Skip to content

ref(util): Narrow RingBuffer count type to drop PHPStan baseline entry - #2331

Open
sentry-junior[bot] wants to merge 1 commit into
masterfrom
chore/phpstan-baseline-ringbuffer-count
Open

sentry-junior[bot] wants to merge 1 commit into
masterfrom
chore/phpstan-baseline-ringbuffer-count

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Removes this entry from phpstan-baseline.neon:

Method Sentry\Util\RingBuffer::count() should return int<0, max> but returns int. (return.type, src/Util/RingBuffer.php)

RingBuffer implements \Countable, whose count() PHPStan types as int<0, max>. The private $count property was documented as plain int, so the return didn't match. This narrows its @var to int<0, max>. That's accurate, since $count starts at 0, only goes up while below capacity, and is only decremented after an === 0 guard. PHPStan agrees and reports no new errors.

This only changes a docblock on a private property, so there's no runtime or public API change. PHPStan and Mago results are otherwise unchanged, and RingBufferTest passes.

via automation sched_f05c2f3e9355ecbdd933cf87d44ec5c6 · Run ID sched_f05c2f3e9355ecbdd933cf87d44ec5c6:1794042000000.

--

View Session [Sentry]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant