From 0232dee4fbc057630ec4d6e13eb3148b62550f58 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Mon, 9 Jan 2017 03:33:29 +0300 Subject: [PATCH] Symfony upgraded to 3.2.1. Deprecations solved, BC breaks fixed. All tests passing right. --- app/AppKernel.php | 4 +- app/autoload.php | 2 +- app/config/config.yml | 10 +- app/config/config_prod.yml | 3 - app/console | 4 +- composer.json | 28 +- composer.lock | 646 ++++++++++-------- .../Controller/Api/AbstractApiController.php | 10 +- .../Controller/Api/CrawlerController.php | 2 +- .../Controller/ApiController.php | 3 +- .../Controller/MainController.php | 14 +- .../Controller/PostController.php | 3 +- .../Controller/UserController.php | 14 +- .../Resources/config/routing.yml | 18 +- .../Resources/config/services.yml | 64 +- web/app_dev.php | 4 +- 16 files changed, 447 insertions(+), 382 deletions(-) diff --git a/app/AppKernel.php b/app/AppKernel.php index 3fb3884..02c35a6 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -7,7 +7,7 @@ class AppKernel extends Kernel { public function registerBundles() { - $bundles = array( + $bundles = [ new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), @@ -22,7 +22,7 @@ class AppKernel extends Kernel new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new Skobkin\Bundle\PointToolsBundle\SkobkinPointToolsBundle(), - ); + ]; if (in_array($this->getEnvironment(), ['dev', 'test'])) { $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); diff --git a/app/autoload.php b/app/autoload.php index 8d60457..49fd591 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -6,6 +6,6 @@ use Composer\Autoload\ClassLoader; /** @var ClassLoader $loader */ $loader = require __DIR__.'/../vendor/autoload.php'; -AnnotationRegistry::registerLoader(array($loader, 'loadClass')); +AnnotationRegistry::registerLoader([$loader, 'loadClass']); return $loader; \ No newline at end of file diff --git a/app/config/config.yml b/app/config/config.yml index 17285c4..a1a6db8 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -37,9 +37,8 @@ sensio_framework_extra: # Twig Configuration twig: - form: - resources: - - bootstrap_3_layout.html.twig + form_themes: + - bootstrap_3_layout.html.twig debug: "%kernel.debug%" strict_variables: "%kernel.debug%" @@ -60,7 +59,7 @@ doctrine: auto_mapping: true doctrine_migrations: - dir_name: %kernel.root_dir%/DoctrineMigrations + dir_name: "%kernel.root_dir%/DoctrineMigrations" namespace: Application\Migrations table_name: migration_versions name: Application Migrations @@ -73,6 +72,9 @@ swiftmailer: password: "%mailer_password%" spool: { type: memory } +jms_serializer: + enable_short_alias: false + knp_markdown: parser: service: app.point.markdown_parser diff --git a/app/config/config_prod.yml b/app/config/config_prod.yml index 342837a..99a768f 100644 --- a/app/config/config_prod.yml +++ b/app/config/config_prod.yml @@ -1,9 +1,6 @@ imports: - { resource: config.yml } -#framework: -# validation: -# cache: apc #doctrine: # orm: diff --git a/app/console b/app/console index a98d116..ade8bbc 100755 --- a/app/console +++ b/app/console @@ -17,8 +17,8 @@ set_time_limit(0); $loader = require __DIR__.'/autoload.php'; $input = new ArgvInput(); -$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev'); -$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; +$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); +$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; if ($debug) { Debug::enable(); diff --git a/composer.json b/composer.json index e719afe..26cbca9 100644 --- a/composer.json +++ b/composer.json @@ -9,17 +9,19 @@ }, "require": { "php": ">=7.0.0", - "symfony/symfony": "2.8.*", - "doctrine/orm": "^2.4.8", - "doctrine/doctrine-bundle": "~1.4", - "twig/extensions": "~1.0", - "symfony/swiftmailer-bundle": "~2.3,>=2.3.10", - "symfony/monolog-bundle": "^3.0.2", - "sensio/distribution-bundle": "~5.0", - "sensio/framework-extra-bundle": "^3.0.2", - "incenteev/composer-parameter-handler": "~2.0", - "ob/highcharts-bundle": "^1.2", + "symfony/symfony": "3.2.*", + "doctrine/orm": "^2.5", + "doctrine/annotations": "^1.3.0", + "doctrine/doctrine-bundle": "^1.6", + "doctrine/doctrine-cache-bundle": "^1.2", "doctrine/doctrine-migrations-bundle": "^1.0", + "twig/extensions": "~1.0", + "symfony/swiftmailer-bundle": "^2.3.10", + "symfony/monolog-bundle": "^3.0.2", + "sensio/distribution-bundle": "^5.0", + "sensio/framework-extra-bundle": "^3.0.2", + "incenteev/composer-parameter-handler": "^2.0", + "ob/highcharts-bundle": "^1.2", "jms/serializer-bundle": "^1.1", "knplabs/knp-markdown-bundle": "^1.4", "knplabs/knp-paginator-bundle": "^2.5", @@ -27,8 +29,8 @@ "csa/guzzle-bundle": "^2.1" }, "require-dev": { - "sensio/generator-bundle": "~3.0", - "symfony/phpunit-bridge": "~2.7", + "sensio/generator-bundle": "^3.0", + "symfony/phpunit-bridge": "^3.0", "phpunit/phpunit": "^5.7", "doctrine/doctrine-fixtures-bundle": "^2.3" }, @@ -59,7 +61,7 @@ "file": "app/config/parameters.yml" }, "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } } } diff --git a/composer.lock b/composer.lock index 0e146d9..aef34ff 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "0ed6c570d9db8a02d84f65d8a5796f3e", + "content-hash": "7541afcce35278a2be523a6ee017f623", "packages": [ { "name": "csa/guzzle-bundle", @@ -1192,48 +1192,6 @@ ], "time": "2015-11-10T17:04:01+00:00" }, - { - "name": "ircmaxell/password-compat", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/ircmaxell/password_compat.git", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "autoload": { - "files": [ - "lib/password.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Anthony Ferrara", - "email": "ircmaxell@php.net", - "homepage": "http://blog.ircmaxell.com" - } - ], - "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", - "homepage": "https://github.com/ircmaxell/password_compat", - "keywords": [ - "hashing", - "password" - ], - "time": "2014-11-20T16:49:30+00:00" - }, { "name": "jdorn/sql-formatter", "version": "v1.2.17", @@ -2201,6 +2159,52 @@ ], "time": "2015-07-25T16:39:46+00:00" }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06T20:24:11+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -2576,59 +2580,6 @@ ], "time": "2017-01-03T12:32:45+00:00" }, - { - "name": "symfony/polyfill-apcu", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-apcu.git", - "reference": "5d4474f447403c3348e37b70acc2b95475b7befa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/5d4474f447403c3348e37b70acc2b95475b7befa", - "reference": "5d4474f447403c3348e37b70acc2b95475b7befa", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting apcu_* functions to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "apcu", - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2016-11-14T01:06:16+00:00" - }, { "name": "symfony/polyfill-intl-icu", "version": "v1.3.0", @@ -2746,120 +2697,6 @@ ], "time": "2016-11-14T01:06:16+00:00" }, - { - "name": "symfony/polyfill-php54", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0", - "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php54\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2016-11-14T01:06:16+00:00" - }, - { - "name": "symfony/polyfill-php55", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "03e3f0350bca2220e3623a0e340eef194405fc67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/03e3f0350bca2220e3623a0e340eef194405fc67", - "reference": "03e3f0350bca2220e3623a0e340eef194405fc67", - "shasum": "" - }, - "require": { - "ircmaxell/password-compat": "~1.0", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php55\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2016-11-14T01:06:16+00:00" - }, { "name": "symfony/polyfill-php56", "version": "v1.3.0", @@ -3027,67 +2864,6 @@ ], "time": "2016-11-14T01:06:16+00:00" }, - { - "name": "symfony/security-acl", - "version": "v3.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/security-acl.git", - "reference": "053b49bf4aa333a392c83296855989bcf88ddad1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/security-acl/zipball/053b49bf4aa333a392c83296855989bcf88ddad1", - "reference": "053b49bf4aa333a392c83296855989bcf88ddad1", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/security-core": "~2.8|~3.0" - }, - "require-dev": { - "doctrine/common": "~2.2", - "doctrine/dbal": "~2.2", - "psr/log": "~1.0", - "symfony/phpunit-bridge": "~2.8|~3.0" - }, - "suggest": { - "doctrine/dbal": "For using the built-in ACL implementation", - "symfony/class-loader": "For using the ACL generateSql script", - "symfony/finder": "For using the ACL generateSql script" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Security\\Acl\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Security Component - ACL (Access Control List)", - "homepage": "https://symfony.com", - "time": "2015-12-28T09:39:46+00:00" - }, { "name": "symfony/swiftmailer-bundle", "version": "v2.4.2", @@ -3149,39 +2925,41 @@ }, { "name": "symfony/symfony", - "version": "v2.8.15", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "3ec15b9379ebb0758e296d4193926a7b4121a964" + "reference": "5824d423678a0cc44f3eb46efc246aecd1836dd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/3ec15b9379ebb0758e296d4193926a7b4121a964", - "reference": "3ec15b9379ebb0758e296d4193926a7b4121a964", + "url": "https://api.github.com/repos/symfony/symfony/zipball/5824d423678a0cc44f3eb46efc246aecd1836dd7", + "reference": "5824d423678a0cc44f3eb46efc246aecd1836dd7", "shasum": "" }, "require": { "doctrine/common": "~2.4", - "php": ">=5.3.9", + "php": ">=5.5.9", + "psr/cache": "~1.0", "psr/log": "~1.0", - "symfony/polyfill-apcu": "~1.1", "symfony/polyfill-intl-icu": "~1.0", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php54": "~1.0", - "symfony/polyfill-php55": "~1.0", "symfony/polyfill-php56": "~1.0", "symfony/polyfill-php70": "~1.0", "symfony/polyfill-util": "~1.0", - "symfony/security-acl": "~2.7|~3.0.0", "twig/twig": "~1.28|~2.0" }, "conflict": { - "phpdocumentor/reflection": "<1.0.7" + "phpdocumentor/reflection-docblock": "<3.0", + "phpdocumentor/type-resolver": "<0.2.0" + }, + "provide": { + "psr/cache-implementation": "1.0" }, "replace": { "symfony/asset": "self.version", "symfony/browser-kit": "self.version", + "symfony/cache": "self.version", "symfony/class-loader": "self.version", "symfony/config": "self.version", "symfony/console": "self.version", @@ -3199,9 +2977,9 @@ "symfony/framework-bundle": "self.version", "symfony/http-foundation": "self.version", "symfony/http-kernel": "self.version", + "symfony/inflector": "self.version", "symfony/intl": "self.version", "symfony/ldap": "self.version", - "symfony/locale": "self.version", "symfony/monolog-bridge": "self.version", "symfony/options-resolver": "self.version", "symfony/process": "self.version", @@ -3217,7 +2995,6 @@ "symfony/security-http": "self.version", "symfony/serializer": "self.version", "symfony/stopwatch": "self.version", - "symfony/swiftmailer-bridge": "self.version", "symfony/templating": "self.version", "symfony/translation": "self.version", "symfony/twig-bridge": "self.version", @@ -3225,23 +3002,29 @@ "symfony/validator": "self.version", "symfony/var-dumper": "self.version", "symfony/web-profiler-bundle": "self.version", + "symfony/workflow": "self.version", "symfony/yaml": "self.version" }, "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/cache": "~1.6", "doctrine/data-fixtures": "1.0.*", "doctrine/dbal": "~2.4", - "doctrine/doctrine-bundle": "~1.2", + "doctrine/doctrine-bundle": "~1.4", "doctrine/orm": "~2.4,>=2.4.5", - "egulias/email-validator": "~1.2,>=1.2.1", + "egulias/email-validator": "~1.2,>=1.2.8|~2.0", "monolog/monolog": "~1.11", "ocramius/proxy-manager": "~0.4|~1.0|~2.0", - "phpdocumentor/reflection": "^1.0.7", - "symfony/phpunit-bridge": "~3.2" + "phpdocumentor/reflection-docblock": "^3.0", + "predis/predis": "~1.0", + "symfony/phpunit-bridge": "~3.2", + "symfony/polyfill-apcu": "~1.1", + "symfony/security-acl": "~2.8|~3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -3280,7 +3063,7 @@ "keywords": [ "framework" ], - "time": "2016-12-13T12:16:34+00:00" + "time": "2016-12-13T13:20:15+00:00" }, { "name": "twig/extensions", @@ -3721,6 +3504,48 @@ ], "time": "2015-11-04T21:23:23+00:00" }, + { + "name": "ircmaxell/password-compat", + "version": "v1.0.4", + "source": { + "type": "git", + "url": "https://github.com/ircmaxell/password_compat.git", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "autoload": { + "files": [ + "lib/password.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthony Ferrara", + "email": "ircmaxell@php.net", + "homepage": "http://blog.ircmaxell.com" + } + ], + "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", + "homepage": "https://github.com/ircmaxell/password_compat", + "keywords": [ + "hashing", + "password" + ], + "time": "2014-11-20T16:49:30+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.5.5", @@ -4924,16 +4749,16 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v2.8.15", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "3a1f8c81595f8f69e24cf03134996cb99a8537c1" + "reference": "65e64a4f99cbaeae718573c3347fbe800f3f6661" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/3a1f8c81595f8f69e24cf03134996cb99a8537c1", - "reference": "3a1f8c81595f8f69e24cf03134996cb99a8537c1", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/65e64a4f99cbaeae718573c3347fbe800f3f6661", + "reference": "65e64a4f99cbaeae718573c3347fbe800f3f6661", "shasum": "" }, "require": { @@ -4942,10 +4767,13 @@ "suggest": { "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" }, + "bin": [ + "bin/simple-phpunit" + ], "type": "symfony-bridge", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -4975,7 +4803,235 @@ ], "description": "Symfony PHPUnit Bridge", "homepage": "https://symfony.com", - "time": "2016-11-16T18:56:22+00:00" + "time": "2016-12-12T13:31:08+00:00" + }, + { + "name": "symfony/polyfill-apcu", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-apcu.git", + "reference": "5d4474f447403c3348e37b70acc2b95475b7befa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/5d4474f447403c3348e37b70acc2b95475b7befa", + "reference": "5d4474f447403c3348e37b70acc2b95475b7befa", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting apcu_* functions to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "apcu", + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14T01:06:16+00:00" + }, + { + "name": "symfony/polyfill-php54", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php54.git", + "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0", + "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php54\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14T01:06:16+00:00" + }, + { + "name": "symfony/polyfill-php55", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php55.git", + "reference": "03e3f0350bca2220e3623a0e340eef194405fc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/03e3f0350bca2220e3623a0e340eef194405fc67", + "reference": "03e3f0350bca2220e3623a0e340eef194405fc67", + "shasum": "" + }, + "require": { + "ircmaxell/password-compat": "~1.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php55\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14T01:06:16+00:00" + }, + { + "name": "symfony/security-acl", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-acl.git", + "reference": "053b49bf4aa333a392c83296855989bcf88ddad1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-acl/zipball/053b49bf4aa333a392c83296855989bcf88ddad1", + "reference": "053b49bf4aa333a392c83296855989bcf88ddad1", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/security-core": "~2.8|~3.0" + }, + "require-dev": { + "doctrine/common": "~2.2", + "doctrine/dbal": "~2.2", + "psr/log": "~1.0", + "symfony/phpunit-bridge": "~2.8|~3.0" + }, + "suggest": { + "doctrine/dbal": "For using the built-in ACL implementation", + "symfony/class-loader": "For using the ACL generateSql script", + "symfony/finder": "For using the ACL generateSql script" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Acl\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - ACL (Access Control List)", + "homepage": "https://symfony.com", + "time": "2015-12-28T09:39:46+00:00" }, { "name": "webmozart/assert", diff --git a/src/Skobkin/Bundle/PointToolsBundle/Controller/Api/AbstractApiController.php b/src/Skobkin/Bundle/PointToolsBundle/Controller/Api/AbstractApiController.php index ec39372..dee8fc6 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Controller/Api/AbstractApiController.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Controller/Api/AbstractApiController.php @@ -3,13 +3,13 @@ namespace Skobkin\Bundle\PointToolsBundle\Controller\Api; use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Response; class AbstractApiController extends Controller { - protected function createSuccessResponse($data, $code = 200) + protected function createSuccessResponse($data, $code = 200): Response { - return new JsonResponse([ + return $this->json([ 'status' => 'success', 'data' => $data, ], $code); @@ -18,9 +18,9 @@ class AbstractApiController extends Controller /** * */ - protected function createErrorResponse($message, $code = 400) + protected function createErrorResponse($message, $code = 400): Response { - return new JsonResponse([ + return $this->json([ 'status' => 'fail', 'error' => [ 'code' => (int) $code, diff --git a/src/Skobkin/Bundle/PointToolsBundle/Controller/Api/CrawlerController.php b/src/Skobkin/Bundle/PointToolsBundle/Controller/Api/CrawlerController.php index c0fbaaf..277aabc 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Controller/Api/CrawlerController.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Controller/Api/CrawlerController.php @@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Response; class CrawlerController extends AbstractApiController { - public function receiveAllPageAction(Request $request) + public function receiveAllPageAction(Request $request): Response { $remoteToken = $request->request->get('token'); $localToken = $this->getParameter('crawler_token'); diff --git a/src/Skobkin/Bundle/PointToolsBundle/Controller/ApiController.php b/src/Skobkin/Bundle/PointToolsBundle/Controller/ApiController.php index 51b1afb..b2dc722 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Controller/ApiController.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Controller/ApiController.php @@ -6,7 +6,6 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Skobkin\Bundle\PointToolsBundle\Entity\SubscriptionEvent; use Skobkin\Bundle\PointToolsBundle\Entity\User; use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; class ApiController extends Controller @@ -41,6 +40,6 @@ class ApiController extends Controller ]; } - return new JsonResponse($data); + return $this->json($data); } } diff --git a/src/Skobkin/Bundle/PointToolsBundle/Controller/MainController.php b/src/Skobkin/Bundle/PointToolsBundle/Controller/MainController.php index e486635..07340bc 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Controller/MainController.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Controller/MainController.php @@ -8,12 +8,13 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Form\FormError; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; class MainController extends Controller { const AJAX_AUTOCOMPLETE_SIZE = 10; - public function indexAction(Request $request) + public function indexAction(Request $request): Response { /** @var EntityManager $em */ $em = $this->getDoctrine()->getManager(); @@ -23,7 +24,6 @@ class MainController extends Controller null, [ 'action' => $this->generateUrl('index'), - 'method' => 'POST', ] ); @@ -43,20 +43,20 @@ class MainController extends Controller 'form' => $form->createView(), 'autocomplete_size' => self::AJAX_AUTOCOMPLETE_SIZE, 'users_count' => $em->getRepository('SkobkinPointToolsBundle:User')->getUsersCount(), - 'subscribers_count' => $em->getRepository('SkobkinPointToolsBundle:Subscription')->getUserSubscribersCountById($this->container->getParameter('point_id')), + 'subscribers_count' => $em->getRepository('SkobkinPointToolsBundle:Subscription')->getUserSubscribersCountById($this->getParameter('point_id')), 'events_count' => $em->getRepository('SkobkinPointToolsBundle:SubscriptionEvent')->getLastDayEventsCount(), - 'service_login' => $this->container->getParameter('point_login'), + 'service_login' => $this->getParameter('point_login'), ]); } /** * Returns user search autocomplete data in JSON * - * @param $login + * @param string $login * * @return JsonResponse */ - public function searchUserAjaxAction($login) + public function searchUserAjaxAction(string $login): Response { $em = $this->getDoctrine()->getManager(); @@ -69,6 +69,6 @@ class MainController extends Controller ]; } - return new JsonResponse($result); + return $this->json($result); } } diff --git a/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php b/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php index 6c5d828..2617387 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php @@ -3,7 +3,6 @@ namespace Skobkin\Bundle\PointToolsBundle\Controller; use Skobkin\Bundle\PointToolsBundle\Entity\Blogs\Post; -use Skobkin\Bundle\PointToolsBundle\Service\UserApi; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Symfony\Component\HttpFoundation\Response; @@ -15,7 +14,7 @@ class PostController extends Controller * * @return Response */ - public function showAction(Post $post) + public function showAction(Post $post): Response { return $this->render('SkobkinPointToolsBundle:Post:show.html.twig', [ 'post' => $this->getDoctrine()->getRepository('SkobkinPointToolsBundle:Blogs\Post')->getPostWithComments($post->getId()), diff --git a/src/Skobkin/Bundle/PointToolsBundle/Controller/UserController.php b/src/Skobkin/Bundle/PointToolsBundle/Controller/UserController.php index fd3e7b9..4a2b6e3 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Controller/UserController.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Controller/UserController.php @@ -9,13 +9,14 @@ use Skobkin\Bundle\PointToolsBundle\Service\UserApi; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Ob\HighchartsBundle\Highcharts\Highchart; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; class UserController extends Controller { /** * @param string $login */ - public function showAction(Request $request, $login) + public function showAction(Request $request, string $login): Response { /** @var EntityManager $em */ $em = $this->getDoctrine()->getManager(); @@ -35,7 +36,7 @@ class UserController extends Controller 10 ); - $userApi = $this->container->get('app.point.api_user'); + $userApi = $this->get('app.point.api_user'); return $this->render('SkobkinPointToolsBundle:User:show.html.twig', [ 'user' => $user, @@ -46,7 +47,7 @@ class UserController extends Controller ]); } - public function topAction() + public function topAction(): Response { $topUsers = $this->getDoctrine()->getManager()->getRepository('SkobkinPointToolsBundle:User')->getTopUsers(); @@ -59,12 +60,15 @@ class UserController extends Controller } /** + * @todo move to the service + * * @param TopUserDTO[] $topUsers + * * @return Highchart */ - private function createTopUsersGraph(array $topUsers = []) + private function createTopUsersGraph(array $topUsers = []): Highchart { - $translator = $this->container->get('translator'); + $translator = $this->get('translator'); $chartData = [ 'titles' => [], diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/config/routing.yml b/src/Skobkin/Bundle/PointToolsBundle/Resources/config/routing.yml index c50eedf..7c1279e 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Resources/config/routing.yml +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/config/routing.yml @@ -1,46 +1,52 @@ index: path: / defaults: { _controller: SkobkinPointToolsBundle:Main:index } + methods: [POST, GET] telegram_webhook: path: /telegram/webhook/{token} defaults: { _controller: SkobkinPointToolsBundle:Telegram/WebHook:receiveUpdate, _format: json } methods: [POST] requirements: - token: "\d+\:[\w-]+" + token: '\d+\:[\w-]+' _format: json user_search_ajax: path: /ajax/users/search/{login} defaults: { _controller: SkobkinPointToolsBundle:Main:searchUserAjax, _format: json } + methods: [GET] requirements: - login: "[\w-]*" + login: '[\w-]*' _format: json user_show: path: /user/{login} defaults: { _controller: SkobkinPointToolsBundle:User:show } + methods: [GET] requirements: - login: "[\w-]+" + login: '[\w-]+' users_top: path: /users/top defaults: { _controller: SkobkinPointToolsBundle:User:top } + methods: [GET] events_last: path: /events/last defaults: { _controller: SkobkinPointToolsBundle:Events:last } + methods: [GET] post_show: path: /{id} defaults: { _controller: SkobkinPointToolsBundle:Post:show } + methods: [GET] requirements: - id: "[a-z]+" + id: '[a-z]+' api_public: - resource: "@SkobkinPointToolsBundle/Resources/config/api/public.yml" + resource: '@SkobkinPointToolsBundle/Resources/config/api/public.yml' prefix: /api/v1 api_crawler: - resource: "@SkobkinPointToolsBundle/Resources/config/api/crawler.yml" + resource: '@SkobkinPointToolsBundle/Resources/config/api/crawler.yml' prefix: /api/crawler diff --git a/src/Skobkin/Bundle/PointToolsBundle/Resources/config/services.yml b/src/Skobkin/Bundle/PointToolsBundle/Resources/config/services.yml index 4599a4a..df13f11 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Resources/config/services.yml +++ b/src/Skobkin/Bundle/PointToolsBundle/Resources/config/services.yml @@ -9,7 +9,7 @@ services: # HTTP client for Point API app.http.point_client: class: GuzzleHttp\Client - arguments: [ { base_uri: "%point_base_url%", timeout: 5.0 } ] + arguments: [ { base_uri: '%point_base_url%', timeout: 5.0 } ] tags: - { name: csa_guzzle.client } @@ -18,70 +18,70 @@ services: # Abstract API client with common dependency app.point.abstract_api: abstract: true - arguments: [@app.http.point_client] + arguments: ['@app.http.point_client'] app.point.api_user: class: Skobkin\Bundle\PointToolsBundle\Service\UserApi parent: app.point.abstract_api arguments: - - @doctrine.orm.entity_manager - - @serializer + - '@doctrine.orm.entity_manager' + - '@jms_serializer' app.point.api_post: class: Skobkin\Bundle\PointToolsBundle\Service\PostApi parent: app.point.abstract_api arguments: - - @app.point.post_factory + - '@app.point.post_factory' # Point subscription manager app.point.subscriptions_manager: class: Skobkin\Bundle\PointToolsBundle\Service\SubscriptionsManager - arguments: [ @doctrine.orm.entity_manager, @event_dispatcher ] + arguments: [ '@doctrine.orm.entity_manager', '@event_dispatcher' ] # Factories # User factory app.point.user_factory: class: Skobkin\Bundle\PointToolsBundle\Service\Factory\UserFactory - arguments: [ @doctrine.orm.entity_manager ] + arguments: [ '@doctrine.orm.entity_manager' ] # Comment factory app.point.comment_factory: class: Skobkin\Bundle\PointToolsBundle\Service\Factory\Blogs\CommentFactory - arguments: [ @doctrine.orm.entity_manager, @app.point.user_factory ] + arguments: [ '@doctrine.orm.entity_manager', '@app.point.user_factory' ] # Tag factory app.point.tag_factory: class: Skobkin\Bundle\PointToolsBundle\Service\Factory\Blogs\TagFactory - arguments: [ @logger, @doctrine.orm.entity_manager ] + arguments: [ '@logger', '@doctrine.orm.entity_manager' ] # File factory app.point.file_factory: class: Skobkin\Bundle\PointToolsBundle\Service\Factory\Blogs\FileFactory - arguments: [ @logger, @doctrine.orm.entity_manager ] + arguments: [ '@logger', '@doctrine.orm.entity_manager' ] # Post factory app.point.post_factory: class: Skobkin\Bundle\PointToolsBundle\Service\Factory\Blogs\PostFactory arguments: - - @logger - - @doctrine.orm.entity_manager - - @app.point.user_factory - - @app.point.file_factory - - @app.point.comment_factory - - @app.point.tag_factory + - '@logger' + - '@doctrine.orm.entity_manager' + - '@app.point.user_factory' + - '@app.point.file_factory' + - '@app.point.comment_factory' + - '@app.point.tag_factory' # Telegram accounts factory app.telegram.telegram_account_factory: class: Skobkin\Bundle\PointToolsBundle\Service\Factory\Telegram\AccountFactory - arguments: [@doctrine.orm.entity_manager] + arguments: ['@doctrine.orm.entity_manager'] # Custom Markdown parser app.point.markdown_parser: class: Skobkin\Bundle\PointToolsBundle\Service\Markdown\PointParser - arguments: [[], @router] + arguments: [[], '@router'] tags: - { name: markdown.parser } @@ -89,19 +89,19 @@ services: # Event listener app.event_listener.users_updated: class: Skobkin\Bundle\PointToolsBundle\EventListener\UsersUpdatedSubscriber - arguments: [@event_dispatcher] + arguments: ['@event_dispatcher'] tags: - { name: doctrine.event_subscriber, connection: default } app.event_listener.users_renamed_notifier: class: Skobkin\Bundle\PointToolsBundle\EventListener\UsersRenamedListener - arguments: [@app.telegram.notifier] + arguments: ['@app.telegram.notifier'] tags: - { name: kernel.event_listener, event: app.users.renamed } app.event_listener.user_subscribers_updated: class: Skobkin\Bundle\PointToolsBundle\EventListener\UserSubscribersUpdatedListener - arguments: [@app.telegram.notifier] + arguments: ['@app.telegram.notifier'] tags: - { name: kernel.event_listener, event: app.user.subscribers_updated } @@ -119,38 +119,38 @@ services: # API client app.telegram.api_client: class: unreal4u\TelegramAPI\TgLog - arguments: [%telegram_token%, @logger, @app.http.telegram_client] + arguments: ['%telegram_token%', '@logger', '@app.http.telegram_client'] # Message sender app.telegram.message_sender: class: Skobkin\Bundle\PointToolsBundle\Service\Telegram\MessageSender - arguments: [@app.telegram.api_client, @twig] + arguments: ['@app.telegram.api_client', '@twig'] # User notifier app.telegram.notifier: class: Skobkin\Bundle\PointToolsBundle\Service\Telegram\Notifier - arguments: [@doctrine.orm.entity_manager, @app.telegram.message_sender] + arguments: ['@doctrine.orm.entity_manager', '@app.telegram.message_sender'] # Common incoming message processor app.telegram.update_dispatcher: class: Skobkin\Bundle\PointToolsBundle\Service\Telegram\IncomingUpdateDispatcher arguments: - - @app.telegram.private_message_processor - - @app.telegram.inline_query_processor + - '@app.telegram.private_message_processor' + - '@app.telegram.inline_query_processor' # InlineQuery processor app.telegram.inline_query_processor: class: Skobkin\Bundle\PointToolsBundle\Service\Telegram\InlineQueryProcessor lazy: true - arguments: [@doctrine.orm.entity_manager, @app.telegram.api_client] + arguments: ['@doctrine.orm.entity_manager', '@app.telegram.api_client'] # Private message processor app.telegram.private_message_processor: class: Skobkin\Bundle\PointToolsBundle\Service\Telegram\PrivateMessageProcessor lazy: true arguments: - - @app.telegram.message_sender - - @app.point.api_user - - @app.telegram.telegram_account_factory - - @doctrine.orm.entity_manager - - %point_id% + - '@app.telegram.message_sender' + - '@app.point.api_user' + - '@app.telegram.telegram_account_factory' + - '@doctrine.orm.entity_manager' + - '%point_id%' diff --git a/web/app_dev.php b/web/app_dev.php index 5881bd7..ad4e9af 100644 --- a/web/app_dev.php +++ b/web/app_dev.php @@ -10,9 +10,9 @@ umask(0002); // This check prevents access to debug front controllers that are deployed by accident to production servers. // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) - //|| isset($_SERVER['HTTP_X_FORWARDED_FOR']) + || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !( - //in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || + in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server' ) ) {