Skip to content

Commit

Permalink
bump php-cs-fixer to 2.2
Browse files Browse the repository at this point in the history
php-cs-fixer v2.2 changes

Update php_cs settings for 2.2
  • Loading branch information
phil-davis authored and alanhartless committed Nov 23, 2017
1 parent 8cca179 commit 4b46c63
Show file tree
Hide file tree
Showing 190 changed files with 739 additions and 583 deletions.
24 changes: 14 additions & 10 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/app/bundles')
->in(__DIR__.'/app/config')
->in(__DIR__.'/app/middlewares')
->in(__DIR__.'/app/migrations')
->in(__DIR__.'/plugins');

return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->finder($finder)
->fixers([
'align_double_arrow',
'align_equals',
'ordered_use',
'short_array_syntax',
]);
return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'binary_operator_spaces' => [
'align_double_arrow' => true,
'align_equals' => true
],
'ordered_imports' => true,
'array_syntax' => [
'syntax' => 'short'
],
])
->setFinder($finder);
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function authenticate(TokenInterface $token)

throw new AuthenticationException($translator->trans('mautic.api.oauth.auth.failed'));
}

/**
* {@inheritdoc}
*/
Expand Down
2 changes: 0 additions & 2 deletions app/bundles/AssetBundle/Entity/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,6 @@ public function setFileNameFromRemote()
public function preUpload()
{
if (null !== $this->getFile()) {

// set the asset title as original file name if title is missing
if (null === $this->getTitle()) {
$this->setTitle($this->file->getClientOriginalName());
Expand All @@ -716,7 +715,6 @@ public function upload()
{
// the file property can be empty if the field is not required
if (null === $this->getFile()) {

// check for the remote and set type data
if ($this->isRemote()) {
$this->setFileInfoFromFile();
Expand Down
1 change: 0 additions & 1 deletion app/bundles/AssetBundle/EventListener/LeadSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public function onTimelineGenerate(LeadTimelineEvent $event)
$event->addToCounter($eventTypeKey, $downloads);

if (!$event->isEngagementCount()) {

// Add the downloads to the event array
foreach ($downloads['results'] as $download) {
$asset = $this->assetModel->getEntity($download['asset_id']);
Expand Down
1 change: 0 additions & 1 deletion app/bundles/AssetBundle/Model/AssetModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public function trackDownload($asset, $request = null, $code = '200', $systemEnt

// Download triggered by lead
if (empty($systemEntry)) {

//check for any clickthrough info
$clickthrough = $request->get('ct', false);
if (!empty($clickthrough)) {
Expand Down
1 change: 0 additions & 1 deletion app/bundles/AssetBundle/Views/Asset/list.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
'templateButtons' => [
'delete' => $permissions['asset:assets:deleteown'] || $permissions['asset:assets:deleteother'],
],

]
);

Expand Down
3 changes: 1 addition & 2 deletions app/bundles/CampaignBundle/Controller/CampaignController.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ protected function getIndexItems($start, $limit, $filter, $orderBy, $orderByDir,
if (!empty($currentFilters)) {
$listIds = $catIds = [];
foreach ($currentFilters as $type => $typeFilters) {
$listFilters['filters'] ['groups']['mautic.campaign.leadsource.'.$type]['values'] = $typeFilters;
$listFilters['filters']['groups']['mautic.campaign.leadsource.'.$type]['values'] = $typeFilters;

foreach ($typeFilters as $fltr) {
if ($type == 'list') {
Expand Down Expand Up @@ -718,7 +718,6 @@ protected function getViewArguments(array $args, $action)
'campaignEvents' => $this->campaignEvents,
'campaignSources' => $this->campaignSources,
'deletedEvents' => $this->deletedEvents,

]
);
break;
Expand Down
2 changes: 0 additions & 2 deletions app/bundles/CampaignBundle/Controller/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ public function editAction($objectId)

if ($closeModal) {
if ($success) {

//prevent undefined errors
$entity = new Event();
$blank = $entity->convertToArray();
Expand Down Expand Up @@ -437,7 +436,6 @@ public function deleteAction($objectId)

// Add the field to the delete list
if (!in_array($objectId, $deletedEvents)) {

//If event is new don't add to deleted list
if (strpos($objectId, 'new') === false) {
$deletedEvents[] = $objectId;
Expand Down
2 changes: 0 additions & 2 deletions app/bundles/CampaignBundle/Model/EventModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,6 @@ public function triggerNegativeEvents(

// Prevent path if lead has already gone down this path
if (!isset($leadLog[$lead->getId()]) || !array_key_exists($parentId, $leadLog[$lead->getId()])) {

// Get date to compare against
$utcDateString = ($grandParentId) ? $leadLog[$lead->getId()][$grandParentId]['date_triggered']
: $campaignLeadDates[$lead->getId()];
Expand Down Expand Up @@ -1243,7 +1242,6 @@ public function triggerNegativeEvents(
}

if ($max && ($totalEventCount + count($nonActionEvents)) >= $max) {

// Hit the max or will hit the max while mid-process for the lead
if ($output && isset($progress)) {
$progress->finish();
Expand Down
1 change: 1 addition & 0 deletions app/bundles/CampaignBundle/Tests/CampaignTestAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class CampaignTestAbstract extends \PHPUnit_Framework_TestCase
{
protected static $mockId = 232;
protected static $mockName = 'Mock name';

/**
* @return CampaignModel
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ public function newAction($bundle)
],
]);
} elseif (!empty($valid)) {

//return edit view to prevent duplicates
return $this->editAction($bundle, $entity->getId(), true);
} else {
Expand Down
6 changes: 0 additions & 6 deletions app/bundles/ChannelBundle/Config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
],
],
'public' => [

],
],

Expand All @@ -48,13 +47,10 @@
],
],
'admin' => [

],
'profile' => [

],
'extra' => [

],
],

Expand Down Expand Up @@ -87,7 +83,6 @@
'mautic.lead.model.company_report_data',
],
],

],
'forms' => [
\Mautic\ChannelBundle\Form\Type\MessageType::class => [
Expand Down Expand Up @@ -139,6 +134,5 @@
],

'parameters' => [

],
];
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
class MessageQueueRepository extends CommonRepository
{
use TimelineTrait;

/**
* @param $channel
* @param $channelId
Expand Down
1 change: 0 additions & 1 deletion app/bundles/ChannelBundle/Form/Type/MessageSendType.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'marketingMessage',
'message_list',
[

'label' => 'mautic.channel.send.selectmessages',
'label_attr' => ['class' => 'control-label'],
'multiple' => false,
Expand Down
1 change: 0 additions & 1 deletion app/bundles/ChannelBundle/Views/Message/details.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,3 @@
</div>
</div>
<?php

1 change: 0 additions & 1 deletion app/bundles/ConfigBundle/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public function editAction()
if (!$cancelled = $this->isFormCancelled($form)) {
$isValid = false;
if ($isWritabale && $isValid = $this->isFormValid($form)) {

// Bind request to the form
$post = $this->request->request;
$formData = $form->getData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
function auth()
{
// You can insert your own code over here to check if the user is authorized.
// If you use a session variable, you've got to start the session first (session_start())
return true;
// If you use a session variable, you've got to start the session first (session_start())
return true;
}

// @todo Work on plugins registration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class Filemanager
public function __construct($extraConfig = '')
{

// getting default config file
$content = file_get_contents('../../scripts/filemanager.config.js.default');
$config_default = json_decode($content, true);
Expand Down Expand Up @@ -268,7 +267,6 @@ public function getfolder()
$file
)
) {

// check if file is writable and readable
if (!$this->has_system_permission($current_path.$file, ['w', 'r'])) {
$protected = 1;
Expand Down Expand Up @@ -475,7 +473,6 @@ public function rename()

public function move()
{

// dynamic fileroot dir must be used when enabled
if ($this->dynamic_fileroot != '') {
$rootDir = $this->dynamic_fileroot;
Expand Down Expand Up @@ -622,7 +619,6 @@ public function replace()
$this->setParams();

if (!isset($_FILES['fileR']) || !is_uploaded_file($_FILES['fileR']['tmp_name'])) {

// if fileSize limit set by the user is greater than size allowed in php.ini file, we apply server restrictions
// and log a warning into file
if ($this->config['upload']['fileSizeLimit'] > $this->getMaxUploadFileSize()) {
Expand Down Expand Up @@ -738,7 +734,6 @@ public function add()
$this->setParams();

if (!isset($_FILES['newfile']) || !is_uploaded_file($_FILES['newfile']['tmp_name'])) {

// if fileSize limit set by the user is greater than size allowed in php.ini file, we apply server restrictions
// and log a warning into file
if ($this->config['upload']['fileSizeLimit'] > $this->getMaxUploadFileSize()) {
Expand Down Expand Up @@ -865,7 +860,7 @@ public function addfolder()
*
* @return bool
*
* @link http://stackoverflow.com/questions/17584869/zip-main-folder-with-sub-folder-inside
* @see http://stackoverflow.com/questions/17584869/zip-main-folder-with-sub-folder-inside
*/
public function zipFile($source, $destination, $flag = '')
{
Expand Down Expand Up @@ -924,7 +919,6 @@ public function download()
$this->error(sprintf($this->lang('INVALID_FILE_TYPE')), true);
}
} else {

// check if permission is granted
if (is_dir($current_path) && $this->config['security']['allowFolderDownload'] == false) {
$this->error(sprintf($this->lang('NOT_ALLOWED')), true);
Expand Down Expand Up @@ -965,7 +959,6 @@ public function preview($thumbnail)
$current_path = $this->getFullPath();

if (isset($this->get['path']) && file_exists($current_path)) {

// if $thumbnail is set to true we return the thumbnail
if ($this->config['options']['generateThumbnails'] == true && $thumbnail == true) {
// get thumbnail (and create it if needed)
Expand Down Expand Up @@ -1047,7 +1040,6 @@ private function has_system_permission($filepath, $perms)

private function get_file_info($path = '', $thumbnail = false)
{

// DO NOT rawurlencode() since $current_path it
// is used for displaying name file
if ($path == '') {
Expand Down Expand Up @@ -1078,7 +1070,6 @@ private function get_file_info($path = '', $thumbnail = false)
if (is_dir($current_path)) {
$this->item['preview'] = $this->config['icons']['path'].$this->config['icons']['directory'];
} elseif (in_array(strtolower($this->item['filetype']), array_map('strtolower', $this->config['images']['imagesExt']))) {

// svg should not be previewed as raster formats images
if ($this->item['filetype'] == 'svg') {
$this->item['preview'] = $current_path;
Expand Down Expand Up @@ -1157,7 +1148,6 @@ private function formatPath($path)

private function sortFiles($array)
{

// handle 'NAME_ASC'
if ($this->config['options']['fileSorting'] == 'NAME_ASC') {
$array = array_reverse($array);
Expand Down Expand Up @@ -1206,11 +1196,11 @@ private function sortFiles($array)
return $array;
}

// @todo to remove
// private function startsWith($haystack, $needle) {
// // search backwards starting from haystack length characters from the end
// return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;
// }
// @todo to remove
// private function startsWith($haystack, $needle) {
// // search backwards starting from haystack length characters from the end
// return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;
// }

private function is_valid_path($path)
{
Expand Down Expand Up @@ -1252,7 +1242,7 @@ private function is_allowed_file_type($file)
$path_parts = pathinfo($file);

// if there is no extension
if (!isset($path_parts ['extension'])) {
if (!isset($path_parts['extension'])) {
// we check if no extension file are allowed
return (bool) $this->config['security']['allowNoExtension'];
}
Expand Down Expand Up @@ -1448,7 +1438,6 @@ private function get_thumbnail($path)

// if thumbnail does not exist we generate it
if (!file_exists($thumbnail_fullpath)) {

// create folder if it does not exist
if (!file_exists(dirname($thumbnail_fullpath))) {
mkdir(dirname($thumbnail_fullpath), 0755, true);
Expand Down Expand Up @@ -1501,7 +1490,6 @@ private function checkFilename($path, $filename, $i = '')

private function loadLanguageFile()
{

// we load langCode var passed into URL if present and if exists
// else, we use default configuration var
$lang = $this->config['options']['culture'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

// only for debug
// error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// ini_set('display_errors', '1');
Expand Down Expand Up @@ -32,7 +33,6 @@
} else {
if (isset($_GET['mode']) && $_GET['mode'] != '') {
switch ($_GET['mode']) {

default:

$fm->error($fm->lang('MODE_ERROR'));
Expand Down Expand Up @@ -106,7 +106,6 @@
}
} elseif (isset($_POST['mode']) && $_POST['mode'] != '') {
switch ($_POST['mode']) {

default:

$fm->error($fm->lang('MODE_ERROR'));
Expand Down
Loading

0 comments on commit 4b46c63

Please sign in to comment.