Skip to content

Commit 4d9862a

Browse files
authored
adds better CS rules (GoogleCloudPlatform#970)
1 parent c4758b2 commit 4d9862a

16 files changed

+28
-24
lines changed

.php_cs.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ return PhpCsFixer\Config::create()
66
'concat_space' => ['spacing' => 'one'],
77
'no_unused_imports' => true,
88
'method_argument_space' => false,
9+
'whitespace_after_comma_in_array' => true,
10+
'method_argument_space' => [
11+
'keep_multiple_spaces_after_comma' => true
12+
],
913
])
1014
->setFinder(
1115
PhpCsFixer\Finder::create()

dialogflow/test/sessionEntityTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static function setUpBeforeClass()
3737

3838
public function testCreateSessionEntityType()
3939
{
40-
$response = $this->runCommand('entity-type-create',[
40+
$response = $this->runCommand('entity-type-create', [
4141
'display-name' => self::$entityTypeDisplayName
4242
]);
4343
$this->runCommand('session-entity-type-create', [

spanner/src/read_write_transaction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function read_write_transaction($instanceId, $databaseId)
5656
$transferAmount = 200000;
5757

5858
// Read the second album's budget.
59-
$secondAlbumKey = [2,2];
59+
$secondAlbumKey = [2, 2];
6060
$secondAlbumKeySet = $spanner->keySet(['keys' => [$secondAlbumKey]]);
6161
$secondAlbumResult = $t->read(
6262
'Albums',
@@ -74,7 +74,7 @@ function read_write_transaction($instanceId, $databaseId)
7474
);
7575
}
7676

77-
$firstAlbumKey = [1,1];
77+
$firstAlbumKey = [1, 1];
7878
$firstAlbumKeySet = $spanner->keySet(['keys' => [$firstAlbumKey]]);
7979
$firstAlbumResult = $t->read(
8080
'Albums',

speech/test/speechTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ public function testTranscribeModel()
5454
[$path, 'video']
5555
);
5656
// $this->assertContains('the weather outside is sunny',$output);
57-
$this->assertContains('how old is the Brooklyn Bridge',$output);
57+
$this->assertContains('how old is the Brooklyn Bridge', $output);
5858
}
5959

6060
public function testTranscribePunctuation()
6161
{
6262
$path = __DIR__ . '/data/audio32KHz.raw';
6363
$output = $this->runSnippet('transcribe_auto_punctuation', [$path]);
64-
$this->assertContains('How old is the Brooklyn Bridge',$output);
64+
$this->assertContains('How old is the Brooklyn Bridge', $output);
6565
}
6666

6767
/** @dataProvider provideTranscribe */

texttospeech/test/textToSpeechTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testSynthesizeSsml()
4040
['Hello there.']
4141
);
4242
$this->assertContains('Audio content written to', $output);
43-
$this->assertGreaterThan(0,filesize('output.mp3'));
43+
$this->assertGreaterThan(0, filesize('output.mp3'));
4444
unlink('output.mp3');
4545
}
4646

@@ -49,7 +49,7 @@ public function testSynthesizeText()
4949
$output = $this->runSnippet('synthesize_text', ['hello there']);
5050

5151
$this->assertContains('Audio content written to', $output);
52-
$this->assertGreaterThan(0,filesize('output.mp3'));
52+
$this->assertGreaterThan(0, filesize('output.mp3'));
5353
unlink('output.mp3');
5454
}
5555

@@ -60,7 +60,7 @@ public function testSynthesizeTextEffectsProfile()
6060
['hello there', 'telephony-class-application']
6161
);
6262
$this->assertContains('Audio content written to', $output);
63-
$this->assertGreaterThan(0,filesize('output.mp3'));
63+
$this->assertGreaterThan(0, filesize('output.mp3'));
6464
unlink('output.mp3');
6565
}
6666

@@ -70,7 +70,7 @@ public function testSynthesizeSsmlFile()
7070
$output = $this->runSnippet('synthesize_ssml_file', [$path]);
7171

7272
$this->assertContains('Audio content written to', $output);
73-
$this->assertGreaterThan(0,filesize('output.mp3'));
73+
$this->assertGreaterThan(0, filesize('output.mp3'));
7474
unlink('output.mp3');
7575
}
7676

@@ -80,7 +80,7 @@ public function testSynthesizeTextFile()
8080
$output = $this->runSnippet('synthesize_text_file', [$path]);
8181

8282
$this->assertContains('Audio content written to', $output);
83-
$this->assertGreaterThan(0,filesize('output.mp3'));
83+
$this->assertGreaterThan(0, filesize('output.mp3'));
8484
unlink('output.mp3');
8585
}
8686

@@ -92,7 +92,7 @@ public function testSynthesizeTextEffectsProfileFile()
9292
[$path, 'telephony-class-application']
9393
);
9494
$this->assertContains('Audio content written to', $output);
95-
$this->assertGreaterThan(0,filesize('output.mp3'));
95+
$this->assertGreaterThan(0, filesize('output.mp3'));
9696
unlink('output.mp3');
9797
}
9898
}

