Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update composer.json to support symfony 6.4 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
composer.phar
phpunit.xml
.phpunit.result.cache
vendor/
data/schema.graphql
composer.lock
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM php:8.3
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN apt update
RUN apt install git -y
RUN apt-get install -y \
libzip-dev \
zip \
&& docker-php-ext-install zip
RUN pecl install xdebug && docker-php-ext-enable xdebug
WORKDIR /var/www/html
ENTRYPOINT ["tail", "-f", "/dev/null"]
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
}
],
"require": {
"php": ">=5.5",
"php": "^8.3",
"ext-mbstring": "*",
"symfony/property-access": "^2.8 || ^3.4 || ^4.4 || ^5.4"
"symfony/property-access": "^2.8 || ^3.4 || ^4.4 || ^5.4 || ^6.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
"phpunit/phpunit": "~9.6",
"rector/rector": "*",
"phpspec/prophecy": "^1.19"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
app:
hostname: app
container_name: app
build: .
volumes:
- .:/var/www/html:rw
21 changes: 21 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitSetList;

return RectorConfig::configure()
->withPaths([
// __DIR__ . '/src',
__DIR__ . '/tests',
])
// uncomment to reach your current PHP version
->withPhpSets(php83: true)
->withSets([
PHPUnitSetList::PHPUNIT_50,
PHPUnitSetList::PHPUNIT_60,
PHPUnitSetList::PHPUNIT_70,
PHPUnitSetList::PHPUNIT_80,
PHPUnitSetList::PHPUNIT_90,
])
->withTypeCoverageLevel(0);
1 change: 1 addition & 0 deletions tests/DataProvider/TestConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

class TestConfig extends AbstractConfig
{
#[\Override]
public function getRules()
{
return [
Expand Down
1 change: 1 addition & 0 deletions tests/DataProvider/TestConfigExtraFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class TestConfigExtraFields extends AbstractConfig

protected $extraFieldsAllowed = true;

#[\Override]
public function getRules()
{
return [
Expand Down
1 change: 1 addition & 0 deletions tests/DataProvider/TestConfigInvalidRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class TestConfigInvalidRule extends AbstractConfig
{
#[\Override]
public function getRules()
{
return [
Expand Down
2 changes: 2 additions & 0 deletions tests/DataProvider/TestEmptySchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

class TestEmptySchema extends AbstractSchema
{
#[\Override]
public function build(SchemaConfig $config)
{
}


#[\Override]
public function getName($config)
{
return 'TestSchema';
Expand Down
1 change: 1 addition & 0 deletions tests/DataProvider/TestEnumType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

class TestEnumType extends AbstractEnumType
{
#[\Override]
public function getValues()
{
return [
Expand Down
1 change: 1 addition & 0 deletions tests/DataProvider/TestExtendedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

class TestExtendedType extends AbstractObjectType
{
#[\Override]
public function build($config)
{
$config->applyInterface(new TestInterfaceType())
Expand Down
3 changes: 3 additions & 0 deletions tests/DataProvider/TestField.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ class TestField extends AbstractField
/**
* @return AbstractObjectType
*/
#[\Override]
public function getType()
{
return new IntType();
}

#[\Override]
public function resolve($value, array $args, ResolveInfo $info)
{
return $value;
}

#[\Override]
public function getDescription()
{
return 'description';
Expand Down
3 changes: 3 additions & 0 deletions tests/DataProvider/TestInputField.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ class TestInputField extends AbstractInputField
/**
* @return InputTypeInterface
*/
#[\Override]
public function getType()
{
return new IntType();
}

#[\Override]
public function getDescription()
{
return 'description';
}

#[\Override]
public function getDefaultValue()
{
return 'default';
Expand Down
1 change: 1 addition & 0 deletions tests/DataProvider/TestInputObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

class TestInputObjectType extends AbstractInputObjectType
{
#[\Override]
public function build($config)
{
$config->addField('name', new NonNullType(new StringType()));
Expand Down
2 changes: 2 additions & 0 deletions tests/DataProvider/TestInterfaceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
class TestInterfaceType extends AbstractInterfaceType
{

#[\Override]
public function resolveType($object)
{
return is_object($object) ? $object : new TestObjectType();
}

#[\Override]
public function build($config)
{
$config->addField('name', new StringType());
Expand Down
1 change: 1 addition & 0 deletions tests/DataProvider/TestListType.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

class TestListType extends AbstractListType
{
#[\Override]
public function getItemType()
{
return new StringType();
Expand Down
2 changes: 2 additions & 0 deletions tests/DataProvider/TestMutationObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@

class TestMutationObjectType extends AbstractMutationObjectType
{
#[\Override]
public function getOutputType()
{
return new StringType();
}

#[\Override]
public function build($config)
{
$this->addArgument('increment', new IntType());
Expand Down
10 changes: 4 additions & 6 deletions tests/DataProvider/TestObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
class TestObjectType extends AbstractObjectType
{

#[\Override]
public function build($config)
{
$config
Expand All @@ -41,9 +42,7 @@ public function build($config)
'args' => [
'noop' => new IntType()
],
'resolve' => function ($value, $args, $info) {
return ['address' => '1234 Street'];
}
'resolve' => fn($value, $args, $info) => ['address' => '1234 Street']
]
)
->addField(
Expand All @@ -52,13 +51,12 @@ public function build($config)
'args' => [
'value' => new NonNullType(new StringType())
],
'resolve' => function ($value, $args, $info) {
return $args['value'];
}
'resolve' => fn($value, $args, $info) => $args['value']
]
);
}

#[\Override]
public function getInterfaces()
{
return [new TestInterfaceType()];
Expand Down
13 changes: 4 additions & 9 deletions tests/DataProvider/TestSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,23 @@ class TestSchema extends AbstractSchema
{
private $testStatusValue = 0;

#[\Override]
public function build(SchemaConfig $config)
{
$config->getQuery()->addFields([
'me' => [
'type' => new TestObjectType(),
'resolve' => function ($value, $args, ResolveInfo $info) {
return $info->getReturnType()->getData();
}
'resolve' => fn($value, $args, ResolveInfo $info) => $info->getReturnType()->getData()
],
'status' => [
'type' => new TestEnumType(),
'resolve' => function () {
return $this->testStatusValue;
}
'resolve' => fn() => $this->testStatusValue
],
]);
$config->getMutation()->addFields([
'updateStatus' => [
'type' => new TestEnumType(),
'resolve' => function () {
return $this->testStatusValue;
},
'resolve' => fn() => $this->testStatusValue,
'args' => [
'newStatus' => new TestEnumType(),
'list' => new ListType(new IntType())
Expand Down
4 changes: 4 additions & 0 deletions tests/DataProvider/TestTimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
class TestTimeType extends AbstractScalarType
{

#[\Override]
public function getName()
{
return 'TestTime';
Expand All @@ -23,6 +24,7 @@ public function getName()
* @param $value \DateTime
* @return null|string
*/
#[\Override]
public function serialize($value)
{
if ($value === null) {
Expand All @@ -32,6 +34,7 @@ public function serialize($value)
return $value instanceof \DateTime ? $value->format('H:i:s') : $value;
}

#[\Override]
public function isValidValue($value)
{
if (is_object($value)) {
Expand All @@ -43,6 +46,7 @@ public function isValidValue($value)
return $d && $d->format('H:i:s') == $value;
}

#[\Override]
public function getDescription()
{
return 'Representation time in "H:i:s" format';
Expand Down
3 changes: 3 additions & 0 deletions tests/DataProvider/TestUnionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@
class TestUnionType extends AbstractUnionType
{

#[\Override]
public function getTypes()
{
return [
new TestObjectType()
];
}

#[\Override]
public function resolveType($object)
{
return $object;
}

#[\Override]
public function getDescription()
{
return 'Union collect cars types';
Expand Down
1 change: 1 addition & 0 deletions tests/Issues/Issue109/Issue109Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class Issue109Schema extends AbstractSchema
{

#[\Override]
public function build(SchemaConfig $config)
{
$config->setQuery(
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/Issue109/Issue109Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Youshido\GraphQL\Execution\Processor;

class Issue109Test extends \PHPUnit_Framework_TestCase
class Issue109Test extends \PHPUnit\Framework\TestCase
{

public function testInternalVariableArgument()
Expand Down
16 changes: 7 additions & 9 deletions tests/Issues/Issue116/Issue116Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Youshido\GraphQL\Type\Scalar\IntType;
use Youshido\GraphQL\Type\Scalar\StringType;

class Issue116Test extends \PHPUnit_Framework_TestCase
class Issue116Test extends \PHPUnit\Framework\TestCase
{

public function testInternalVariableArgument()
Expand Down Expand Up @@ -48,14 +48,12 @@ public function testInternalVariableArgument()
'args' => [
'first' => new IntType(),
],
'resolve' => function () {
return [
'pageInfo' => [
'totalEdges' => 10,
'cursors' => []
]
];
}
'resolve' => fn() => [
'pageInfo' => [
'totalEdges' => 10,
'cursors' => []
]
]
]
]
])
Expand Down
12 changes: 5 additions & 7 deletions tests/Issues/Issue131/Issue131Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Youshido\GraphQL\Type\Scalar\IntType;
use Youshido\GraphQL\Type\Scalar\StringType;

class Issue131Test extends \PHPUnit_Framework_TestCase
class Issue131Test extends \PHPUnit\Framework\TestCase
{

public function testInternalVariableArgument()
Expand Down Expand Up @@ -47,12 +47,10 @@ public function testInternalVariableArgument()
]
]))
],
'resolve' => function ($source, $args) {
return [
'id' => '1',
'name' => sprintf('Meeting with %d beans', count($args['related_beans'])),
];
}
'resolve' => fn($source, $args) => [
'id' => '1',
'name' => sprintf('Meeting with %d beans', count($args['related_beans'])),
]
]
]
])
Expand Down
Loading