Skip to content

Commit

Permalink
Merge pull request #217 from phpcr/cleanup-major
Browse files Browse the repository at this point in the history
drop workarounds for symfony 2
  • Loading branch information
dbu authored Nov 28, 2023
2 parents 2e6df65 + ec608ad commit 4ee2510
Show file tree
Hide file tree
Showing 102 changed files with 1,134 additions and 1,668 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: '7.2'
dependencies: 'lowest'
- php-version: '7.3'
- php-version: '7.4'
- php-version: '8.0'
dependencies: 'lowest'
- php-version: '8.1'
- php-version: '8.2'
- php-version: '8.3'
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Changelog
------------------

* Support Symfony 7
* Test with PHP 8.3
* Drop support for Symfony 2
* Remove deprecated code, clean up workarounds for Symfony 2.
* Drop support for PHP 7, test with PHP 8.3
* Adjusted commands to have the return type declarations.

1.x
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
}
],
"require": {
"php": "^7.2 || ^8.0",
"php": "^8.0",
"phpcr/phpcr": "~2.1.0",
"symfony/console": "^2.3 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"
"symfony/console": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"require-dev": {
"ramsey/uuid": "^3.5",
Expand Down
5 changes: 0 additions & 5 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@ parameters:
level: 2
paths:
- src
ignoreErrors:
-
message: "#Symfony\\\\Component\\\\Console\\\\Helper\\\\DialogHelper#"
count: 3
path: src/PHPCR/Util/Console/Command/BaseCommand.php
4 changes: 3 additions & 1 deletion src/PHPCR/Util/CND/Exception/ParserException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace PHPCR\Util\CND\Exception;

use PHPCR\Util\CND\Scanner\GenericToken;
Expand All @@ -12,7 +14,7 @@
*/
class ParserException extends \Exception
{
public function __construct(TokenQueue $queue, $msg)
public function __construct(TokenQueue $queue, string $msg)
{
$token = $queue->peek();
$msg = sprintf("PARSER ERROR: %s. Current token is [%s, '%s'] at line %s, column %s", $msg, GenericToken::getTypeName($token->getType()), $token->getData(), $token->getLine(), $token->getRow());
Expand Down
4 changes: 3 additions & 1 deletion src/PHPCR/Util/CND/Exception/ScannerException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace PHPCR\Util\CND\Exception;

use PHPCR\Util\CND\Reader\ReaderInterface;
Expand All @@ -11,7 +13,7 @@
*/
class ScannerException extends \Exception
{
public function __construct(ReaderInterface $reader, $msg)
public function __construct(ReaderInterface $reader, string $msg)
{
$msg = sprintf(
"SCANNER ERROR: %s at line %s, column %s.\nCurrent buffer \"%s\"",
Expand Down
24 changes: 8 additions & 16 deletions src/PHPCR/Util/CND/Parser/AbstractParser.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace PHPCR\Util\CND\Parser;

use PHPCR\Util\CND\Exception\ParserException;
Expand All @@ -23,10 +25,8 @@ abstract class AbstractParser
{
/**
* The token queue.
*
* @var TokenQueue
*/
protected $tokenQueue;
protected TokenQueue $tokenQueue;

/**
* Check the next token without consuming it and return true if it matches the given type and data.
Expand All @@ -36,10 +36,8 @@ abstract class AbstractParser
* @param int $type The expected token type
* @param string|null $data The expected data or null
* @param bool $ignoreCase whether to do string comparisons case insensitive or sensitive
*
* @return bool
*/
protected function checkToken($type, $data = null, $ignoreCase = false)
protected function checkToken($type, string $data = null, bool $ignoreCase = false): bool
{
if ($this->tokenQueue->isEof()) {
return false;
Expand All @@ -65,11 +63,9 @@ protected function checkToken($type, $data = null, $ignoreCase = false)
/**
* Check if the token data is one of the elements of the data array.
*
* @param int $type
*
* @return bool
* @param string[] $data
*/
protected function checkTokenIn($type, array $data, $ignoreCase = false)
protected function checkTokenIn(int $type, array $data, bool $ignoreCase = false): bool
{
foreach ($data as $d) {
if ($this->checkToken($type, $d, $ignoreCase)) {
Expand All @@ -87,11 +83,9 @@ protected function checkTokenIn($type, array $data, $ignoreCase = false)
* @param int $type The expected token type
* @param string|null $data The expected token data or null
*
* @return Token
*
* @throws ParserException
*/
protected function expectToken($type, $data = null)
protected function expectToken(int $type, string $data = null): Token
{
$token = $this->tokenQueue->peek();

Expand All @@ -110,10 +104,8 @@ protected function expectToken($type, $data = null)
*
* @param int $type The expected token type
* @param string|null $data The expected token data or null
*
* @return bool|Token
*/
protected function checkAndExpectToken($type, $data = null)
protected function checkAndExpectToken(int $type, string $data = null): bool|Token
{
if ($this->checkToken($type, $data)) {
$token = $this->tokenQueue->peek();
Expand Down
Loading

0 comments on commit 4ee2510

Please sign in to comment.