diff --git a/.php_cs.dist.php b/.php_cs.dist.php index 53a16da23..40a8ea8b9 100644 --- a/.php_cs.dist.php +++ b/.php_cs.dist.php @@ -31,7 +31,7 @@ $riskyRules = [ // 'comment_to_phpdoc' => false, // 'no_unset_on_property' => false, 'strict_param' => false, - 'native_constant_invocation' => false, + // 'native_constant_invocation' => false, 'php_unit_test_annotation' => false, 'php_unit_no_expectation_annotation' => false, 'declare_strict_types' => false, @@ -46,8 +46,8 @@ $riskyRules = [ // 'array_push' => false, 'ereg_to_preg' => false, 'error_suppression' => false, - 'fopen_flag_order' => false, - 'fopen_flags' => false, + // 'fopen_flag_order' => false, + // 'fopen_flags' => false, // 'logical_operators' => false, // 'modernize_types_casting' => false, // 'no_homoglyph_names' => false, diff --git a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php index 5f3d50682..ba2ce9f21 100644 --- a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php +++ b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php @@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Request; // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || PHP_SAPI === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || \PHP_SAPI === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php index 86ac35cee..095c6f463 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php @@ -15,6 +15,7 @@ use Chill\CustomFieldsBundle\Entity\CustomField; use Doctrine\Persistence\ObjectManager; use Symfony\Component\Form\DataTransformerInterface; use function array_key_exists; +use const JSON_THROW_ON_ERROR; class JsonCustomFieldToArrayTransformer implements DataTransformerInterface { diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php b/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php index 5f3d50682..ba2ce9f21 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php @@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Request; // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || PHP_SAPI === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || \PHP_SAPI === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorController.php index 9899e90ea..5baf6e225 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorController.php @@ -47,7 +47,7 @@ class DocGeneratorController extends AbstractController unlink($tmpfname); - $fileContent = fopen($tmpfname2, 'r'); // the generated file content + $fileContent = fopen($tmpfname2, 'rb'); // the generated file content $response = new Response(fread($fileContent, filesize($tmpfname2))); $disposition = HeaderUtils::makeDisposition( diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index 844b7db67..a130bcf15 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -76,7 +76,7 @@ class DocGeneratorTemplateController extends AbstractController unlink($tmpfname); - $fileContent = fopen($tmpfname2, 'r'); // the generated file content + $fileContent = fopen($tmpfname2, 'rb'); // the generated file content $genDocName = 'doc_' . sprintf('%010d', mt_rand()) . '.docx'; diff --git a/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php b/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php index 5b342b2fa..398b28685 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php +++ b/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php @@ -21,6 +21,7 @@ use function array_keys; use function array_search; use function count; use function in_array; +use const ARRAY_FILTER_USE_BOTH; class CRUDRoutesLoader extends Loader { diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index 4145e375e..5d7b39acc 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -196,7 +196,7 @@ class LoadPostalCodesCommand extends Command . 'have the right to read it.'); } - $resource = fopen($filename, 'r'); + $resource = fopen($filename, 'rb'); if (false == $resource) { throw new RuntimeException("The file '{$filename}' could not be opened."); diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php index 0320a3fa4..914fa15c3 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php @@ -228,7 +228,7 @@ class CSVFormatter implements FormatterInterface $content = []; // create a file pointer connected to the output stream - $output = fopen('php://output', 'w'); + $output = fopen('php://output', 'wb'); //title fputcsv($output, [$this->translator->trans($this->export->getTitle())]); diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php index d5ded2c31..bd6573056 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php @@ -115,7 +115,7 @@ class CSVListFormatter implements FormatterInterface $this->exportData = $exportData; $this->formatterData = $formatterData; - $output = fopen('php://output', 'w'); + $output = fopen('php://output', 'wb'); $this->prepareHeaders($output); diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php index 7b1c10709..65ea70e55 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php @@ -110,7 +110,7 @@ class CSVPivotedListFormatter implements FormatterInterface $this->exportData = $exportData; $this->formatterData = $formatterData; - $output = fopen('php://output', 'w'); + $output = fopen('php://output', 'wb'); $i = 1; $lines = []; diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php index 1a6bd494e..0fefdbb34 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php @@ -204,7 +204,7 @@ class SpreadSheetFormatter implements FormatterInterface $this->tempfile = tempnam(sys_get_temp_dir(), ''); $this->generateContent(); - $f = fopen($this->tempfile, 'r'); + $f = fopen($this->tempfile, 'rb'); $response->setContent(stream_get_contents($f)); fclose($f); diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php index f6fbff62f..7b4ffb3f6 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php @@ -199,7 +199,7 @@ class SpreadsheetListFormatter implements FormatterInterface $tempfile = tempnam(sys_get_temp_dir(), ''); $writer->save($tempfile); - $f = fopen($tempfile, 'r'); + $f = fopen($tempfile, 'rb'); $response->setContent(stream_get_contents($f)); fclose($f); diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php index e0fa0374c..59f6ab060 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php @@ -17,6 +17,8 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\OptionsResolver\OptionsResolver; +use const SORT_FLAG_CASE; +use const SORT_STRING; /** * Extends choice to allow adding select2 library on widget. diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php index a74454172..be8df20fe 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php @@ -17,6 +17,8 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\OptionsResolver\OptionsResolver; +use const SORT_FLAG_CASE; +use const SORT_STRING; /** * Extends choice to allow adding select2 library on widget for languages (multiple). diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php index ad58b058a..ac1b65f1f 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php @@ -15,6 +15,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\Voter\Voter; use function get_class; use function in_array; +use const E_USER_DEPRECATED; /** * Voter for Chill software. diff --git a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php index b874339b1..387a2ba3d 100644 --- a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php +++ b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php @@ -22,6 +22,7 @@ use function array_unique; use function array_values; use function count; use function ksort; +use const PHP_INT_MAX; /** * Utilities to compare date periods. diff --git a/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php b/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php index f4ffef120..d8da05328 100644 --- a/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php @@ -44,6 +44,8 @@ use function get_class; use function in_array; use function is_array; use function json_decode; +use const JSON_PRETTY_PRINT; +use const LC_TIME; final class ImportPeopleFromCSVCommand extends Command { @@ -771,7 +773,7 @@ final class ImportPeopleFromCSVCommand extends Command . 'have the right to read it.'); } - $resource = fopen($filename, 'r'); + $resource = fopen($filename, 'rb'); if (false == $resource) { throw new RuntimeException("The file '{$filename}' could not be opened."); diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 43391cc43..98b7d42f2 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -41,6 +41,7 @@ use Symfony\Component\Validator\GroupSequenceProviderInterface; use UnexpectedValueException; use function count; use function in_array; +use const SORT_REGULAR; /** * AccompanyingPeriod Class. diff --git a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php index 393ed2096..d3b4beb47 100644 --- a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php +++ b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\EventListener; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\PersonAltName; +use const MB_CASE_TITLE; class PersonEventListener { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php index dcd7b9075..1e09c9b94 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php @@ -17,6 +17,8 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use const SORT_FLAG_CASE; +use const SORT_STRING; /** * A type to select the marital status. diff --git a/src/Bundle/ChillPersonBundle/Resources/test/Fixtures/App/web/app_dev.php b/src/Bundle/ChillPersonBundle/Resources/test/Fixtures/App/web/app_dev.php index 5f3d50682..ba2ce9f21 100644 --- a/src/Bundle/ChillPersonBundle/Resources/test/Fixtures/App/web/app_dev.php +++ b/src/Bundle/ChillPersonBundle/Resources/test/Fixtures/App/web/app_dev.php @@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Request; // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || PHP_SAPI === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || \PHP_SAPI === 'cli-server') ) { header('HTTP/1.0 403 Forbidden');