Skip to content

Commit

Permalink
chore: Deprecated class/methods marked by trigger_deprecation() (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
LastDragon-ru authored Mar 25, 2024
2 parents b09890e + c2a08ea commit 4979a4e
Show file tree
Hide file tree
Showing 27 changed files with 89 additions and 10 deletions.
1 change: 1 addition & 0 deletions packages/core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"illuminate/console": "^10.34.0",
"illuminate/container": "^10.34.0",
"illuminate/contracts": "^10.34.0",
"symfony/deprecation-contracts": "^3.0.0",
"symfony/filesystem": "^6.3.0",
"symfony/polyfill-php83": "^1.28"
},
Expand Down
1 change: 0 additions & 1 deletion packages/core/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
<env verbatim="true" name="APP_DEBUG" value="true"/>
<env verbatim="true" name="DB_CONNECTION" value="sqlite"/>
<env verbatim="true" name="DB_DATABASE" value=":memory:"/>
<env verbatim="true" name="TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS" value="true"/>
</php>
</phpunit>
3 changes: 3 additions & 0 deletions packages/core/src/Observer/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace LastDragon_ru\LaraASP\Core\Observer;

use Closure;
use LastDragon_ru\LaraASP\Core\Package;
use Override;
use SplObjectStorage;
use function array_values;
Expand Down Expand Up @@ -60,6 +61,8 @@ public function notify(mixed $context = null): static {
* @return list<Closure(TContext):void>
*/
public function getObservers(): array {
trigger_deprecation(Package::Name, '5.1.0', 'The method should not be used.');

return array_values(iterator_to_array($this->observers));
}
}
1 change: 1 addition & 0 deletions packages/documentator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"nikic/php-parser": "^4.18|^5.0",
"phpstan/phpdoc-parser": "^1.25",
"symfony/console": "^6.3.0",
"symfony/deprecation-contracts": "^3.0.0",
"symfony/filesystem": "^6.3.0",
"symfony/finder": "^6.3.0",
"symfony/polyfill-php83": "^1.28",
Expand Down
1 change: 0 additions & 1 deletion packages/documentator/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
<env verbatim="true" name="APP_DEBUG" value="true"/>
<env verbatim="true" name="DB_CONNECTION" value="sqlite"/>
<env verbatim="true" name="DB_DATABASE" value=":memory:"/>
<env verbatim="true" name="TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS" value="true"/>
</php>
</phpunit>
7 changes: 7 additions & 0 deletions packages/documentator/src/Utils/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
namespace LastDragon_ru\LaraASP\Documentator\Utils;

use LastDragon_ru\LaraASP\Core\Utils\Path as CorePath;
use LastDragon_ru\LaraASP\Documentator\Package;

use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '%{VERSION}', 'Please use `%s` instead.', CorePath::class);

