Skip to content
Open

php8 #21

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 .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
vendor/
.php-cs-fixer.cache
.php-cs-fixer.cache

tests/.phpunit.cache/
tests/.phpunit.result.cache
12 changes: 12 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
->in(__DIR__);

$config = new PhpCsFixer\Config();

return $config->setRules([
'@PSR1' => true,
'@PSR12' => true,
Expand All @@ -21,5 +22,16 @@
'call_type' => 'self',
],
'php_unit_strict' => false, // DTOs can be compared non-strictly.
'native_function_invocation' => false,
'trailing_comma_in_multiline' => [
'after_heredoc' => true,
'elements' => [
'arguments',
'array_destructuring',
'arrays',
'match',
'parameters',
],
],
])
->setFinder($finder);
12 changes: 7 additions & 5 deletions bin/collection
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace TheBrokenTile\BoardGameGeekApi;

use RuntimeException;
use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
use Symfony\Component\HttpClient\CurlHttpClient;
use TheBrokenTile\BoardGameGeekApi\ObjectBuilder\CollectionBuilder;
use TheBrokenTile\BoardGameGeekApi\ObjectBuilder\ObjectBuilder;
use TheBrokenTile\BoardGameGeekApi\Request\CollectionRequest;
Expand All @@ -19,10 +21,10 @@ $client = new Client(
new ObjectBuilder([
new CollectionBuilder(),
]),
new CurlHttpClient(),
new FilesystemTagAwareAdapter(),
new UrlGenerator(),
new CacheTagGenerator(),
);

var_dump($client->request(
(new CollectionRequest($username))
->filter(RequestInterface::PARAM_COLLECTION_FILTER_PREVIOUSLY_OWNED, true),
)
);
var_dump($client->request(new CollectionRequest($username)));
8 changes: 7 additions & 1 deletion bin/game
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace TheBrokenTile\BoardGameGeekApi;

use RuntimeException;
use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
use Symfony\Component\HttpClient\CurlHttpClient;
use TheBrokenTile\BoardGameGeekApi\ObjectBuilder\GameBuilder;
use TheBrokenTile\BoardGameGeekApi\ObjectBuilder\ObjectBuilder;
use TheBrokenTile\BoardGameGeekApi\Request\GameRequest;
Expand All @@ -13,13 +15,17 @@ if (count($argv) < 2) {
throw new RunTimeException('First argument is required');
}

$ids = explode(RequestInterface::PARAM_VALUE_SEPARATOR, $argv[1]);
$ids = array_map('intval', explode(RequestInterface::PARAM_VALUE_SEPARATOR, $argv[1]));
$stats = (bool) ($argv[2] ?? false);

$client = new Client(
new ObjectBuilder([
new GameBuilder(),
]),
new CurlHttpClient(),
new FilesystemTagAwareAdapter(),
new UrlGenerator(),
new CacheTagGenerator(),
);

$request = new GameRequest(...$ids);
Expand Down
9 changes: 5 additions & 4 deletions bin/search
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
namespace TheBrokenTile\BoardGameGeekApi;

use RuntimeException;
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
use Symfony\Component\HttpClient\CurlHttpClient;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use TheBrokenTile\BoardGameGeekApi\ObjectBuilder\GameBuilder;
use TheBrokenTile\BoardGameGeekApi\ObjectBuilder\ObjectBuilder;
use TheBrokenTile\BoardGameGeekApi\ObjectBuilder\RetryExactSearchBuilder;
use TheBrokenTile\BoardGameGeekApi\ObjectBuilder\SearchResultBuilder;
use TheBrokenTile\BoardGameGeekApi\Request\GameRequest;
use TheBrokenTile\BoardGameGeekApi\Request\SearchRequest;

require dirname(__DIR__).'/vendor/autoload.php';
Expand All @@ -28,6 +25,10 @@ $client = new Client(
$searchResultBuilder,
new RetryExactSearchBuilder($searchResultBuilder),
]),
new CurlHttpClient(),
new FilesystemTagAwareAdapter(),
new UrlGenerator(),
new CacheTagGenerator(),
);

$request = new SearchRequest($query, true);
Expand Down
19 changes: 11 additions & 8 deletions bin/user
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
namespace TheBrokenTile\BoardGameGeekApi;

use RuntimeException;
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
use Symfony\Component\HttpClient\CurlHttpClient;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use TheBrokenTile\BoardGameGeekApi\ObjectBuilder\ObjectBuilder;
use TheBrokenTile\BoardGameGeekApi\ObjectBuilder\UserBuilder;
use TheBrokenTile\BoardGameGeekApi\Request\UserRequest;
Expand All @@ -22,15 +21,19 @@ $client = new Client(
new ObjectBuilder([
new UserBuilder(),
]),
new CurlHttpClient(),
new FilesystemTagAwareAdapter(),
new UrlGenerator(),
new CacheTagGenerator(),
);

var_dump(
$client->request(
(new UserRequest($username))
->buddies()
->guilds()
->top()
->hot()
->page(1)
new UserRequest($username)
->buddies()
->guilds()
->top()
->hot()
->page(1)
)
);
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": ">=7.4",
"php": "^8.4",
"ext-dom": "*",
"symfony/cache": "^5.3",
"symfony/css-selector": "^5.3",
Expand All @@ -32,11 +32,9 @@
}
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^1.2",
"phpunit/phpunit": "^12",
"phpstan/phpstan": "^2.1",
"phpstan/extension-installer": "^1.1",
"jangregor/phpstan-prophecy": "^1.0",
"friendsofphp/php-cs-fixer": "^3.3"
},
"scripts": {
Expand Down
Loading
Loading