diff --git a/CHANGELOG.md b/CHANGELOG.md index ba74cfa56..74a577d09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,9 @@ Please also have a look at our ### Removed +- Remove `getLineNo()` from these classes (use `getLineNumber()` instead): + `Comment`, `CSSList`, `SourceException`, `Charset`, `CSSNamespace`, `Import`, + `Rule`, `DeclarationBlock`, `RuleSet`, `CSSFunction`, `Value` (#1258) - Remove `Rule::getColNo()` (use `getColumnNumber()` instead) (#1287) - Passing a string as the first argument to `getAllValues()` is no longer supported and will not work; diff --git a/src/Position/Position.php b/src/Position/Position.php index 12afc5e10..7b75f8eac 100644 --- a/src/Position/Position.php +++ b/src/Position/Position.php @@ -31,14 +31,6 @@ public function getLineNumber(): ?int return $this->lineNumber; } - /** - * @return int<0, max> - */ - public function getLineNo(): int - { - return $this->getLineNumber() ?? 0; - } - /** * @return int<0, max>|null */ diff --git a/src/Position/Positionable.php b/src/Position/Positionable.php index c9f829a96..d23d26a32 100644 --- a/src/Position/Positionable.php +++ b/src/Position/Positionable.php @@ -16,13 +16,6 @@ interface Positionable */ public function getLineNumber(): ?int; - /** - * @return int<0, max> - * - * @deprecated in version 8.9.0, will be removed in v9.0. Use `getLineNumber()` instead. - */ - public function getLineNo(): int; - /** * @return int<0, max>|null */ diff --git a/tests/Unit/CSSList/AtRuleBlockListTest.php b/tests/Unit/CSSList/AtRuleBlockListTest.php index 9c777bedd..3b61e437e 100644 --- a/tests/Unit/CSSList/AtRuleBlockListTest.php +++ b/tests/Unit/CSSList/AtRuleBlockListTest.php @@ -114,18 +114,6 @@ public function atRuleArgsReturnsArgumentsProvidedToConstructor(): void self::assertSame($arguments, $subject->atRuleArgs()); } - /** - * @test - */ - public function getLineNoReturnsLineNumberProvidedToConstructor(): void - { - $lineNumber = 42; - - $subject = new AtRuleBlockList('', '', $lineNumber); - - self::assertSame($lineNumber, $subject->getLineNo()); - } - /** * @test */ diff --git a/tests/Unit/CSSList/CSSListTest.php b/tests/Unit/CSSList/CSSListTest.php index ef30c9a30..ce20caafb 100644 --- a/tests/Unit/CSSList/CSSListTest.php +++ b/tests/Unit/CSSList/CSSListTest.php @@ -57,28 +57,6 @@ public function implementsCSSListItem(): void self::assertInstanceOf(CSSListItem::class, $subject); } - /** - * @test - */ - public function getLineNoByDefaultReturnsZero(): void - { - $subject = new ConcreteCSSList(); - - self::assertSame(0, $subject->getLineNo()); - } - - /** - * @test - */ - public function getLineNoReturnsLineNumberProvidedToConstructor(): void - { - $lineNumber = 42; - - $subject = new ConcreteCSSList($lineNumber); - - self::assertSame($lineNumber, $subject->getLineNo()); - } - /** * @test */ diff --git a/tests/Unit/CSSList/KeyFrameTest.php b/tests/Unit/CSSList/KeyFrameTest.php index 15c927952..e191a440e 100644 --- a/tests/Unit/CSSList/KeyFrameTest.php +++ b/tests/Unit/CSSList/KeyFrameTest.php @@ -68,18 +68,6 @@ public function isCSSList(): void self::assertInstanceOf(CSSList::class, $subject); } - /** - * @test - */ - public function getLineNoReturnsLineNumberProvidedToConstructor(): void - { - $lineNumber = 42; - - $subject = new KeyFrame($lineNumber); - - self::assertSame($lineNumber, $subject->getLineNo()); - } - /** * @test */ diff --git a/tests/Unit/Comment/CommentTest.php b/tests/Unit/Comment/CommentTest.php index 0db0349a8..69572e903 100644 --- a/tests/Unit/Comment/CommentTest.php +++ b/tests/Unit/Comment/CommentTest.php @@ -57,27 +57,6 @@ public function setCommentSetsComments(): void self::assertSame($comment, $subject->getComment()); } - /** - * @test - */ - public function getLineNoOnEmptyInstanceReturnsZero(): void - { - $subject = new Comment(); - - self::assertSame(0, $subject->getLineNo()); - } - - /** - * @test - */ - public function getLineNoInitiallyReturnsLineNumberPassedToConstructor(): void - { - $lineNumber = 42; - $subject = new Comment('', $lineNumber); - - self::assertSame($lineNumber, $subject->getLineNo()); - } - /** * @test */ diff --git a/tests/Unit/Parsing/OutputExceptionTest.php b/tests/Unit/Parsing/OutputExceptionTest.php index 768982d06..73db4ebd5 100644 --- a/tests/Unit/Parsing/OutputExceptionTest.php +++ b/tests/Unit/Parsing/OutputExceptionTest.php @@ -32,27 +32,6 @@ public function getMessageReturnsMessageProvidedToConstructor(): void self::assertStringContainsString($message, $exception->getMessage()); } - /** - * @test - */ - public function getLineNoByDefaultReturnsZero(): void - { - $exception = new OutputException('foo'); - - self::assertSame(0, $exception->getLineNo()); - } - - /** - * @test - */ - public function getLineNoReturnsLineNumberProvidedToConstructor(): void - { - $lineNumber = 17; - $exception = new OutputException('foo', $lineNumber); - - self::assertSame($lineNumber, $exception->getLineNo()); - } - /** * @test */ diff --git a/tests/Unit/Parsing/SourceExceptionTest.php b/tests/Unit/Parsing/SourceExceptionTest.php index ea35f67d4..6e22bc96f 100644 --- a/tests/Unit/Parsing/SourceExceptionTest.php +++ b/tests/Unit/Parsing/SourceExceptionTest.php @@ -23,27 +23,6 @@ public function getMessageReturnsMessageProvidedToConstructor(): void self::assertStringContainsString($message, $exception->getMessage()); } - /** - * @test - */ - public function getLineNoByDefaultReturnsZero(): void - { - $exception = new SourceException('foo'); - - self::assertSame(0, $exception->getLineNo()); - } - - /** - * @test - */ - public function getLineNoReturnsLineNumberProvidedToConstructor(): void - { - $lineNumber = 17; - $exception = new SourceException('foo', $lineNumber); - - self::assertSame($lineNumber, $exception->getLineNo()); - } - /** * @test */ diff --git a/tests/Unit/Parsing/UnexpectedEOFExceptionTest.php b/tests/Unit/Parsing/UnexpectedEOFExceptionTest.php index 4c9040701..32a649a09 100644 --- a/tests/Unit/Parsing/UnexpectedEOFExceptionTest.php +++ b/tests/Unit/Parsing/UnexpectedEOFExceptionTest.php @@ -21,27 +21,6 @@ public function extendsUnexpectedTokenException(): void self::assertInstanceOf(UnexpectedTokenException::class, new UnexpectedEOFException('expected', 'found')); } - /** - * @test - */ - public function getLineNoByDefaultReturnsZero(): void - { - $exception = new UnexpectedEOFException('expected', 'found'); - - self::assertSame(0, $exception->getLineNo()); - } - - /** - * @test - */ - public function getLineNoReturnsLineNumberProvidedToConstructor(): void - { - $lineNumber = 17; - $exception = new UnexpectedEOFException('expected', 'found', 'literal', $lineNumber); - - self::assertSame($lineNumber, $exception->getLineNo()); - } - /** * @test */ diff --git a/tests/Unit/Parsing/UnexpectedTokenExceptionTest.php b/tests/Unit/Parsing/UnexpectedTokenExceptionTest.php index 6bd2a8d74..d4fa9eca8 100644 --- a/tests/Unit/Parsing/UnexpectedTokenExceptionTest.php +++ b/tests/Unit/Parsing/UnexpectedTokenExceptionTest.php @@ -21,27 +21,6 @@ public function extendsSourceException(): void self::assertInstanceOf(SourceException::class, new UnexpectedTokenException('expected', 'found')); } - /** - * @test - */ - public function getLineNoByDefaultReturnsZero(): void - { - $exception = new UnexpectedTokenException('expected', 'found'); - - self::assertSame(0, $exception->getLineNo()); - } - - /** - * @test - */ - public function getLineNoReturnsLineNumberProvidedToConstructor(): void - { - $lineNumber = 17; - $exception = new UnexpectedTokenException('expected', 'found', 'literal', $lineNumber); - - self::assertSame($lineNumber, $exception->getLineNo()); - } - /** * @test */ diff --git a/tests/Unit/Value/CSSStringTest.php b/tests/Unit/Value/CSSStringTest.php index ca0bf95a4..c54ecdd75 100644 --- a/tests/Unit/Value/CSSStringTest.php +++ b/tests/Unit/Value/CSSStringTest.php @@ -60,28 +60,6 @@ public function setStringSetsString(): void self::assertSame($string, $subject->getString()); } - /** - * @test - */ - public function getLineNoByDefaultReturnsZero(): void - { - $subject = new CSSString(''); - - self::assertSame(0, $subject->getLineNo()); - } - - /** - * @test - */ - public function getLineNoReturnsLineNumberProvidedToConstructor(): void - { - $lineNumber = 42; - - $subject = new CSSString('', $lineNumber); - - self::assertSame($lineNumber, $subject->getLineNo()); - } - /** * @test */ diff --git a/tests/Unit/Value/CalcRuleValueListTest.php b/tests/Unit/Value/CalcRuleValueListTest.php index f891d0f53..7314e3c51 100644 --- a/tests/Unit/Value/CalcRuleValueListTest.php +++ b/tests/Unit/Value/CalcRuleValueListTest.php @@ -26,28 +26,6 @@ public function isRuleValueList(): void self::assertInstanceOf(RuleValueList::class, $subject); } - /** - * @test - */ - public function getLineNoByDefaultReturnsZero(): void - { - $subject = new CalcRuleValueList(); - - self::assertSame(0, $subject->getLineNo()); - } - - /** - * @test - */ - public function getLineNoReturnsLineNumberProvidedToConstructor(): void - { - $lineNumber = 42; - - $subject = new CalcRuleValueList($lineNumber); - - self::assertSame($lineNumber, $subject->getLineNo()); - } - /** * @test */ diff --git a/tests/Unit/Value/URLTest.php b/tests/Unit/Value/URLTest.php index cb29ee548..66654e647 100644 --- a/tests/Unit/Value/URLTest.php +++ b/tests/Unit/Value/URLTest.php @@ -60,28 +60,6 @@ public function setUrlReplacesUrl(): void self::assertSame($newUrl, $subject->getURL()); } - /** - * @test - */ - public function getLineNoByDefaultReturnsZero(): void - { - $subject = new URL(new CSSString('http://example.com')); - - self::assertSame(0, $subject->getLineNo()); - } - - /** - * @test - */ - public function getLineNoReturnsLineNumberProvidedToConstructor(): void - { - $lineNumber = 17; - - $subject = new URL(new CSSString('http://example.com'), $lineNumber); - - self::assertSame($lineNumber, $subject->getLineNo()); - } - /** * @test */ diff --git a/tests/UnitDeprecated/.gitkeep b/tests/UnitDeprecated/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tests/UnitDeprecated/Position/PositionTest.php b/tests/UnitDeprecated/Position/PositionTest.php deleted file mode 100644 index ec34c1f1f..000000000 --- a/tests/UnitDeprecated/Position/PositionTest.php +++ /dev/null @@ -1,91 +0,0 @@ -subject = new ConcretePosition(); - } - - /** - * @return array}> - */ - public function provideLineNumber(): array - { - return [ - 'line 1' => [1], - 'line 42' => [42], - ]; - } - - /** - * @return array}> - */ - public function provideColumnNumber(): array - { - return [ - 'column 0' => [0], - 'column 14' => [14], - 'column 39' => [39], - ]; - } - - /** - * @test - */ - public function getLineNoInitiallyReturnsZero(): void - { - self::assertSame(0, $this->subject->getLineNo()); - } - - /** - * @test - * - * @dataProvider provideLineNumber - */ - public function getLineNoReturnsLineNumberSet(int $lineNumber): void - { - $this->subject->setPosition($lineNumber); - - self::assertSame($lineNumber, $this->subject->getLineNo()); - } - - /** - * @test - */ - public function getLineNoReturnsZeroAfterLineNumberCleared(): void - { - $this->subject->setPosition(99); - - $this->subject->setPosition(null); - - self::assertSame(0, $this->subject->getLineNo()); - } - - /** - * @test - */ - public function getLineNoAfterSetPositionWithZeroReturnsZero(): void - { - $this->subject->setPosition(99); - - $this->subject->setPosition(0); - - self::assertSame(0, $this->subject->getLineNo()); - } -}