/**
* @deprecated %{VERSION} Use {@see CorePath} instead.
Expand Down
1 change: 0 additions & 1 deletion packages/eloquent/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
<env verbatim="true" name="APP_DEBUG" value="true"/>
<env verbatim="true" name="DB_CONNECTION" value="sqlite"/>
<env verbatim="true" name="DB_DATABASE" value=":memory:"/>
<env verbatim="true" name="TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS" value="true"/>
</php>
</phpunit>
1 change: 0 additions & 1 deletion packages/formatter/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
<env verbatim="true" name="APP_DEBUG" value="true"/>
<env verbatim="true" name="DB_CONNECTION" value="sqlite"/>
<env verbatim="true" name="DB_DATABASE" value=":memory:"/>
<env verbatim="true" name="TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS" value="true"/>
</php>
</phpunit>
1 change: 1 addition & 0 deletions packages/graphql/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"lastdragon-ru/lara-asp-eloquent": "self.version",
"lastdragon-ru/lara-asp-graphql-printer": "self.version",
"lastdragon-ru/lara-asp-serializer": "self.version",
"symfony/deprecation-contracts": "^3.0.0",
"symfony/polyfill-php83": "^1.28",
"webonyx/graphql-php": "^15.4.0"
},
Expand Down
1 change: 0 additions & 1 deletion packages/graphql/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@
<env verbatim="true" name="DB_CONNECTION" value="sqlite"/>
<env verbatim="true" name="DB_DATABASE" value=":memory:"/>
<env verbatim="true" name="SCOUT_DRIVER" value="null"/>
<env verbatim="true" name="TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS" value="true"/>
</php>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
use Illuminate\Database\Eloquent\Model;
use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\BuilderFieldResolver;
use LastDragon_ru\LaraASP\GraphQL\Builder\Property;
use LastDragon_ru\LaraASP\GraphQL\Package;

use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '5.4.0', 'Please use `%s` instead.', BuilderFieldResolver::class);

/**
* Convert nested property into Scout field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

namespace LastDragon_ru\LaraASP\GraphQL\Builder\Directives;

use LastDragon_ru\LaraASP\GraphQL\Package;
use Nuwave\Lighthouse\Schema\DirectiveLocator;
use Override;

use function array_unique;
use function assert;
use function implode;
use function is_string;
use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '5.6.0', 'Please use `%s` instead.', ExtendOperatorsDirective::class);

/**
* @deprecated 5.6.0 Use {@see ExtendOperatorsDirective} instead.
Expand Down
8 changes: 8 additions & 0 deletions packages/graphql/src/Builder/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

namespace LastDragon_ru\LaraASP\GraphQL\Builder;

use LastDragon_ru\LaraASP\GraphQL\Package;

use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '5.5.0', 'Please use `%s` instead.', Field::class);

/**
* @deprecated 5.5.0 Please use {@see Field} instead.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

namespace LastDragon_ru\LaraASP\GraphQL\SearchBy\Definitions;

use LastDragon_ru\LaraASP\GraphQL\Package;
use LastDragon_ru\LaraASP\GraphQL\SearchBy\Operators\Complex\Relationship;

use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '5.6.0', 'Please use `%s` instead.', SearchByOperatorRelationshipDirective::class);

/**
* @deprecated 5.6.0 Please use {@see SearchByOperatorRelationshipDirective}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

namespace LastDragon_ru\LaraASP\GraphQL\SearchBy\Definitions;

use LastDragon_ru\LaraASP\GraphQL\Package;
use LastDragon_ru\LaraASP\GraphQL\SearchBy\Directives\Operators;

use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '5.6.0', 'Please use `%s` instead.', SearchByExtendOperatorsDirective::class);

/**
* @deprecated 5.6.0 Use {@see SearchByExtendOperatorsDirective} instead.
*/
Expand Down
7 changes: 7 additions & 0 deletions packages/graphql/src/SearchBy/Directives/Operators.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
namespace LastDragon_ru\LaraASP\GraphQL\SearchBy\Directives;

use LastDragon_ru\LaraASP\GraphQL\Builder\Directives\OperatorsDirective;
use LastDragon_ru\LaraASP\GraphQL\Package;
use LastDragon_ru\LaraASP\GraphQL\SearchBy\Contracts\Scope;

use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '5.6.0', 'Please use `%s` instead.', ExtendOperators::class);

/**
* @deprecated 5.6.0 Use {@see ExtendOperators} instead.
*/
Expand Down
7 changes: 7 additions & 0 deletions packages/graphql/src/SearchBy/Types/Condition/V5.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
use LastDragon_ru\LaraASP\GraphQL\Builder\Context\HandlerContextBuilderInfo;
use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\Context;
use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\TypeSource;
use LastDragon_ru\LaraASP\GraphQL\Package;
use LastDragon_ru\LaraASP\GraphQL\SearchBy\Directives\Directive;
use Override;

use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '5.5.0', 'Please migrate to the new query structure.');

/**
* @deprecated 5.5.0 Please migrate to the new query structure.
*/
Expand Down
7 changes: 7 additions & 0 deletions packages/graphql/src/SortBy/Types/Clause/V5.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
use LastDragon_ru\LaraASP\GraphQL\Builder\Context\HandlerContextBuilderInfo;
use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\Context;
use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\TypeSource;
use LastDragon_ru\LaraASP\GraphQL\Package;
use LastDragon_ru\LaraASP\GraphQL\SortBy\Directives\Directive;
use Override;

use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '5.5.0', 'Please migrate to the new query structure.');

