Просмотр исходного кода

Merge pull request #1350 from PrivateBin/strict_types

enable strict types
El RIDO 2 лет назад
Родитель
Сommit
d190507fbe
50 измененных файлов с 53 добавлено и 52 удалено
  1. 1 0
      CHANGELOG.md
  2. 1 1
      bin/administration
  3. 2 2
      bin/configuration-test-generator
  4. 1 1
      bin/icon-test
  5. 1 1
      bin/migrate
  6. 1 1
      index.php
  7. 1 1
      lib/Configuration.php
  8. 1 1
      lib/Controller.php
  9. 2 2
      lib/Data/AbstractData.php
  10. 1 1
      lib/Data/Database.php
  11. 1 1
      lib/Data/Filesystem.php
  12. 1 1
      lib/Data/GoogleCloudStorage.php
  13. 1 1
      lib/Data/S3Storage.php
  14. 1 1
      lib/Filter.php
  15. 1 1
      lib/FormatV2.php
  16. 1 1
      lib/I18n.php
  17. 1 1
      lib/Json.php
  18. 1 1
      lib/Model.php
  19. 1 1
      lib/Model/AbstractModel.php
  20. 1 1
      lib/Model/Comment.php
  21. 1 1
      lib/Model/Paste.php
  22. 1 1
      lib/Persistence/AbstractPersistence.php
  23. 1 1
      lib/Persistence/PurgeLimiter.php
  24. 1 1
      lib/Persistence/ServerSalt.php
  25. 1 1
      lib/Persistence/TrafficLimiter.php
  26. 1 1
      lib/Request.php
  27. 1 1
      lib/View.php
  28. 1 1
      lib/Vizhash16x16.php
  29. 1 1
      lib/YourlsProxy.php
  30. 1 1
      tst/Bootstrap.php
  31. 1 1
      tst/ConfigurationTest.php
  32. 1 1
      tst/ControllerTest.php
  33. 1 1
      tst/ControllerWithDbTest.php
  34. 1 1
      tst/ControllerWithGcsTest.php
  35. 1 1
      tst/Data/DatabaseTest.php
  36. 1 1
      tst/Data/FilesystemTest.php
  37. 1 1
      tst/Data/GoogleCloudStorageTest.php
  38. 1 1
      tst/FilterTest.php
  39. 1 1
      tst/FormatV2Test.php
  40. 2 2
      tst/I18nTest.php
  41. 1 1
      tst/JsonApiTest.php
  42. 1 1
      tst/MigrateTest.php
  43. 1 1
      tst/ModelTest.php
  44. 1 1
      tst/Persistence/PurgeLimiterTest.php
  45. 1 1
      tst/Persistence/ServerSaltTest.php
  46. 1 1
      tst/Persistence/TrafficLimiterTest.php
  47. 1 1
      tst/RequestTest.php
  48. 1 1
      tst/ViewTest.php
  49. 1 1
      tst/Vizhash16x16Test.php
  50. 1 1
      tst/YourlsProxyTest.php

+ 1 - 0
CHANGELOG.md