vision/src/detect_crop_hints.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function detect_crop_hints($path)
4242
$bounds[] = sprintf('(%d,%d)', $vertex->getX(),
4343
$vertex->getY());
4444
}
45-
print('Bounds: ' . join(', ',$bounds) . PHP_EOL);
45+
print('Bounds: ' . join(', ', $bounds) . PHP_EOL);
4646
}
4747
} else {
4848
print('No crop hints' . PHP_EOL);

vision/src/detect_crop_hints_gcs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function detect_crop_hints_gcs($path)
4141
$bounds[] = sprintf('(%d,%d)', $vertex->getX(),
4242
$vertex->getY());
4343
}
44-
print('Bounds: ' . join(', ',$bounds) . PHP_EOL);
44+
print('Bounds: ' . join(', ', $bounds) . PHP_EOL);
4545
}
4646
} else {
4747
print('No crop hints' . PHP_EOL);

vision/src/detect_document_text.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function detect_document_text($path)
5656
$bounds[] = sprintf('(%d,%d)', $vertex->getX(),
5757
$vertex->getY());
5858
}
59-
print('Bounds: ' . join(', ',$bounds) . PHP_EOL);
59+
print('Bounds: ' . join(', ', $bounds) . PHP_EOL);
6060
print(PHP_EOL);
6161
}
6262
}

vision/src/detect_document_text_gcs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function detect_document_text_gcs($path)
5555
$bounds[] = sprintf('(%d,%d)', $vertex->getX(),
5656
$vertex->getY());
5757
}
58-
print('Bounds: ' . join(', ',$bounds) . PHP_EOL);
58+
print('Bounds: ' . join(', ', $bounds) . PHP_EOL);
5959

6060
print(PHP_EOL);
6161
}

vision/src/detect_face.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function detect_face($path, $outFile = null)
3838

3939
# names of likelihood from google.cloud.vision.enums
4040
$likelihoodName = ['UNKNOWN', 'VERY_UNLIKELY', 'UNLIKELY',
41-
'POSSIBLE','LIKELY', 'VERY_LIKELY'];
41+
'POSSIBLE', 'LIKELY', 'VERY_LIKELY'];
4242

4343
printf("%d faces found:" . PHP_EOL, count($faces));
4444
foreach ($faces as $face) {
@@ -57,7 +57,7 @@ function detect_face($path, $outFile = null)
5757
foreach ($vertices as $vertex) {
5858
$bounds[] = sprintf('(%d,%d)', $vertex->getX(), $vertex->getY());
5959
}
60-
print('Bounds: ' . join(', ',$bounds) . PHP_EOL);
60+
print('Bounds: ' . join(', ', $bounds) . PHP_EOL);
6161
print(PHP_EOL);
6262
}
6363
// [END vision_face_detection]

vision/src/detect_face_gcs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function detect_face_gcs($path)
3232

3333
# names of likelihood from google.cloud.vision.enums
3434
$likelihoodName = ['UNKNOWN', 'VERY_UNLIKELY', 'UNLIKELY',
35-
'POSSIBLE','LIKELY', 'VERY_LIKELY'];
35+
'POSSIBLE', 'LIKELY', 'VERY_LIKELY'];
3636

3737
printf("%d faces found:" . PHP_EOL, count($faces));
3838
foreach ($faces as $face) {
@@ -51,7 +51,7 @@ function detect_face_gcs($path)
5151
foreach ($vertices as $vertex) {
5252
$bounds[] = sprintf('(%d,%d)', $vertex->getX(), $vertex->getY());
5353
}
54-
print('Bounds: ' . join(', ',$bounds) . PHP_EOL);
54+
print('Bounds: ' . join(', ', $bounds) . PHP_EOL);
5555
print(PHP_EOL);
5656
}
5757

vision/src/detect_safe_search.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function detect_safe_search($path)
3939

4040
# names of likelihood from google.cloud.vision.enums
4141
$likelihoodName = ['UNKNOWN', 'VERY_UNLIKELY', 'UNLIKELY',
42-
'POSSIBLE','LIKELY', 'VERY_LIKELY'];
42+
'POSSIBLE', 'LIKELY', 'VERY_LIKELY'];
4343

4444
printf("Adult: %s" . PHP_EOL, $likelihoodName[$adult]);
4545
printf("Medical: %s" . PHP_EOL, $likelihoodName[$medical]);

vision/src/detect_safe_search_gcs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function detect_safe_search_gcs($path)
3939

4040
# names of likelihood from google.cloud.vision.enums
4141
$likelihoodName = ['UNKNOWN', 'VERY_UNLIKELY', 'UNLIKELY',
42-
'POSSIBLE','LIKELY', 'VERY_LIKELY'];
42+
'POSSIBLE', 'LIKELY', 'VERY_LIKELY'];
4343

4444
printf("Adult: %s" . PHP_EOL, $likelihoodName[$adult]);
4545
printf("Medical: %s" . PHP_EOL, $likelihoodName[$medical]);

vision/src/detect_text.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function detect_text($path)
4141
foreach ($vertices as $vertex) {
4242
$bounds[] = sprintf('(%d,%d)', $vertex->getX(), $vertex->getY());
4343
}
44-
print('Bounds: ' . join(', ',$bounds) . PHP_EOL);
44+
print('Bounds: ' . join(', ', $bounds) . PHP_EOL);
4545
}
4646

4747
$imageAnnotator->close();

vision/src/detect_text_gcs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function detect_text_gcs($path)
4040
foreach ($vertices as $vertex) {
4141
$bounds[] = sprintf('(%d,%d)', $vertex->getX(), $vertex->getY());
4242
}
43-
print('Bounds: ' . join(', ',$bounds) . PHP_EOL);
43+
print('Bounds: ' . join(', ', $bounds) . PHP_EOL);
4444
}
4545

4646
if ($error = $response->getError()) {

vision/vision.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
->setCode(function ($input, $output) {
256256
$path = $input->getArgument('path');
257257
$output = $input->getArgument('output');
258-
detect_pdf_gcs($path,$output);
258+
detect_pdf_gcs($path, $output);
259259
})
260260
);
261261

0 commit comments

Comments
 (0)