/**
* @deprecated 5.5.0 Please migrate to the new query structure.
*/
Expand Down
1 change: 0 additions & 1 deletion packages/migrator/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
<env verbatim="true" name="APP_DEBUG" value="true"/>
<env verbatim="true" name="DB_CONNECTION" value="sqlite"/>
<env verbatim="true" name="DB_DATABASE" value=":memory:"/>
<env verbatim="true" name="TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS" value="true"/>
</php>
</phpunit>
1 change: 0 additions & 1 deletion packages/serializer/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
<env verbatim="true" name="APP_DEBUG" value="true"/>
<env verbatim="true" name="DB_CONNECTION" value="sqlite"/>
<env verbatim="true" name="DB_DATABASE" value=":memory:"/>
<env verbatim="true" name="TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS" value="true"/>
</php>
</phpunit>
1 change: 1 addition & 0 deletions packages/spa/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"illuminate/validation": "^10.34.0",
"guzzlehttp/psr7": "^1.9.1|^2.4.5",
"lastdragon-ru/lara-asp-core": "self.version",
"symfony/deprecation-contracts": "^3.0.0",
"symfony/http-kernel": "^6.3.0",
"symfony/polyfill-php83": "^1.28"
},
Expand Down
1 change: 0 additions & 1 deletion packages/spa/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
<env verbatim="true" name="APP_DEBUG" value="true"/>
<env verbatim="true" name="DB_CONNECTION" value="sqlite"/>
<env verbatim="true" name="DB_DATABASE" value=":memory:"/>
<env verbatim="true" name="TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS" value="true"/>
</php>
</phpunit>
7 changes: 7 additions & 0 deletions packages/spa/src/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
namespace LastDragon_ru\LaraASP\Spa\Http;

use Illuminate\Foundation\Http\FormRequest;
use LastDragon_ru\LaraASP\Spa\Package;
use Override;

use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '%{VERSION}', 'Please use own class and `%s` trait.', WithValueProvider::class);

/**
* @deprecated %{VERSION} Please use own class and {@see WithValueProvider} trait.
*/
Expand Down
1 change: 0 additions & 1 deletion packages/testing/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
<env verbatim="true" name="APP_DEBUG" value="true"/>
<env verbatim="true" name="DB_CONNECTION" value="sqlite"/>
<env verbatim="true" name="DB_DATABASE" value=":memory:"/>
<env verbatim="true" name="TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS" value="true"/>
</php>
</phpunit>
5 changes: 5 additions & 0 deletions packages/testing/src/Assertions/ResponseAssertions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
namespace LastDragon_ru\LaraASP\Testing\Assertions;

use LastDragon_ru\LaraASP\Testing\Constraints\Response\Response;
use LastDragon_ru\LaraASP\Testing\Package;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\Constraint\Constraint;
use Psr\Http\Message\ResponseInterface;

use function trigger_deprecation;

/**
* @mixin Assert
*/
Expand All @@ -21,6 +24,8 @@ public static function assertThatResponse(
Constraint $constraint,
string $message = '',
): void {
trigger_deprecation(Package::Name, '6.0.0', 'Please use `static::assertPsrResponse()` instead.');

static::assertThat($response, $constraint, $message);
}

Expand Down
7 changes: 7 additions & 0 deletions packages/testing/src/Database/RefreshDatabaseIfEmpty.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@
use Illuminate\Database\DatabaseManager;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\RefreshDatabaseState;
use LastDragon_ru\LaraASP\Testing\Package;
use PHPUnit\Framework\TestCase;

use function trigger_deprecation;

// phpcs:disable PSR1.Files.SideEffects

trigger_deprecation(Package::Name, '%{VERSION}', 'Please use own trait.');

/**
* The trait is very similar to standard {@link RefreshDatabase} but there is one
* difference: it will refresh the database only if it is empty. This is very
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,5 @@
<env verbatim="true" name="DB_CONNECTION" value="sqlite"/>
<env verbatim="true" name="DB_DATABASE" value=":memory:"/>
<env verbatim="true" name="SCOUT_DRIVER" value="null"/>
<env verbatim="true" name="TESTBENCH_CONVERT_DEPRECATIONS_TO_EXCEPTIONS" value="true"/>
</php>
</phpunit>

0 comments on commit 4979a4e

Please sign in to comment.