Passed
Pull Request — master (#9)
by David
01:56
created
src/Helpers/NumericColumnLimitHelper.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __construct(Column $column)
36 36
     {
37
-        if (!\in_array($column->getType()->getName(), self::$handledNumberTypes, true)){
37
+        if (!\in_array($column->getType()->getName(), self::$handledNumberTypes, true)) {
38 38
             throw new UnsupportedDataTypeException('Unsupported column type : ' .
39 39
                 $column->getType()->getName() . 'only ' .
40 40
                 implode("', '", self::$handledNumberTypes) . ' types are supported.'
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
     public function getMinNumericValue()
51 51
     {
52 52
         $precisionValue = $this->getAbsValueByLengthPrecision($this->column);
53
-        switch ($this->column->getType()->getName()){
53
+        switch ($this->column->getType()->getName()) {
54 54
             case Type::BIGINT:
55 55
                 return $this->column->getUnsigned() ? 0 : bcmul('-1', bcpow('2', '63'));
56 56
                 break;
57 57
             case Type::INTEGER:
58
-                return $this->column->getUnsigned() ? 0 : max(-1 * $precisionValue, bcmul('-1' , bcpow('2', '31')));
58
+                return $this->column->getUnsigned() ? 0 : max(-1 * $precisionValue, bcmul('-1', bcpow('2', '31')));
59 59
                 break;
60 60
             case Type::SMALLINT:
61
-                return $this->column->getUnsigned() ? 0 : bcmul('-1' , bcpow('2', '15'));
61
+                return $this->column->getUnsigned() ? 0 : bcmul('-1', bcpow('2', '15'));
62 62
                 break;
63 63
             case Type::DECIMAL:
64 64
                 return $this->column->getUnsigned() ? 0 : -1 * $precisionValue;
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
     public function getMaxNumericValue()
77 77
     {
78 78
         $precisionValue = $this->getAbsValueByLengthPrecision($this->column);
79
-        switch ($this->column->getType()->getName()){
79
+        switch ($this->column->getType()->getName()) {
80 80
             case Type::BIGINT:
81
-                return $this->column->getUnsigned() ? bcsub(bcpow('2', '64'), 1) : bcsub(bcpow('2', '63') , '1');
81
+                return $this->column->getUnsigned() ? bcsub(bcpow('2', '64'), 1) : bcsub(bcpow('2', '63'), '1');
82 82
             case Type::INTEGER:
83
-                return $this->column->getUnsigned() ? bcsub(bcpow('2', '32'), 1) : min($precisionValue, bcsub( bcpow('2', '31') , '1'));
83
+                return $this->column->getUnsigned() ? bcsub(bcpow('2', '32'), 1) : min($precisionValue, bcsub(bcpow('2', '31'), '1'));
84 84
             case Type::SMALLINT:
85
-                return $this->column->getUnsigned() ? bcsub(bcpow('2', '16'), 1) : bcsub( bcpow('2', '15') , '1');
85
+                return $this->column->getUnsigned() ? bcsub(bcpow('2', '16'), 1) : bcsub(bcpow('2', '15'), '1');
86 86
             case Type::DECIMAL:
87 87
                 return $this->column->getUnsigned() ? 0 : $precisionValue;
88 88
             case Type::FLOAT:
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     private function getAbsValueByLengthPrecision(Column $column)
98 98
     {
99
-        switch ($column->getType()->getName()){
99
+        switch ($column->getType()->getName()) {
100 100
             case Type::DECIMAL:
101 101
                 $str = str_repeat('9', $column->getScale());
102 102
                 return (double) substr_replace($str, '.', $column->getScale() - $column->getPrecision(), 0);
Please login to merge, or discard this patch.
tests/Generators/BlobGeneratorTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     {
16 16
         $column = new Column('foo', Type::getType(Type::BINARY));
17 17
         $column->setLength(255);
18
-        $blobGenerator = new BlobGenerator(__DIR__.'/../fixtures/blob/*.png', $column);
18
+        $blobGenerator = new BlobGenerator(__DIR__ . '/../fixtures/blob/*.png', $column);
19 19
         $this->expectException(FileTooLargeException::class);
20 20
         $blobGenerator->__invoke();
21 21
     }
Please login to merge, or discard this patch.
src/Generators/BlobGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public function __invoke()
31 31
     {
32 32
         $files = glob($this->globExpression, GLOB_MARK);
33
-        $files = array_filter($files, function ($fileName){
33
+        $files = array_filter($files, function($fileName) {
34 34
             return strrpos($fileName, DIRECTORY_SEPARATOR) !== \strlen($fileName) - 1;
35 35
         });
36 36
         foreach ($files as $file) {
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
                 throw FileTooLargeException::create($file, $this->column);
40 40
             }
41 41
         }
42
-        if (\count($files) === 0){
43
-            throw new NoTestFilesFoundException("No files found for glob expression '".$this->globExpression."'");
42
+        if (\count($files) === 0) {
43
+            throw new NoTestFilesFoundException("No files found for glob expression '" . $this->globExpression . "'");
44 44
         }
45 45
         $files = array_values($files);
46 46
         $chosenFile = $files[random_int(0, \count($files) - 1)];
Please login to merge, or discard this patch.