@@ -2,6 +2,7 @@
 
 ## 1.7.4 (not yet released)
 * CHANGED: Saving markdown pastes uses `.md` extension instead of `.txt` (#1293)
+* CHANGED: Enable strict type checking in PHP (#1350)
 * FIXED: Reset password input field on creation of new paste (#1194)
 * FIXED: Allow database schema upgrade to skip versions (#1343)
 

+ 1 - 1
bin/administration

@@ -1,5 +1,5 @@
 #!/usr/bin/env php
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 2 - 2
bin/configuration-test-generator

@@ -1,5 +1,5 @@
 #!/usr/bin/env php
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *
@@ -413,7 +413,7 @@ class ConfigurationTestGenerator
     private function _getHeader()
     {
         return <<<'EOT'
-<?php
+<?php declare(strict_types=1);
 /**
  * DO NOT EDIT: This file is generated automatically using configGenerator.php
  */

+ 1 - 1
bin/icon-test

@@ -1,5 +1,5 @@
 #!/usr/bin/env php
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
bin/migrate

@@ -1,5 +1,5 @@
 #!/usr/bin/env php
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
index.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Configuration.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Controller.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 2 - 2
lib/Data/AbstractData.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *
@@ -181,7 +181,7 @@ abstract class AbstractData
     protected function getOpenSlot(array &$comments, $postdate)
     {
         if (array_key_exists($postdate, $comments)) {
-            $parts = explode('.', $postdate, 2);
+            $parts = explode('.', (string) $postdate, 2);
             if (!array_key_exists(1, $parts)) {
                 $parts[1] = 0;
             }

+ 1 - 1
lib/Data/Database.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Data/Filesystem.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Data/GoogleCloudStorage.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Data/S3Storage.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Filter.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/FormatV2.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/I18n.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Json.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Model.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Model/AbstractModel.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Model/Comment.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Model/Paste.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Persistence/AbstractPersistence.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Persistence/PurgeLimiter.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Persistence/ServerSalt.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Persistence/TrafficLimiter.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 /**
  * PrivateBin

+ 1 - 1
lib/Request.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/View.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
lib/Vizhash16x16.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * VizHash_GD
  *

+ 1 - 1
lib/YourlsProxy.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /**
  * PrivateBin
  *

+ 1 - 1
tst/Bootstrap.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use Google\Cloud\Core\Exception\BadRequestException;
 use Google\Cloud\Core\Exception\NotFoundException;

+ 1 - 1
tst/ConfigurationTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Configuration;

+ 1 - 1
tst/ControllerTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Controller;

+ 1 - 1
tst/ControllerWithDbTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PrivateBin\Data\Database;
 use PrivateBin\Persistence\ServerSalt;

+ 1 - 1
tst/ControllerWithGcsTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use Google\Auth\HttpHandler\HttpHandlerFactory;
 use GuzzleHttp\Client;

+ 1 - 1
tst/Data/DatabaseTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Controller;

+ 1 - 1
tst/Data/FilesystemTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Data\Filesystem;

+ 1 - 1
tst/Data/GoogleCloudStorageTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use Google\Auth\HttpHandler\HttpHandlerFactory;
 use GuzzleHttp\Client;

+ 1 - 1
tst/FilterTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Filter;

+ 1 - 1
tst/FormatV2Test.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\FormatV2;

+ 2 - 2
tst/I18nTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\I18n;
@@ -198,7 +198,7 @@ class I18nTest extends TestCase
         $languageCount = 0;
         foreach ($languageIterator as $file) {
             ++$languageCount;
-            $this->assertTrue(copy($file, $path . DIRECTORY_SEPARATOR . $file->getBasename()));
+            $this->assertTrue(copy($file->getPathname(), $path . DIRECTORY_SEPARATOR . $file->getBasename()));
         }
 
         I18nMock::resetPath($path);

+ 1 - 1
tst/JsonApiTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Controller;

+ 1 - 1
tst/MigrateTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Data\Database;
 use PrivateBin\Data\Filesystem;

+ 1 - 1
tst/ModelTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use Identicon\Identicon;
 use PHPUnit\Framework\TestCase;

+ 1 - 1
tst/Persistence/PurgeLimiterTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Data\Filesystem;

+ 1 - 1
tst/Persistence/ServerSaltTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Data\Filesystem;

+ 1 - 1
tst/Persistence/TrafficLimiterTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Data\Filesystem;

+ 1 - 1
tst/RequestTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Request;

+ 1 - 1
tst/ViewTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\I18n;

+ 1 - 1
tst/Vizhash16x16Test.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Data\Filesystem;

+ 1 - 1
tst/YourlsProxyTest.php

@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 use PHPUnit\Framework\TestCase;
 use PrivateBin\Configuration;