Skip to content

Commit 140bd36

Browse files
committed
Rename library/ to src/
We've always considered renaming this directory, as it's not a common standard to name `library` the directory where the source code of a library it. Having it as `src/` is a common pattern we find in several PHP libraries these days. Acked-by: Alexandre Gomes Gaigalas <alganet@gmail.com>
1 parent a372a0b commit 140bd36

273 files changed

Lines changed: 17 additions & 17 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@
6262
},
6363
"autoload": {
6464
"psr-4": {
65-
"Respect\\Validation\\": "library/"
65+
"Respect\\Validation\\": "src/"
6666
},
6767
"files": ["aliases.php"]
6868
},
6969
"autoload-dev": {
7070
"psr-4": {
7171
"Respect\\Dev\\": "src-dev/",
7272
"Respect\\Validation\\": "tests/unit/",
73-
"Respect\\Validation\\Test\\": "tests/library/"
73+
"Respect\\Validation\\Test\\": "tests/src/"
7474
}
7575
},
7676
"scripts": {

docs/validators/Directory.md

Lines changed: 1 addition & 1 deletion

phpcs.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<arg value="p" />
1212
<arg value="s" />
1313

14-
<file>library/</file>
14+
<file>src/</file>
1515
<file>src-dev/</file>
1616
<file>tests/</file>
1717

@@ -20,7 +20,7 @@
2020
<!-- Exclusions -->
2121
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
2222
<rule ref="Squiz.Arrays.ArrayDeclaration.ValueNoNewline">
23-
<exclude-pattern>library/Validators/Tld.php</exclude-pattern>
23+
<exclude-pattern>src/Validators/Tld.php</exclude-pattern>
2424
</rule>
2525
<rule ref="Squiz.Functions.GlobalFunction">
2626
<exclude-pattern>tests/Pest.php</exclude-pattern>

phpstan.neon.dist

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ parameters:
66
-
77
# Why: SimpleXMLElement is weird and doesn't implement anything ArrayAccess-like
88
message: '/Instanceof between mixed and SimpleXMLElement will always evaluate to false\./'
9-
path: library/Validators/ArrayVal.php
9+
path: src/Validators/ArrayVal.php
1010
- message: '/Call to an undefined method .+::expectException\(\)/'
1111
path: tests/Pest.php
1212
- message: '/Undefined variable: \$this/'
1313
path: tests/feature/Validators/SizeTest.php
1414
- message: '/Undefined variable: \$this/'
1515
path: tests/Pest.php
1616
- message: '/Method .+\\TestingHandler::handle\(\) never returns null so it can be removed from the return type./'
17-
path: tests/library/Message/TestingHandler.php
17+
path: tests/src/Message/TestingHandler.php
1818
- message: '/Access to an undefined property PHPUnit\\Framework\\TestCase/'
1919
path: tests/feature/Validators/SizeTest.php
2020
- message: '/Property Respect\\Validation\\Test\\Stubs\\.+::\$[a-zA-Z]+ is never read, only written./'
21-
path: tests/library/Stubs
21+
path: tests/src/Stubs
2222
- message: '/Call to an undefined method Pest\\PendingCalls\\TestCall|Pest\\Support\\HigherOrderTapProxy::with\(\)./'
2323
path: tests/feature/SerializableTest.php
2424
level: 8
2525
treatPhpDocTypesAsCertain: false
2626
paths:
27-
- library/
27+
- src/
2828
- tests/

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</testsuites>
1818
<source>
1919
<include>
20-
<directory suffix=".php">library/</directory>
20+
<directory suffix=".php">src/</directory>
2121
</include>
2222
</source>
2323
</phpunit>

src-dev/Commands/CreateMixinCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
116116
$io->title('Generating mixin interfaces');
117117

118118
// Scan validators directory
119-
$libraryDir = dirname(__DIR__, 2) . '/library';
120-
$validatorsDir = $libraryDir . '/Validators';
119+
$srcDir = dirname(__DIR__, 2) . '/src';
120+
$validatorsDir = $srcDir . '/Validators';
121121
$validators = $this->scanValidators($validatorsDir);
122122

123123
$io->text(sprintf('Found %d validators', count($validators)));
@@ -201,7 +201,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
201201

202202
// Run code beautifier
203203
$io->section('Running code beautifier');
204-
$mixinsDir = $libraryDir . '/Mixins';
204+
$mixinsDir = $srcDir . '/Mixins';
205205
$phpcbfPath = dirname(__DIR__, 2) . '/vendor/bin/phpcbf';
206206

207207
if (file_exists($phpcbfPath)) {
@@ -344,7 +344,7 @@ private function addParameterToMethod(Method $method, ReflectionParameter $refle
344344

345345
private function overwriteFile(string $content, string $basename): void
346346
{
347-
$libraryDir = dirname(__DIR__, 2) . '/library';
347+
$srcDir = dirname(__DIR__, 2) . '/src';
348348

349349
$SPDX = ' * SPDX';
350350

@@ -359,7 +359,7 @@ private function overwriteFile(string $content, string $basename): void
359359
]));
360360

361361
file_put_contents(
362-
sprintf('%s/Mixins/%s.php', $libraryDir, $basename),
362+
sprintf('%s/Mixins/%s.php', $srcDir, $basename),
363363
$finalContent,
364364
);
365365
}

src-dev/Commands/SmokeTestsCheckCompleteCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final class SmokeTestsCheckCompleteCommand extends Command
3636
{
3737
protected function execute(InputInterface $input, OutputInterface $output): int
3838
{
39-
$validatorDir = dirname(__DIR__, 2) . '/library/Validators';
39+
$validatorDir = dirname(__DIR__, 2) . '/src/Validators';
4040

4141
$missingSmokeTests = array_diff(
4242
array_map(

0 commit comments

Comments
 (0)