Skip to content

Commit

Permalink
Merge test libs dir into src (#227)
Browse files Browse the repository at this point in the history
I couldn't tell where to put this file and that file and it makes no sense to have two locations to always decide one.

Includes @ondrejmirtes' solution for phpstan/phpstan#10268 cherry-picked from #226, thanks!
  • Loading branch information
spaze committed Dec 9, 2023
2 parents f0a6f69 + 007ee6c commit 67ea78d
Show file tree
Hide file tree
Showing 23 changed files with 10 additions and 50 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
"autoload": {
"psr-4": {"Spaze\\PHPStan\\Rules\\Disallowed\\": "src"}
},
"autoload-dev": {
"classmap": ["tests/src"]
},
"scripts": {
"lint": "vendor/bin/parallel-lint --colors src/ tests/",
"lint-7.x": "vendor/bin/parallel-lint --colors src/ tests/ --exclude tests/src/TypesEverywhere.php --exclude tests/src/disallowed/functionCallsNamedParams.php --exclude tests/src/disallowed-allow/functionCallsNamedParams.php --exclude tests/src/disallowed/attributeUsages.php --exclude tests/src/disallowed-allow/attributeUsages.php",
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
<exclude name="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall" />
<exclude name="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration" />
</rule>
<exclude-pattern>tests/libs/</exclude-pattern>
<exclude-pattern>tests/src/</exclude-pattern>
</ruleset>
29 changes: 0 additions & 29 deletions tests/BootstrapTest.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Calls/FunctionCallsAllowInFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function getRule(): Rule
public function testRule(): void
{
// Based on the configuration above, in this file:
$this->analyse([__DIR__ . '/../libs/Functions.php'], [
$this->analyse([__DIR__ . '/../src/Functions.php'], [
[
// expect this error message:
'Calling sha1() is forbidden. [sha1() matches sha*()]',
Expand Down
2 changes: 1 addition & 1 deletion tests/Calls/FunctionCallsAllowInMethodsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function getRule(): Rule
public function testRule(): void
{
// Based on the configuration above, in this file:
$this->analyse([__DIR__ . '/../libs/Royale.php'], [
$this->analyse([__DIR__ . '/../src/Royale.php'], [
[
// expect this error message:
'Calling sha1() is forbidden.',
Expand Down
4 changes: 2 additions & 2 deletions tests/Calls/FunctionCallsDefinedInTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ protected function getRule(): Rule
[
[
'function' => '\\Foo\\Bar\\Waldo\\f*()',
'definedIn' => __DIR__ . '/../libs/Fun*.php',
'definedIn' => __DIR__ . '/../src/Fun*.php',
'allowIn' => [
__DIR__ . '/../src/disallowed-allow/*.php',
__DIR__ . '/../src/*-allow/*.*',
],
],
[
'function' => '\\Foo\\Bar\\Waldo\\b*()',
'definedIn' => __DIR__ . '/../libs/ThisFileDoesNotExist.php',
'definedIn' => __DIR__ . '/../src/ThisFileDoesNotExist.php',
'allowIn' => [
__DIR__ . '/../src/disallowed-allow/*.php',
__DIR__ . '/../src/*-allow/*.*',
Expand Down
2 changes: 1 addition & 1 deletion tests/Calls/MethodCallsDefinedInTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function getRule(): Rule
[
[
'method' => '*',
'definedIn' => __DIR__ . '/../libs/Bl*',
'definedIn' => __DIR__ . '/../src/Bl*',
'allowIn' => [
__DIR__ . '/../src/disallowed-allow/*.php',
__DIR__ . '/../src/*-allow/*.*',
Expand Down
2 changes: 1 addition & 1 deletion tests/Calls/NewCallsDefinedInTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function getRule(): Rule
[
[
'method' => '*',
'definedIn' => __DIR__ . '/../libs/Bl*',
'definedIn' => __DIR__ . '/../src/Bl*',
'allowIn' => [
__DIR__ . '/../src/disallowed-allow/*.php',
__DIR__ . '/../src/*-allow/*.*',
Expand Down
14 changes: 0 additions & 14 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,3 @@
declare(strict_types = 1);

require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/libs/AttributeClass.php';
require __DIR__ . '/libs/AttributeEntity.php';
require __DIR__ . '/libs/Bar.php';
require __DIR__ . '/libs/Blade.php';
require __DIR__ . '/libs/Constructor.php';
require __DIR__ . '/libs/Functions.php';
require __DIR__ . '/libs/Inheritance.php';
require __DIR__ . '/libs/Interfaces.php';
require __DIR__ . '/libs/Option.php';
require __DIR__ . '/libs/Royale.php';
require __DIR__ . '/libs/SomeInterface.php';
require __DIR__ . '/libs/TestException.php';
require __DIR__ . '/libs/TestTrait.php';
require __DIR__ . '/libs/Traits.php';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 67ea78d

Please sign in to comment.