Skip to content

Commit

Permalink
[TASK] Mark parsing-internal classes and methods as @internal
Browse files Browse the repository at this point in the history
Code that uses this library is not expected to call internal parsing
functionality. Communicate this with the corresponding `@internal`
annotation.

This allows us to boldly refactor the parser code.

Part of #668
  • Loading branch information
oliverklee committed Aug 28, 2024
1 parent a64c752 commit 748a15c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Changed

- Mark parsing-internal classes and methods as `@internal` (#674)
- Block installations on unsupported higher PHP versions (#691)
- Improve performance of Value::parseValue with many delimiters by refactoring to remove array_search() (#413)
- Add visibility to all class/interface constants (#469)
Expand Down
4 changes: 4 additions & 0 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public function __construct($sText, ?Settings $oParserSettings = null, $iLineNo
* Sets the charset to be used if the CSS does not contain an `@charset` declaration.
*
* @param string $sCharset
*
* @internal
*/
public function setCharset($sCharset): void
{
Expand All @@ -41,6 +43,8 @@ public function setCharset($sCharset): void

/**
* Returns the charset that is used if the CSS does not contain an `@charset` declaration.
*
* @internal
*/
public function getCharset(): void
{
Expand Down
3 changes: 3 additions & 0 deletions src/Parsing/Anchor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Sabberworm\CSS\Parsing;

/**
* @internal
*/
class Anchor
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Parsing/OutputException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Thrown if the CSS parser attempts to print something invalid.
*
* @internal
*/
class OutputException extends SourceException
{
Expand Down
3 changes: 3 additions & 0 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Sabberworm\CSS\Comment\Comment;
use Sabberworm\CSS\Settings;

/**
* @internal
*/
class ParserState
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Parsing/SourceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Sabberworm\CSS\Parsing;

/**
* @internal
*/
class SourceException extends \Exception
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Parsing/UnexpectedEOFException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
* Thrown if the CSS parser encounters end of file it did not expect.
*
* Extends `UnexpectedTokenException` in order to preserve backwards compatibility.
*
* @internal
*/
class UnexpectedEOFException extends UnexpectedTokenException {}
2 changes: 2 additions & 0 deletions src/Parsing/UnexpectedTokenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Thrown if the CSS parser encounters a token it did not expect.
*
* @internal
*/
class UnexpectedTokenException extends SourceException
{
Expand Down

0 comments on commit 748a15c

Please sign in to comment.